Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CfgFunctions for FlexiMenu ui subcomponent #1064

Merged
merged 1 commit into from
Feb 15, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 31 additions & 4 deletions addons/ui/CfgFunctions.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,48 @@ class CfgFunctions {
class CBA {
class UI {
class flexiMenu_Add {
description = "Add a type-based menu source. Result: TBA (WIP)";
file = QUOTE(PATHTOF(flexiMenu\fnc_add.sqf));
};
class flexiMenu_Remove {
description = "Remove a type-based menu source. Result: TBA (WIP)";
file = QUOTE(PATHTOF(flexiMenu\fnc_remove.sqf));
};
class flexiMenu_setObjectMenuSource {
description = "Set an object's menu source (variable). Result: TBA (WIP)";
file = QUOTE(PATHTOF(flexiMenu\fnc_setObjectMenuSource.sqf));
};
class flexiMenu_openMenuByDef {
description = "Open a previously defined menu by passing the exact parameters used with cba_fnc_fleximenu_add. Result: TBA (WIP)";
file = QUOTE(PATHTOF(flexiMenu\fnc_openMenuByDef.sqf));
};
class flexiMenu_keyDown {
file = QUOTE(PATHTOF(flexiMenu\fnc_keyDown.sqf));
};
class flexiMenu_keyUp {
file = QUOTE(PATHTOF(flexiMenu\fnc_keyUp.sqf));
};
class flexiMenu_menu {
file = QUOTE(PATHTOF(flexiMenu\fnc_menu.sqf));
};
class flexiMenu_list {
file = QUOTE(PATHTOF(flexiMenu\fnc_list.sqf));
};
class flexiMenu_getMenuDef {
file = QUOTE(PATHTOF(flexiMenu\fnc_getMenuDef.sqf));
};
class flexiMenu_getMenuOption {
file = QUOTE(PATHTOF(flexiMenu\fnc_getMenuOption.sqf));
};
class flexiMenu_menuShortcut {
file = QUOTE(PATHTOF(flexiMenu\fnc_menuShortcut.sqf));
};
class flexiMenu_mouseButtonDown {
file = QUOTE(PATHTOF(flexiMenu\fnc_mouseButtonDown.sqf));
};
class flexiMenu_highlightCaretKey {
file = QUOTE(PATHTOF(flexiMenu\fnc_highlightCaretKey.sqf));
};
class flexiMenu_execute {
file = QUOTE(PATHTOF(flexiMenu\fnc_execute.sqf));
};

PATHTO_FNC(addPauseMenuOption);
PATHTO_FNC(progressBar);
PATHTO_FNC(getFov);
Expand Down
16 changes: 0 additions & 16 deletions addons/ui/flexiMenu/init.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -8,22 +8,6 @@ GVAR(target) = objNull; // current object for interaction
GVAR(holdKeyDown) = false; // default global behaviour of requiring holding key down. Can be overriden by menus.
GVAR(hotKeyColor) = ""; // override colour of hotkey. It is set from rsc menu file, upon opening either the "menu" or "list". If not present, a default will be used.

PREP_SUB(flexiMenu,keyDown);
PREP_SUB(flexiMenu,keyUp);
PREP_SUB(flexiMenu,menu);
PREP_SUB(flexiMenu,list);
PREP_SUB(flexiMenu,getMenuDef);
PREP_SUB(flexiMenu,getMenuOption);
PREP_SUB(flexiMenu,menuShortcut);
PREP_SUB(flexiMenu,mouseButtonDown);
PREP_SUB(flexiMenu,highlightCaretKey);
PREP_SUB(flexiMenu,execute);

// TODO: move these to public CfgFunctions soon.
PREP_SUB(flexiMenu,add);
PREP_SUB(flexiMenu,remove);
PREP_SUB(flexiMenu,setObjectMenuSource);

// prevent instant reactivation of menu after selection was made, while key still held down. Value is reset upon key release.
GVAR(optionSelected) = false;
// prevent multiple activations of menu due to key press via keyDown. onLoad can sometimes take a few milliseconds to init.
Expand Down
6 changes: 0 additions & 6 deletions addons/ui/script_component.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -85,11 +85,5 @@
#define __SMW_default 0.15 * safeZoneW // common sub-menu width, used in script
#define __defaultHotkeyColor "#f07EB27E"

// additional "_SUB" macros to handle sub folders
#define PATHTO_SUB(var1,var2,var3,var4) MAINPREFIX\##var1\SUBPREFIX\##var2\##var3\##var4.sqf
#define COMPILE_FILE_SUB(var1,var2,var3,var4) COMPILE_FILE2(PATHTO_SUB(var1,var2,var3,var4))
#define PREP_SYS_SUB(var1,var2,var3,var4) ##var1##_##var2##_fnc_##var4 = COMPILE_FILE_SUB(var1,var2,var3,DOUBLES(fnc,var4))
#define PREP_SUB(var1,var2) PREP_SYS_SUB(PREFIX,COMPONENT_F,var1,var2)

// array select with bounds check (for optional parameters)
#define IfCountDefault(var1,array2,index3,default4) ##var1 = if (count ##array2 > ##index3) then {##array2 select ##index3} else {##default4};