1 // Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
2 // Copyright (C) 2010 Winch Gate Property Limited
4 // This source file has been modified by the following contributors:
5 // Copyright (C) 2013 Laszlo KIS-ADAM (dfighter) <dfighter1985@gmail.com>
7 // This program is free software: you can redistribute it and/or modify
8 // it under the terms of the GNU Affero General Public License as
9 // published by the Free Software Foundation, either version 3 of the
10 // License, or (at your option) any later version.
12 // This program is distributed in the hope that it will be useful,
13 // but WITHOUT ANY WARRANTY; without even the implied warranty of
14 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 // GNU Affero General Public License for more details.
17 // You should have received a copy of the GNU Affero General Public License
18 // along with this program. If not, see <http://www.gnu.org/licenses/>.
22 #ifndef RZ_MACROCMD_KEY_H
23 #define RZ_MACROCMD_KEY_H
25 #include "../actions_client.h"
29 class CGroupContainer
;
32 // ***************************************************************************
33 #define WIN_EDITCMD_TITLE_NEW_KEY "uiNewKey"
34 #define WIN_EDITCMD_TITLE_EDIT_KEY "uiEditKey"
35 #define WIN_EDITCMD_TITLE_NEW_CMD "uiNewCmd"
36 #define WIN_EDITCMD_TITLE_EDIT_CMD "uiEditCmd"
38 // ***************************************************************************
39 class CModalContainerEditCmd
43 CModalContainerEditCmd();
44 void create (const std::string
&name
, bool bDefKey
, bool allowAllActions
);
45 void setTitle (const std::string
&uistr
); // UI String (uiEditCmd) to be localized
49 void activateFrom (const std::string
&cmdName
, const std::string
&cmdParams
, sint nRef
);
51 void onChangeCategory(); // Called by the AH
52 void onChangeAction();
53 void checkCurrentCommandValidity();
56 NLGUI::CGroupContainer
*Win
;
60 // Used by all_keys container to handle deletion and the like
63 uint8 ComboAM
; // action manager of the line
64 CCombo Combo
; // combo of the line (KeyCount if not associated)
65 CAction::CName ActionName
;
67 std::vector
<CLine
> AllLines
;
69 CActionsManager
*CurAM
; // Current Action Manager When Editing
70 CLine CurrentEditCmdLine
; // The current combo/action line edited
71 std::vector
<std::string
> CurrentEditCmdCategories
;
73 sint32 CurrentEditCmdNb
; // -1 -> create
75 std::string DbComboSelCat
;
76 std::string DbComboSelAct
;
77 std::string DbComboSel1P
;
78 std::string DbComboSel2P
;
79 std::string DbComboDisp1P
;
80 std::string DbComboDisp2P
;
83 // allow all actions? not only macroisable one?
84 bool _AllowAllActions
;
86 bool getCatIndexAndAM (sint32 nInCatIndex
, sint32
&nOutCatIndex
, CActionsManager
*&nOutAM
);
87 bool getBaseActionIndex(const CCategory
&cat
, sint32 nInActIndex
, sint32
&nOutActIndex
);
88 void invalidCurrentCommand();
89 void validCurrentCommand();
90 bool isParamValid (sint32 nParamIndex
);
93 // ***************************************************************************
95 // ***************************************************************************
97 #define TEMPLATE_EDITCMD "teditcmd"
99 #define WIN_EDITCMD_TITLE ":header_opened:title"
101 #define WIN_EDITCMD_COMBO_CATEGORY ":content:combo_cat"
102 #define WIN_EDITCMD_COMBO_ACTION ":content:combo_action"
103 #define WIN_EDITCMD_COMBO_FIRST_PARAM_LIST ":content:first_param_list"
104 #define WIN_EDITCMD_COMBO_FIRST_PARAM_EDITBOX ":content:first_param_editbox:eb"
105 #define WIN_EDITCMD_COMBO_SECOND_PARAM_LIST ":content:second_param_list"
106 #define WIN_EDITCMD_COMBO_SECOND_PARAM_EDITBOX ":content:second_param_editbox:eb"
108 #define VIEW_EDITCMD_FIRST_PARAM_NAME ":content:first_param_name"
109 #define VIEW_EDITCMD_SECOND_PARAM_NAME ":content:second_param_name"
111 #define CTRL_EDITCMD_BUTTON_OK ":content:ok_cancel:ok"
112 #define CTRL_EDITCMD_KEY_GROUP ":content:keygrp"
113 #define CTRL_EDITCMD_BUTTON_KEY ":content:keygrp:butkey"
114 #define VIEW_EDITCMD_TEXT_KEY ":content:keygrp:txtkey"
115 #define VIEW_EDITCMD_TEXT_KEY_DEFAULT "uiEditCmdNone"
117 #define DB_EDITCMD_PREFIX "UI:TEMP"
118 #define DB_EDITCMD_COMBO_SELECT_CATEGORY "COMBO_SELECT_CATEGORY"
119 #define DB_EDITCMD_COMBO_SELECT_ACTION "COMBO_SELECT_ACTION"
120 #define DB_EDITCMD_COMBO_SELECT_FIRST_PARAM "COMBO_SELECT_FIRST_PARAM"
121 #define DB_EDITCMD_COMBO_SELECT_SECOND_PARAM "COMBO_SELECT_SECOND_PARAM"
122 // display (-1,none)(0,list)(1,editbox)
123 #define DB_EDITCMD_COMBO_DISPLAY_FIRST_PARAM "DISPLAY_FIRST_PARAM"
124 #define DB_EDITCMD_COMBO_DISPLAY_SECOND_PARAM "DISPLAY_SECOND_PARAM"
127 #endif // RZ_MACROCMD_KEY_H