1 /* 2 Copyright (C) 2010-2014 Kristian Duske 3 4 This file is part of TrenchBroom. 5 6 TrenchBroom is free software: you can redistribute it and/or modify 7 it under the terms of the GNU General Public License as published by 8 the Free Software Foundation, either version 3 of the License, or 9 (at your option) any later version. 10 11 TrenchBroom is distributed in the hope that it will be useful, 12 but WITHOUT ANY WARRANTY; without even the implied warranty of 13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 GNU General Public License for more details. 15 16 You should have received a copy of the GNU General Public License 17 along with TrenchBroom. If not, see <http://www.gnu.org/licenses/>. 18 */ 19 20 #ifndef TrenchBroom_SmartSpawnflagsEditor 21 #define TrenchBroom_SmartSpawnflagsEditor 22 23 #include "Assets/AssetTypes.h" 24 #include "Model/ModelTypes.h" 25 #include "View/SmartAttributeEditor.h" 26 #include "View/ViewTypes.h" 27 28 #include <wx/gdicmn.h> 29 30 class wxCheckBox; 31 class wxColor; 32 class wxCommandEvent; 33 class wxScrolledWindow; 34 class wxString; 35 class wxWindow; 36 37 namespace TrenchBroom { 38 namespace View { 39 class FlagsEditor; 40 class FlagChangedCommand; 41 42 class SmartSpawnflagsEditor : public SmartAttributeEditor { 43 private: 44 static const size_t NumFlags = 24; 45 static const size_t NumCols = 3; 46 47 class UpdateSpawnflag; 48 49 wxScrolledWindow* m_scrolledWindow; 50 wxPoint m_lastScrollPos; 51 FlagsEditor* m_flagsEditor; 52 bool m_ignoreUpdates; 53 public: 54 SmartSpawnflagsEditor(View::MapDocumentWPtr document); 55 56 void OnFlagChanged(FlagChangedCommand& event); 57 private: 58 wxWindow* doCreateVisual(wxWindow* parent); 59 void doDestroyVisual(); 60 void doUpdateVisual(const Model::AttributableNodeList& attributables); 61 void resetScrollPos(); 62 63 void getFlags(const Model::AttributableNodeList& attributables, wxArrayString& labels, wxArrayString& tooltips) const; 64 void getFlagValues(const Model::AttributableNodeList& attributables, int& setFlags, int& mixedFlags) const; 65 int getFlagValue(const Model::AttributableNode* attributable) const; 66 }; 67 } 68 } 69 70 #endif /* defined(TrenchBroom_SmartSpawnflagsEditor) */ 71