| 1 | /* |
|---|
| 2 | ================================================================================= |
|---|
| 3 | This file is part of Cafu, the open-source game engine and graphics engine |
|---|
| 4 | for multiplayer, cross-platform, real-time 3D action. |
|---|
| 5 | Copyright (C) 2002-2012 Carsten Fuchs Software. |
|---|
| 6 | |
|---|
| 7 | Cafu is free software: you can redistribute it and/or modify it under the terms |
|---|
| 8 | of the GNU General Public License as published by the Free Software Foundation, |
|---|
| 9 | either version 3 of the License, or (at your option) any later version. |
|---|
| 10 | |
|---|
| 11 | Cafu is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; |
|---|
| 12 | without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR |
|---|
| 13 | PURPOSE. See the GNU General Public License for more details. |
|---|
| 14 | |
|---|
| 15 | You should have received a copy of the GNU General Public License |
|---|
| 16 | along with Cafu. If not, see <http://www.gnu.org/licenses/>. |
|---|
| 17 | |
|---|
| 18 | For support and more information about Cafu, visit us at <http://www.cafu.de>. |
|---|
| 19 | ================================================================================= |
|---|
| 20 | */ |
|---|
| 21 | |
|---|
| 22 | #ifndef CAFU_TOOLBAR_GROUPS_HPP_INCLUDED |
|---|
| 23 | #define CAFU_TOOLBAR_GROUPS_HPP_INCLUDED |
|---|
| 24 | |
|---|
| 25 | #include "ObserverPattern.hpp" |
|---|
| 26 | #include "MapCommands/Group_SetProp.hpp" |
|---|
| 27 | #include "Templates/Array.hpp" |
|---|
| 28 | #include "wx/panel.h" |
|---|
| 29 | |
|---|
| 30 | |
|---|
| 31 | class MapDocumentT; |
|---|
| 32 | class GroupsListViewT; |
|---|
| 33 | |
|---|
| 34 | |
|---|
| 35 | /// The groups toolbar (actually, a dialog). |
|---|
| 36 | class GroupsToolbarT : public wxPanel, public ObserverT |
|---|
| 37 | { |
|---|
| 38 | public: |
|---|
| 39 | |
|---|
| 40 | /// The constructor. |
|---|
| 41 | GroupsToolbarT(wxWindow* Parent, MapDocumentT* MapDoc); |
|---|
| 42 | |
|---|
| 43 | /// The destructor. |
|---|
| 44 | ~GroupsToolbarT(); |
|---|
| 45 | |
|---|
| 46 | // Implementation of the ObserverT interface. |
|---|
| 47 | void NotifySubjectChanged_Groups(SubjectT* Subject); |
|---|
| 48 | void NotifySubjectDies(SubjectT* Subject); |
|---|
| 49 | |
|---|
| 50 | |
|---|
| 51 | private: |
|---|
| 52 | |
|---|
| 53 | friend class GroupsListViewT; |
|---|
| 54 | |
|---|
| 55 | MapDocumentT* m_MapDoc; |
|---|
| 56 | GroupsListViewT* m_ListView; |
|---|
| 57 | bool m_IsRecursiveSelfNotify; |
|---|
| 58 | |
|---|
| 59 | // The event handlers. |
|---|
| 60 | void OnToggleVisibility(unsigned long GroupNr); ///< Called by the m_ListView when the visibility of the group with the given number was toggled. |
|---|
| 61 | void OnToggleProperty(unsigned long GroupNr, CommandGroupSetPropT::PropT Prop); ///< Called by the m_ListView when a property of the group with the given number was toggled. |
|---|
| 62 | void OnMenu(wxCommandEvent& CE); ///< Event handler for popup (context) menu events. |
|---|
| 63 | void OnMenuUpdate(wxUpdateUIEvent& UE); ///< Event handler for popup menu update events. |
|---|
| 64 | |
|---|
| 65 | /// IDs for the controls in whose events we are interested. |
|---|
| 66 | enum |
|---|
| 67 | { |
|---|
| 68 | ID_LISTVIEW_GROUPS=wxID_HIGHEST+1, |
|---|
| 69 | ID_MENU_SELECT, |
|---|
| 70 | ID_MENU_EDIT_RENAME, |
|---|
| 71 | ID_MENU_EDIT_SETCOLOR, |
|---|
| 72 | ID_MENU_EDIT_SHOW, |
|---|
| 73 | ID_MENU_EDIT_HIDE, |
|---|
| 74 | ID_MENU_EDIT_CANSELECT, |
|---|
| 75 | ID_MENU_EDIT_LOCK, |
|---|
| 76 | ID_MENU_EDIT_SELASGROUP, |
|---|
| 77 | ID_MENU_EDIT_SELASINDIV, |
|---|
| 78 | // ID_MENU_NEW_GROUP, // Create a new, empty group. Doesn't buy us any new functionality at the cost of confusing the user. |
|---|
| 79 | // ID_MENU_AUGMENT_GROUP, // Add/Assign the selected elements as members of this group. Same problem as with ID_MENU_NEW_GROUP. |
|---|
| 80 | ID_MENU_DELETE, |
|---|
| 81 | ID_MENU_MERGE, |
|---|
| 82 | ID_MENU_MOVEUP, |
|---|
| 83 | ID_MENU_MOVEDOWN |
|---|
| 84 | }; |
|---|
| 85 | |
|---|
| 86 | DECLARE_EVENT_TABLE() |
|---|
| 87 | }; |
|---|
| 88 | |
|---|
| 89 | #endif |
|---|