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) 2012 Matt RAYKOWSKI (sfb) <matt.raykowski@gmail.com>
6 // Copyright (C) 2013 Laszlo KIS-ADAM (dfighter) <dfighter1985@gmail.com>
8 // This program is free software: you can redistribute it and/or modify
9 // it under the terms of the GNU Affero General Public License as
10 // published by the Free Software Foundation, either version 3 of the
11 // License, or (at your option) any later version.
13 // This program is distributed in the hope that it will be useful,
14 // but WITHOUT ANY WARRANTY; without even the implied warranty of
15 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 // GNU Affero General Public License for more details.
18 // You should have received a copy of the GNU Affero General Public License
19 // along with this program. If not, see <http://www.gnu.org/licenses/>.
23 #ifndef CL_ACTION_HANDLER_HELP_H
24 #define CL_ACTION_HANDLER_HELP_H
27 #include "inventory_manager.h"
28 #include "bot_chat_manager.h"
31 // Struct that tells how to setup a help window
35 CInterfaceGroup
*HelpWindow
;
36 CDBCtrlSheet
*SrcSheet
; // the sheet for which info should be displayed (outside of the help window)
37 CDBCtrlSheet
*DestSheet
; // copy of the sheet for which info are asked (this sheet is in the help window, the source sheet is copied in it)
38 std::string ViewText
; // id of the text inside the help window that receive infos about the sheet
39 std::string ViewTextID
; // id of the text_id inside the help window that receive infos about the sheet (for dynamic infos -> missions)
40 std::string ScrollTextGroup
; // name of the group that contains the description text
41 std::string ScrollTextIdGroup
; // name of the group that contains the description text_id
42 std::string CreatorViewTextID
; // name of the text_id in the help window that contain the name of the item's creator
43 std::string PrefixForExtra
; // Id Prefix for list brick and mp stats (from the help window root)
55 // set the default ids for help window
56 void setupDefaultIDs();
60 // reset some elements in the windows (brick lists etc...)
61 void resetSheetHelp(CSheetHelpSetup
&setup
);
63 // Setup help for a sheet in a window. Type is deduced from the sheet
64 void setupSheetHelp(CSheetHelpSetup
&setup
);
66 // Refresh help for an item
67 void refreshItemHelp(CSheetHelpSetup
&setup
);
68 // refresh help for a mission
69 void refreshMissionHelp(CSheetHelpSetup
&setup
, const CPrerequisitInfos
&infos
);
71 class CPetAnimalItemInfoWaiter
: public IItemInfoWaiter
77 CClientItemInfo info
= getInventory().getItemInfo(ItemSlotId
);
82 // ***************************************************************************
83 /** static methods to manipulate Helps
88 // Open and set the group next to the element
89 static CInterfaceGroup
*activateNextWindow(CDBCtrlSheet
*elt
, sint forceKeepWindow
=-1);
91 // Close all the Help Windows
92 static void closeAll();
94 // remove waiter for ItemInfo
95 static void removeWaiterItemInfo(uint i
);
96 static void removeWaiterMissionInfo(uint i
);
98 static void changeKeepMode(uint i
);
99 static void setKeepMode(uint i
, bool state
);
101 // init windows default pos.
102 static void resetWindowPos(sint y
);
104 // serial info windows
105 static void serialInfoWindows(NLMISC::IStream
&f
);
107 // debug info windows
108 static void debugOpenedInfoWindows();
110 // update SPhrase Text of all opened windows
111 static void updateWindowSPhraseTexts();
113 // release the manager
114 static void release();
117 friend class CHandlerHelpKeep
;
118 friend class CAHItemHelpMpChangeItemPart
;
120 class CInfoWindowSave
124 void serial(NLMISC::IStream
&f
)
130 class CInfoWindow
: public IItemInfoWaiter
, public IMissionPrereqInfosWaiter
134 CInterfaceGroupPtr Window
;
135 // The item used to open this window
136 CDBCtrlSheet
*CtrlSheet
;
139 // The button for KeepMode. Button state == KeepMode
140 CCtrlBaseButtonPtr KeepButton
;
142 CInfoWindow() : CtrlSheet(NULL
) {KeepMode
= false;}
143 virtual void infoReceived();
144 virtual void missionInfoReceived(const CPrerequisitInfos
&infos
);
147 // update the brick help window when weight of hands has changed
148 class CFittedWeaponWeightObserver
: public NLMISC::ICDBNode::IPropertyObserver
151 virtual void update(NLMISC::ICDBNode
* node
);
155 static std::deque
<uint
> _ActiveWindows
;
156 static std::vector
<CInfoWindow
> _InfoWindows
;
157 static bool _InfoWindowInit
;
158 static CFittedWeaponWeightObserver _FittedWeaponWeightObserver
;
160 static void initWindows();