Skip to content

Commit

Permalink
Added listBoxMulti menu
Browse files Browse the repository at this point in the history
  • Loading branch information
ConnorAU committed May 6, 2020
1 parent b35cae6 commit 4e2d3a1
Show file tree
Hide file tree
Showing 4 changed files with 92 additions and 4 deletions.
1 change: 1 addition & 0 deletions addon/config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ class CfgFunctions {
#include "systems\displayColorPicker.cpp"
#include "systems\displayGuiMessage.cpp"
#include "systems\displayListbox.cpp"
#include "systems\displayListboxMulti.cpp"
#include "systems\displaySlider.cpp"
#include "systems\displayText.cpp"
#include "systems\displayTextMulti.cpp"
1 change: 1 addition & 0 deletions addon/description.ext
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ class CfgFunctions {
#include "cau\userinputmenus\systems\displayColorPicker.cpp"
#include "cau\userinputmenus\systems\displayGuiMessage.cpp"
#include "cau\userinputmenus\systems\displayListbox.cpp"
#include "cau\userinputmenus\systems\displayListboxMulti.cpp"
#include "cau\userinputmenus\systems\displaySlider.cpp"
#include "cau\userinputmenus\systems\displayText.cpp"
#include "cau\userinputmenus\systems\displayTextMulti.cpp"
26 changes: 22 additions & 4 deletions addon/systems/displayListbox.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
params [
["_items",[],[[]]],
["_startIndex",0,[0]],
["_multiSel",false,[true]],
["_title","",[""]],
["_code",{},[{}]],
["_button1","",[""]],
Expand All @@ -21,12 +22,12 @@ params [
];

if (!isNull _parentDisplay) then {
_parentDisplay createDisplay QUOTE(DISPLAY_NAME);
_parentDisplay createDisplay ([QUOTE(DISPLAY_NAME),QUOTE(JOIN(DISPLAY_NAME,Multi))] select _multiSel);
} else {
createDialog QUOTE(DISPLAY_NAME);
createDialog ([QUOTE(DISPLAY_NAME),QUOTE(JOIN(DISPLAY_NAME,Multi))] select _multiSel);
};

private _return = {
private _return = [{
params ["_display","_confirmed"];
USE_CTRL(_ctrlInput,IDC_INPUT);
private _code = _display getVariable ["code",{}];
Expand All @@ -39,7 +40,24 @@ private _return = {
private ["_display","_ctrlInput","_code"];
[] call _this;
};
};
},{
params ["_display","_confirmed"];
USE_CTRL(_ctrlInput,IDC_INPUT);
private _code = _display getVariable ["code",{}];
if !_confirmed then {
for "_i" from 0 to (lbSize _ctrlInput - 1) do {
_ctrlInput lbSetSelected [_i,false];
};
};
private _index = lbSelection _ctrlInput;
private _data = _index apply {_ctrlInput lbData _x};
private _value = _index apply {_ctrlInput lbValue _x};
_display closeDisplay 2;
_code call {
private ["_display","_ctrlInput","_code"];
[] call _this;
};
}] select _multiSel;

#include "_common.inc"

Expand Down
68 changes: 68 additions & 0 deletions addon/systems/displayListboxMulti.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
/*──────────────────────────────────────────────────────┐
│ Author: Connor │
│ Steam: https://steamcommunity.com/id/_connor │
│ Github: https://github.com/ConnorAU │
│ │
│ Please do not modify or remove this comment block │
└──────────────────────────────────────────────────────*/

#define DIALOG_W 90
#define DIALOG_H 100

class CAU_UserInputMenus_displayListboxMulti {
idd=-1;
onLoad="uinameSpace setVariable ['CAU_UserInputMenus_displayListbox',_this#0]";

class controlsBackground {
class tiles: CAU_UserInputMenus_ctrlStaticBackgroundDisableTiles {};
class background: CAU_UserInputMenus_ctrlStaticBackground {
idc=IDC_BACKGROUND;

x=CENTER_XA(DIALOG_W);
y=CENTER_YA(DIALOG_H);
w=PX_WA(DIALOG_W);
h=PX_HA(DIALOG_H);
};
class title: CAU_UserInputMenus_ctrlStaticTitle {
idc=IDC_TITLE;

x=CENTER_XA(DIALOG_W);
y=CENTER_YA(DIALOG_H);
w=PX_WA(DIALOG_W);
h=PX_HA(SIZE_M);
};
class footer: CAU_UserInputMenus_ctrlStaticFooter {
idc=IDC_FOOTER;

x=CENTER_XA(DIALOG_W);
y=CENTER_YA(DIALOG_H) + PX_HA(DIALOG_H) - PX_HA(SIZE_XXL);
w=PX_WA(DIALOG_W);
h=PX_HA(SIZE_XXL);
};
};
class controls {
class list: CAU_UserInputMenus_ctrlListbox {
idc=IDC_INPUT;
size=PX_HA(SIZE_M);
style="0x10 + 0x20";

x=CENTER_XA(DIALOG_W) + PX_WA(2);
y=CENTER_YA(DIALOG_H) + PX_HA(SIZE_M) + PX_HA(2);
w=PX_WA(DIALOG_W) - PX_WA(4);
h=PX_HA(DIALOG_H) - PX_HA(SIZE_M) - PX_HA(SIZE_XXL) - PX_HA(4);
};
class buttonL: CAU_UserInputMenus_ctrlButton {
idc=IDC_BUTTONL;

x=CENTER_XA(DIALOG_W) + PX_WA(DIALOG_W) - PX_WA(((SIZE_M*6)*2)) - PX_WA(2);
y=CENTER_YA(DIALOG_H) + PX_HA(DIALOG_H) - PX_HA(SIZE_M) - PX_HA(1);
w=PX_WA((SIZE_M*6));
h=PX_HA(SIZE_M);
};
class buttonR: buttonL {
idc=IDC_BUTTONR;

x=CENTER_XA(DIALOG_W) + PX_WA(DIALOG_W) - PX_WA((SIZE_M*6)) - PX_WA(1);
};
};
};

0 comments on commit 4e2d3a1

Please sign in to comment.