فهرست منبع

Added UIIconSelector control to UI library, added UI assets for UIIconSelector to IDE and default themes, made transform gizmo controls use the new UI control, added a tree view to the entity editor, redid some icons in the entity editor to look better on the UIIconSelector control

Ivan Safrin 12 سال پیش
والد
کامیت
30bcbf7fd2
59فایلهای تغییر یافته به همراه658 افزوده شده و 75 حذف شده
  1. 3 3
      Assets/Icons/icons.ai
  2. BIN
      Assets/UIThemes.pak
  3. BIN
      Assets/UIThemes/dark/iconSelectorBg.png
  4. BIN
      Assets/UIThemes/dark/iconSelectorSelection.png
  5. 14 0
      Assets/UIThemes/dark/theme.xml
  6. BIN
      Assets/UIThemes/dark_retina/iconSelectorBg.png
  7. BIN
      Assets/UIThemes/dark_retina/iconSelectorSelection.png
  8. 14 0
      Assets/UIThemes/dark_retina/theme.xml
  9. BIN
      Assets/UIThemes/default/iconSelectorBg.png
  10. BIN
      Assets/UIThemes/default/iconSelectorSelection.png
  11. 14 0
      Assets/UIThemes/default/theme.xml
  12. BIN
      Assets/UIThemes/default_retina/iconSelectorBg.png
  13. BIN
      Assets/UIThemes/default_retina/iconSelectorSelection.png
  14. 14 0
      Assets/UIThemes/default_retina/theme.xml
  15. BIN
      Assets/default.pak
  16. 3 3
      IDE/Assets/ide_icons.ai
  17. 3 3
      IDE/Assets/ui_theme_dark.ai
  18. 3 3
      IDE/Assets/ui_theme_light.ai
  19. 6 0
      IDE/Build/Mac OS X/Polycode.xcodeproj/project.pbxproj
  20. 1 0
      IDE/Contents/Include/EntityEditorPropertyView.h
  21. 56 0
      IDE/Contents/Include/EntityEditorTreeView.h
  22. 18 0
      IDE/Contents/Include/PolycodeEntityEditor.h
  23. 2 9
      IDE/Contents/Include/TransformGizmo.h
  24. BIN
      IDE/Contents/Resources/Images/entityEditor/icon_tree.png
  25. BIN
      IDE/Contents/Resources/Images/entityEditor/individual_centers.png
  26. BIN
      IDE/Contents/Resources/Images/entityEditor/median_center.png
  27. BIN
      IDE/Contents/Resources/Images/entityEditor/move_gizmo.png
  28. BIN
      IDE/Contents/Resources/Images/entityEditor/properties_icon.png
  29. BIN
      IDE/Contents/Resources/Images/entityEditor/rotate_gizmo.png
  30. BIN
      IDE/Contents/Resources/Images/entityEditor/scale_gizmo.png
  31. BIN
      IDE/Contents/Resources/Images/entityEditor/settings_icon.png
  32. BIN
      IDE/Contents/Resources/ImagesRetina/entityEditor/icon_tree.png
  33. BIN
      IDE/Contents/Resources/ImagesRetina/entityEditor/individual_centers.png
  34. BIN
      IDE/Contents/Resources/ImagesRetina/entityEditor/median_center.png
  35. BIN
      IDE/Contents/Resources/ImagesRetina/entityEditor/move_gizmo.png
  36. BIN
      IDE/Contents/Resources/ImagesRetina/entityEditor/properties_icon.png
  37. BIN
      IDE/Contents/Resources/ImagesRetina/entityEditor/rotate_gizmo.png
  38. BIN
      IDE/Contents/Resources/ImagesRetina/entityEditor/scale_gizmo.png
  39. BIN
      IDE/Contents/Resources/ImagesRetina/entityEditor/settings_icon.png
  40. BIN
      IDE/Contents/Resources/UIThemes/dark/iconSelectorBg.png
  41. BIN
      IDE/Contents/Resources/UIThemes/dark/iconSelectorSelection.png
  42. 14 0
      IDE/Contents/Resources/UIThemes/dark/theme.xml
  43. BIN
      IDE/Contents/Resources/UIThemes/dark_retina/iconSelectorBg.png
  44. BIN
      IDE/Contents/Resources/UIThemes/dark_retina/iconSelectorSelection.png
  45. 14 0
      IDE/Contents/Resources/UIThemes/dark_retina/theme.xml
  46. BIN
      IDE/Contents/Resources/UIThemes/default/iconSelectorBg.png
  47. BIN
      IDE/Contents/Resources/UIThemes/default/iconSelectorSelection.png
  48. 14 0
      IDE/Contents/Resources/UIThemes/default/theme.xml
  49. BIN
      IDE/Contents/Resources/UIThemes/default_retina/iconSelectorBg.png
  50. BIN
      IDE/Contents/Resources/UIThemes/default_retina/iconSelectorSelection.png
  51. 14 0
      IDE/Contents/Resources/UIThemes/default_retina/theme.xml
  52. 1 1
      IDE/Contents/Source/EntityEditorPropertyView.cpp
  53. 172 0
      IDE/Contents/Source/EntityEditorTreeView.cpp
  54. 66 5
      IDE/Contents/Source/PolycodeEntityEditor.cpp
  55. 32 48
      IDE/Contents/Source/TransformGizmo.cpp
  56. 2 0
      Modules/Contents/UI/CMakeLists.txt
  57. 61 0
      Modules/Contents/UI/Include/PolyUIIconSelector.h
  58. 1 0
      Modules/Contents/UI/Include/PolycodeUI.h
  59. 116 0
      Modules/Contents/UI/Source/PolyUIIconSelector.cpp

تفاوت فایلی نمایش داده نمی شود زیرا این فایل بسیار بزرگ است
+ 3 - 3
Assets/Icons/icons.ai


BIN
Assets/UIThemes.pak


BIN
Assets/UIThemes/dark/iconSelectorBg.png


BIN
Assets/UIThemes/dark/iconSelectorSelection.png


+ 14 - 0
Assets/UIThemes/dark/theme.xml

@@ -143,6 +143,20 @@
 	<uiMenuSelectorBgL>0</uiMenuSelectorBgL>
 	<uiMenuSelectorPadding>3</uiMenuSelectorPadding>
 
+	<uiIconSelectorBg>UIThemes/dark/iconSelectorBg.png</uiIconSelectorBg>
+	<uiIconSelectorBgT>7</uiIconSelectorBgT>
+	<uiIconSelectorBgR>7</uiIconSelectorBgR>
+	<uiIconSelectorBgB>7</uiIconSelectorBgB>
+	<uiIconSelectorBgL>7</uiIconSelectorBgL>
+	<uiIconSelectorPaddingX>7</uiIconSelectorPaddingX>	
+	<uiIconSelectorPaddingY>0</uiIconSelectorPaddingY>
+	<uiIconSelectorBox>UIThemes/dark/iconSelectorSelection.png</uiIconSelectorBox>
+	<uiIconSelectorDefaultSize>24</uiIconSelectorDefaultSize>
+	<uiIconSelectorBoxT>0</uiIconSelectorBoxT>
+	<uiIconSelectorBoxR>0</uiIconSelectorBoxR>
+	<uiIconSelectorBoxB>0</uiIconSelectorBoxB>
+	<uiIconSelectorBoxL>0</uiIconSelectorBoxL>	
+
 	<uiColorBoxFrameImage>UIThemes/dark/colorboxFrame.png</uiColorBoxFrameImage>
 	<uiColorBoxFrameImageT>10</uiColorBoxFrameImageT>
 	<uiColorBoxFrameImageR>10</uiColorBoxFrameImageR>

BIN
Assets/UIThemes/dark_retina/iconSelectorBg.png


BIN
Assets/UIThemes/dark_retina/iconSelectorSelection.png


+ 14 - 0
Assets/UIThemes/dark_retina/theme.xml

@@ -137,6 +137,20 @@
 	<uiMenuBgB>11</uiMenuBgB>
 	<uiMenuBgL>7</uiMenuBgL>			
 	<uiMenuSelectorBgImage>UIThemes/dark_retina/menuSelector.png</uiMenuSelectorBgImage>	
+	<uiIconSelectorBg>UIThemes/dark_retina/iconSelectorBg.png</uiIconSelectorBg>
+	<uiIconSelectorBgT>7</uiIconSelectorBgT>
+	<uiIconSelectorBgR>7</uiIconSelectorBgR>
+	<uiIconSelectorBgB>7</uiIconSelectorBgB>
+	<uiIconSelectorBgL>7</uiIconSelectorBgL>
+	<uiIconSelectorPaddingX>7</uiIconSelectorPaddingX>	
+	<uiIconSelectorPaddingY>0</uiIconSelectorPaddingY>
+	<uiIconSelectorBox>UIThemes/dark_retina/iconSelectorSelection.png</uiIconSelectorBox>
+	<uiIconSelectorDefaultSize>24</uiIconSelectorDefaultSize>
+	<uiIconSelectorBoxT>0</uiIconSelectorBoxT>
+	<uiIconSelectorBoxR>0</uiIconSelectorBoxR>
+	<uiIconSelectorBoxB>0</uiIconSelectorBoxB>
+	<uiIconSelectorBoxL>0</uiIconSelectorBoxL>	
+
 	<uiMenuSelectorBgT>0</uiMenuSelectorBgT>
 	<uiMenuSelectorBgR>0</uiMenuSelectorBgR>
 	<uiMenuSelectorBgB>0</uiMenuSelectorBgB>

BIN
Assets/UIThemes/default/iconSelectorBg.png


BIN
Assets/UIThemes/default/iconSelectorSelection.png


+ 14 - 0
Assets/UIThemes/default/theme.xml

@@ -143,6 +143,20 @@
 	<uiMenuSelectorBgL>0</uiMenuSelectorBgL>
 	<uiMenuSelectorPadding>3</uiMenuSelectorPadding>
 
+	<uiIconSelectorBg>UIThemes/default/iconSelectorBg.png</uiIconSelectorBg>
+	<uiIconSelectorBgT>7</uiIconSelectorBgT>
+	<uiIconSelectorBgR>7</uiIconSelectorBgR>
+	<uiIconSelectorBgB>7</uiIconSelectorBgB>
+	<uiIconSelectorBgL>7</uiIconSelectorBgL>
+	<uiIconSelectorPaddingX>7</uiIconSelectorPaddingX>	
+	<uiIconSelectorPaddingY>0</uiIconSelectorPaddingY>
+	<uiIconSelectorBox>UIThemes/default/iconSelectorSelection.png</uiIconSelectorBox>
+	<uiIconSelectorDefaultSize>24</uiIconSelectorDefaultSize>
+	<uiIconSelectorBoxT>0</uiIconSelectorBoxT>
+	<uiIconSelectorBoxR>0</uiIconSelectorBoxR>
+	<uiIconSelectorBoxB>0</uiIconSelectorBoxB>
+	<uiIconSelectorBoxL>0</uiIconSelectorBoxL>		
+
 	<uiColorBoxFrameImage>UIThemes/default/colorboxFrame.png</uiColorBoxFrameImage>
 	<uiColorBoxFrameImageT>10</uiColorBoxFrameImageT>
 	<uiColorBoxFrameImageR>10</uiColorBoxFrameImageR>

BIN
Assets/UIThemes/default_retina/iconSelectorBg.png


BIN
Assets/UIThemes/default_retina/iconSelectorSelection.png


+ 14 - 0
Assets/UIThemes/default_retina/theme.xml

@@ -143,6 +143,20 @@
 	<uiMenuSelectorBgL>0</uiMenuSelectorBgL>
 	<uiMenuSelectorPadding>3</uiMenuSelectorPadding>
 
+	<uiIconSelectorBg>UIThemes/default_retina/iconSelectorBg.png</uiIconSelectorBg>
+	<uiIconSelectorBgT>7</uiIconSelectorBgT>
+	<uiIconSelectorBgR>7</uiIconSelectorBgR>
+	<uiIconSelectorBgB>7</uiIconSelectorBgB>
+	<uiIconSelectorBgL>7</uiIconSelectorBgL>
+	<uiIconSelectorPaddingX>7</uiIconSelectorPaddingX>	
+	<uiIconSelectorPaddingY>0</uiIconSelectorPaddingY>
+	<uiIconSelectorBox>UIThemes/default_retina/iconSelectorSelection.png</uiIconSelectorBox>
+	<uiIconSelectorDefaultSize>24</uiIconSelectorDefaultSize>
+	<uiIconSelectorBoxT>0</uiIconSelectorBoxT>
+	<uiIconSelectorBoxR>0</uiIconSelectorBoxR>
+	<uiIconSelectorBoxB>0</uiIconSelectorBoxB>
+	<uiIconSelectorBoxL>0</uiIconSelectorBoxL>
+
 	<uiColorBoxFrameImage>UIThemes/default_retina/colorboxFrame.png</uiColorBoxFrameImage>
 	<uiColorBoxFrameImageT>10</uiColorBoxFrameImageT>
 	<uiColorBoxFrameImageR>10</uiColorBoxFrameImageR>

BIN
Assets/default.pak


تفاوت فایلی نمایش داده نمی شود زیرا این فایل بسیار بزرگ است
+ 3 - 3
IDE/Assets/ide_icons.ai


تفاوت فایلی نمایش داده نمی شود زیرا این فایل بسیار بزرگ است
+ 3 - 3
IDE/Assets/ui_theme_dark.ai


تفاوت فایلی نمایش داده نمی شود زیرا این فایل بسیار بزرگ است
+ 3 - 3
IDE/Assets/ui_theme_light.ai


+ 6 - 0
IDE/Build/Mac OS X/Polycode.xcodeproj/project.pbxproj

@@ -15,6 +15,7 @@
 		6D128ABD174A9940007B0375 /* SettingsWindow.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6D128ABC174A9940007B0375 /* SettingsWindow.cpp */; };
 		6D1CD96B164D9568006CDAB1 /* polycode_project.icns in Resources */ = {isa = PBXBuildFile; fileRef = 6D1CD96A164D9568006CDAB1 /* polycode_project.icns */; };
 		6D2AC99B14B8500400BB63DA /* PolycodeProjectEditor.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6D2AC99A14B8500400BB63DA /* PolycodeProjectEditor.cpp */; };
+		6D30DEF1187E7E3B006086E7 /* EntityEditorTreeView.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6D30DEEF187E7E3B006086E7 /* EntityEditorTreeView.cpp */; };
 		6D34143412B816BC0034FA9B /* IOKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6D34143312B816BC0034FA9B /* IOKit.framework */; };
 		6D3B6C5B14B820A900727F17 /* ToolWindows.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6D3B6C5A14B820A900727F17 /* ToolWindows.cpp */; };
 		6D3DC79D1622043A003ED2C9 /* PolycodeConsole.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6D3DC79C1622043A003ED2C9 /* PolycodeConsole.cpp */; };
@@ -94,6 +95,8 @@
 		6D1CD96A164D9568006CDAB1 /* polycode_project.icns */ = {isa = PBXFileReference; lastKnownFileType = image.icns; name = polycode_project.icns; path = ../../../Assets/Icons/polycode_project.icns; sourceTree = "<group>"; };
 		6D2AC99A14B8500400BB63DA /* PolycodeProjectEditor.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PolycodeProjectEditor.cpp; sourceTree = "<group>"; };
 		6D2AC99D14B8500A00BB63DA /* PolycodeProjectEditor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PolycodeProjectEditor.h; sourceTree = "<group>"; };
+		6D30DEEE187E7DF4006086E7 /* EntityEditorTreeView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EntityEditorTreeView.h; sourceTree = "<group>"; };
+		6D30DEEF187E7E3B006086E7 /* EntityEditorTreeView.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = EntityEditorTreeView.cpp; sourceTree = "<group>"; };
 		6D34143312B816BC0034FA9B /* IOKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = IOKit.framework; path = System/Library/Frameworks/IOKit.framework; sourceTree = SDKROOT; };
 		6D3B6C5A14B820A900727F17 /* ToolWindows.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ToolWindows.cpp; sourceTree = "<group>"; };
 		6D3B6C5C14B820B000727F17 /* ToolWindows.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ToolWindows.h; sourceTree = "<group>"; };
@@ -386,6 +389,7 @@
 				6D7234AF1829E32800BB3D96 /* EntityEditorPropertyView.h */,
 				6DCB60361822EDB1006701AF /* EditorGrid.h */,
 				6DCB60331822EAE5006701AF /* TransformGizmo.h */,
+				6D30DEEE187E7DF4006086E7 /* EntityEditorTreeView.h */,
 			);
 			name = entity_editor;
 			sourceTree = "<group>";
@@ -396,6 +400,7 @@
 				6D7234B01829E33100BB3D96 /* EntityEditorPropertyView.cpp */,
 				6DCB60341822EBDD006701AF /* EditorGrid.cpp */,
 				6DCB60311822EADE006701AF /* TransformGizmo.cpp */,
+				6D30DEEF187E7E3B006086E7 /* EntityEditorTreeView.cpp */,
 			);
 			name = entity_editor;
 			sourceTree = "<group>";
@@ -491,6 +496,7 @@
 				6D80E91E12AB53FB0037A708 /* PolycodeFrame.cpp in Sources */,
 				6D80E91F12AB53FB0037A708 /* PolycodeIDEApp.cpp in Sources */,
 				6D80E92012AB53FB0037A708 /* PolycodeProject.cpp in Sources */,
+				6D30DEF1187E7E3B006086E7 /* EntityEditorTreeView.cpp in Sources */,
 				6D80E92112AB53FB0037A708 /* PolycodeProjectBrowser.cpp in Sources */,
 				6D80E92212AB53FB0037A708 /* PolycodeProjectManager.cpp in Sources */,
 				6D80EB1612AB7C6D0037A708 /* NewProjectWindow.cpp in Sources */,

+ 1 - 0
IDE/Contents/Include/EntityEditorPropertyView.h

@@ -29,6 +29,7 @@
 
 using namespace Polycode;
 
+
 class EntityEditorPropertyView : public UIElement {
     public:
     

+ 56 - 0
IDE/Contents/Include/EntityEditorTreeView.h

@@ -0,0 +1,56 @@
+/*
+ Copyright (C) 2014 by Ivan Safrin
+ 
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+ 
+ The above copyright notice and this permission notice shall be included in
+ all copies or substantial portions of the Software.
+ 
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ THE SOFTWARE.
+ */
+
+#pragma once
+
+#include "Polycode.h"
+#include "PolycodeUI.h"
+#include "PolycodeProps.h"
+#include "OSBasics.h"
+
+using namespace Polycode;
+
+
+class EntityEditorTreeView : public UIElement {
+    public:
+        EntityEditorTreeView();
+        ~EntityEditorTreeView();
+    
+        void refreshTree();
+        void syncNodeToEntity(UITree *node, Entity *entity);
+    
+        void handleEvent(Event *event);
+        void setSelectedEntity(Entity *entity);
+        Entity *getSelectedEntity();
+    
+        void Resize(Number width, Number height);
+        void setRootEntity(Entity *entity);
+    
+    private:
+    
+        Entity *selectedEntity;
+        bool dontSendSelectionEvent;
+    
+        UITreeContainer *treeContainer;
+        UIRect *headerBg;
+        Entity *rootEntity;
+};

+ 18 - 0
IDE/Contents/Include/PolycodeEntityEditor.h

@@ -27,6 +27,7 @@
 #include <Polycode.h>
 #include "PolycodeUI.h"
 #include "EntityEditorPropertyView.h"
+#include "EntityEditorTreeView.h"
 
 #include "TrackballCamera.h"
 
@@ -147,6 +148,20 @@ class EntityEditorMainView : public UIElement {
     
 };
 
+class EntityEditorPropertyContainer : public UIElement {
+    public:
+        EntityEditorPropertyContainer();
+        ~EntityEditorPropertyContainer();
+        void Resize(Number width, Number height);
+    
+        void handleEvent(Event *event);
+    
+        UIElement *currentView;
+        EntityEditorPropertyView *propertyView;
+        EntityEditorTreeView *treeView;
+        UIIconSelector *propIconSelector;
+};
+
 class PolycodeEntityEditor : public PolycodeEditor {
 	public:
 		PolycodeEntityEditor();
@@ -167,8 +182,11 @@ class PolycodeEntityEditor : public PolycodeEditor {
     
 	protected:
 	
+        EntityEditorPropertyContainer *propertyContainer;
+    
 		EntityEditorMainView *mainView;
         EntityEditorPropertyView *propertyView;
+        EntityEditorTreeView *treeView;
     
 		UIHSizer *mainSizer;
         UIVSizer *rightSizer;

+ 2 - 9
IDE/Contents/Include/TransformGizmo.h

@@ -149,16 +149,9 @@ class TransformGizmoMenu : public UIElement {
 		
 	private:
 	
-		UIImageButton *moveModeButton;
-		UIImageButton *scaleModeButton;
-		UIImageButton *rotateModeButton;
-        UIImage *transformModeSelector;
-    
+        UIIconSelector *transformSelector;
         UIComboBox *orientationCombo;
-    
-		UIImageButton *centerModeMedianButton;
-		UIImageButton *centerModeCentersButton;
-        UIImage *centerModeSelector;
+        UIIconSelector *centerSelector;
     
 		TransformGizmo *gizmo;
 };

BIN
IDE/Contents/Resources/Images/entityEditor/icon_tree.png


BIN
IDE/Contents/Resources/Images/entityEditor/individual_centers.png


BIN
IDE/Contents/Resources/Images/entityEditor/median_center.png


BIN
IDE/Contents/Resources/Images/entityEditor/move_gizmo.png


BIN
IDE/Contents/Resources/Images/entityEditor/properties_icon.png


BIN
IDE/Contents/Resources/Images/entityEditor/rotate_gizmo.png


BIN
IDE/Contents/Resources/Images/entityEditor/scale_gizmo.png


BIN
IDE/Contents/Resources/Images/entityEditor/settings_icon.png


BIN
IDE/Contents/Resources/ImagesRetina/entityEditor/icon_tree.png


BIN
IDE/Contents/Resources/ImagesRetina/entityEditor/individual_centers.png


BIN
IDE/Contents/Resources/ImagesRetina/entityEditor/median_center.png


BIN
IDE/Contents/Resources/ImagesRetina/entityEditor/move_gizmo.png


BIN
IDE/Contents/Resources/ImagesRetina/entityEditor/properties_icon.png


BIN
IDE/Contents/Resources/ImagesRetina/entityEditor/rotate_gizmo.png


BIN
IDE/Contents/Resources/ImagesRetina/entityEditor/scale_gizmo.png


BIN
IDE/Contents/Resources/ImagesRetina/entityEditor/settings_icon.png


BIN
IDE/Contents/Resources/UIThemes/dark/iconSelectorBg.png


BIN
IDE/Contents/Resources/UIThemes/dark/iconSelectorSelection.png


+ 14 - 0
IDE/Contents/Resources/UIThemes/dark/theme.xml

@@ -143,6 +143,20 @@
 	<uiMenuSelectorBgL>0</uiMenuSelectorBgL>
 	<uiMenuSelectorPadding>3</uiMenuSelectorPadding>
 
+	<uiIconSelectorBg>iconSelectorBg.png</uiIconSelectorBg>
+	<uiIconSelectorBgT>7</uiIconSelectorBgT>
+	<uiIconSelectorBgR>7</uiIconSelectorBgR>
+	<uiIconSelectorBgB>7</uiIconSelectorBgB>
+	<uiIconSelectorBgL>7</uiIconSelectorBgL>
+	<uiIconSelectorPaddingX>7</uiIconSelectorPaddingX>	
+	<uiIconSelectorPaddingY>0</uiIconSelectorPaddingY>
+	<uiIconSelectorBox>iconSelectorSelection.png</uiIconSelectorBox>
+	<uiIconSelectorDefaultSize>24</uiIconSelectorDefaultSize>
+	<uiIconSelectorBoxT>0</uiIconSelectorBoxT>
+	<uiIconSelectorBoxR>0</uiIconSelectorBoxR>
+	<uiIconSelectorBoxB>0</uiIconSelectorBoxB>
+	<uiIconSelectorBoxL>0</uiIconSelectorBoxL>		
+
 	<uiColorBoxFrameImage>colorboxFrame.png</uiColorBoxFrameImage>
 	<uiColorBoxFrameImageT>10</uiColorBoxFrameImageT>
 	<uiColorBoxFrameImageR>10</uiColorBoxFrameImageR>

BIN
IDE/Contents/Resources/UIThemes/dark_retina/iconSelectorBg.png


BIN
IDE/Contents/Resources/UIThemes/dark_retina/iconSelectorSelection.png


+ 14 - 0
IDE/Contents/Resources/UIThemes/dark_retina/theme.xml

@@ -143,6 +143,20 @@
 	<uiMenuSelectorBgL>0</uiMenuSelectorBgL>
 	<uiMenuSelectorPadding>3</uiMenuSelectorPadding>
 
+	<uiIconSelectorBg>iconSelectorBg.png</uiIconSelectorBg>
+	<uiIconSelectorBgT>7</uiIconSelectorBgT>
+	<uiIconSelectorBgR>7</uiIconSelectorBgR>
+	<uiIconSelectorBgB>7</uiIconSelectorBgB>
+	<uiIconSelectorBgL>7</uiIconSelectorBgL>
+	<uiIconSelectorPaddingX>7</uiIconSelectorPaddingX>	
+	<uiIconSelectorPaddingY>0</uiIconSelectorPaddingY>
+	<uiIconSelectorBox>iconSelectorSelection.png</uiIconSelectorBox>
+	<uiIconSelectorDefaultSize>24</uiIconSelectorDefaultSize>
+	<uiIconSelectorBoxT>0</uiIconSelectorBoxT>
+	<uiIconSelectorBoxR>0</uiIconSelectorBoxR>
+	<uiIconSelectorBoxB>0</uiIconSelectorBoxB>
+	<uiIconSelectorBoxL>0</uiIconSelectorBoxL>
+
 	<uiColorBoxFrameImage>colorboxFrame.png</uiColorBoxFrameImage>
 	<uiColorBoxFrameImageT>10</uiColorBoxFrameImageT>
 	<uiColorBoxFrameImageR>10</uiColorBoxFrameImageR>

BIN
IDE/Contents/Resources/UIThemes/default/iconSelectorBg.png


BIN
IDE/Contents/Resources/UIThemes/default/iconSelectorSelection.png


+ 14 - 0
IDE/Contents/Resources/UIThemes/default/theme.xml

@@ -143,6 +143,20 @@
 	<uiMenuSelectorBgL>0</uiMenuSelectorBgL>
 	<uiMenuSelectorPadding>3</uiMenuSelectorPadding>
 
+	<uiIconSelectorBg>iconSelectorBg.png</uiIconSelectorBg>
+	<uiIconSelectorBgT>7</uiIconSelectorBgT>
+	<uiIconSelectorBgR>7</uiIconSelectorBgR>
+	<uiIconSelectorBgB>7</uiIconSelectorBgB>
+	<uiIconSelectorBgL>7</uiIconSelectorBgL>
+	<uiIconSelectorPaddingX>7</uiIconSelectorPaddingX>	
+	<uiIconSelectorPaddingY>0</uiIconSelectorPaddingY>
+	<uiIconSelectorBox>iconSelectorSelection.png</uiIconSelectorBox>
+	<uiIconSelectorDefaultSize>24</uiIconSelectorDefaultSize>
+	<uiIconSelectorBoxT>0</uiIconSelectorBoxT>
+	<uiIconSelectorBoxR>0</uiIconSelectorBoxR>
+	<uiIconSelectorBoxB>0</uiIconSelectorBoxB>
+	<uiIconSelectorBoxL>0</uiIconSelectorBoxL>		
+
 	<uiColorBoxFrameImage>colorboxFrame.png</uiColorBoxFrameImage>
 	<uiColorBoxFrameImageT>10</uiColorBoxFrameImageT>
 	<uiColorBoxFrameImageR>10</uiColorBoxFrameImageR>

BIN
IDE/Contents/Resources/UIThemes/default_retina/iconSelectorBg.png


BIN
IDE/Contents/Resources/UIThemes/default_retina/iconSelectorSelection.png


+ 14 - 0
IDE/Contents/Resources/UIThemes/default_retina/theme.xml

@@ -143,6 +143,20 @@
 	<uiMenuSelectorBgL>0</uiMenuSelectorBgL>
 	<uiMenuSelectorPadding>3</uiMenuSelectorPadding>
 
+	<uiIconSelectorBg>iconSelectorBg.png</uiIconSelectorBg>
+	<uiIconSelectorBgT>7</uiIconSelectorBgT>
+	<uiIconSelectorBgR>7</uiIconSelectorBgR>
+	<uiIconSelectorBgB>7</uiIconSelectorBgB>
+	<uiIconSelectorBgL>7</uiIconSelectorBgL>
+	<uiIconSelectorPaddingX>7</uiIconSelectorPaddingX>	
+	<uiIconSelectorPaddingY>0</uiIconSelectorPaddingY>
+	<uiIconSelectorBox>iconSelectorSelection.png</uiIconSelectorBox>
+	<uiIconSelectorDefaultSize>24</uiIconSelectorDefaultSize>
+	<uiIconSelectorBoxT>0</uiIconSelectorBoxT>
+	<uiIconSelectorBoxR>0</uiIconSelectorBoxR>
+	<uiIconSelectorBoxB>0</uiIconSelectorBoxB>
+	<uiIconSelectorBoxL>0</uiIconSelectorBoxL>	
+
 	<uiColorBoxFrameImage>colorboxFrame.png</uiColorBoxFrameImage>
 	<uiColorBoxFrameImageT>10</uiColorBoxFrameImageT>
 	<uiColorBoxFrameImageR>10</uiColorBoxFrameImageR>

+ 1 - 1
IDE/Contents/Source/EntityEditorPropertyView.cpp

@@ -78,7 +78,7 @@ EntityEditorPropertyView::EntityEditorPropertyView() : UIElement() {
     entitySheet = new EntitySheet();
     entityProps->addPropSheet(entitySheet);
     entitySheet->addEventListener(this, PropEvent::EVENT_PROP_CHANGE);
-    
+        
 }
 
 void EntityEditorPropertyView::Resize(Number width, Number height) {

+ 172 - 0
IDE/Contents/Source/EntityEditorTreeView.cpp

@@ -0,0 +1,172 @@
+/*
+ Copyright (C) 2014 by Ivan Safrin
+ 
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+ 
+ The above copyright notice and this permission notice shall be included in
+ all copies or substantial portions of the Software.
+ 
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ THE SOFTWARE.
+ */
+
+#include "EntityEditorTreeView.h"
+
+EntityEditorTreeView::EntityEditorTreeView() : UIElement() {
+
+    treeContainer = new UITreeContainer("folder.png", "Root", 10, 10);
+    addChild(treeContainer);
+    treeContainer->getRootNode()->addEventListener(this, UITreeEvent::SELECTED_EVENT);
+    treeContainer->setPosition(0, 30);
+    treeContainer->getRootNode()->toggleCollapsed();
+    
+	headerBg = new UIRect(10,10);
+	addChild(headerBg);
+	headerBg->setAnchorPoint(-1.0, -1.0, 0.0);
+	headerBg->color.setColorHexFromString(CoreServices::getInstance()->getConfig()->getStringValue("Polycode", "uiHeaderBgColor"));
+	
+	UILabel *label = new UILabel("TREE VIEW", 18, "section", Label::ANTIALIAS_FULL);
+	label->color.setColorHexFromString(CoreServices::getInstance()->getConfig()->getStringValue("Polycode", "uiHeaderFontColor"));
+	
+	addChild(label);
+	label->setPosition(10, 3);
+    
+    selectedEntity = NULL;
+    dontSendSelectionEvent = false;
+}
+
+void EntityEditorTreeView::setRootEntity(Entity *entity) {
+    rootEntity = entity;
+    treeContainer->getRootNode()->setUserData((void*) entity);
+    refreshTree();
+}
+
+void EntityEditorTreeView::syncNodeToEntity(UITree *node, Entity *entity) {
+    // remove non existing and set proper ids,
+	
+	std::vector<UITree*> nodesToRemove;
+    
+	for(int i=0; i < node->getNumTreeChildren(); i++) {
+		UITree *child = node->getTreeChild(i);
+		
+		bool hasChild = false;
+		for(int j=0; j < entity->getNumChildren(); j++) {
+			if(!entity->getChildAtIndex(j)->editorOnly) {
+                if(((Entity*)child->getUserData()) == entity->getChildAtIndex(j)) {
+                    hasChild = true;
+                    
+                    String entityName = entity->getChildAtIndex(j)->id;
+                    if(entityName == "") {
+                        entityName = "<unnamed entity>";
+                    }
+                    
+                    if(child->getLabelText() != entityName) {
+                        child->setLabelText(entityName);
+                    }
+                    
+                    if(entity->getChildAtIndex(j) == selectedEntity) {
+                        dontSendSelectionEvent = true;
+                        child->setSelected();
+                    }
+                    
+                }
+			}
+		}
+        
+		if(!hasChild) {
+			nodesToRemove.push_back(child);
+		}
+	}
+	
+	for(int i=0; i < nodesToRemove.size(); i++) {
+		node->removeTreeChild(nodesToRemove[i]);
+	}
+	
+	std::vector<Entity*> entitiesToAdd;
+	
+	for(int j=0; j < entity->getNumChildren(); j++) {
+		if(!entity->getChildAtIndex(j)->editorOnly) {
+            bool hasEntity = false;
+            for(int i=0; i < node->getNumTreeChildren(); i++) {
+                UITree *child = node->getTreeChild(i);
+                if(((Entity*)child->getUserData()) == entity->getChildAtIndex(j)) {
+                    hasEntity = true;
+                }
+            }
+            
+            if(!hasEntity) {
+                entitiesToAdd.push_back(entity->getChildAtIndex(j));
+            }
+		}
+	}
+	
+	for(int i=0; i < entitiesToAdd.size(); i++) {
+        
+		String entityName = entitiesToAdd[i]->id;
+        if(entityName == "") {
+            entityName = "<unnamed entity>";
+        }
+        
+		UITree *newNode = node->addTreeChild("file.png", entityName);
+		newNode->setUserData((void*)entitiesToAdd[i]);
+		
+		if(entitiesToAdd[i] == selectedEntity) {
+			dontSendSelectionEvent = true;
+			newNode->setSelected();
+		}
+	}
+	
+	for(int i=0; i < node->getNumTreeChildren(); i++) {
+		UITree *child = node->getTreeChild(i);
+		syncNodeToEntity(child, ((Entity*)child->getUserData()));
+	}
+}
+
+Entity *EntityEditorTreeView::getSelectedEntity() {
+    return selectedEntity;
+}
+
+void EntityEditorTreeView::setSelectedEntity(Entity *entity) {
+    selectedEntity = entity;
+    refreshTree();
+}
+
+void EntityEditorTreeView::handleEvent(Event *event) {
+	
+	if(event->getDispatcher() == treeContainer->getRootNode()) {
+		if(event->getEventCode() == UITreeEvent::SELECTED_EVENT){
+			if(!dontSendSelectionEvent) {
+                if(treeContainer->getRootNode()->getSelectedNode() != treeContainer->getRootNode()) {
+                    selectedEntity = (Entity*)treeContainer->getRootNode()->getSelectedNode()->getUserData();
+                    dispatchEvent(new Event(), Event::CHANGE_EVENT);
+                }
+			}
+			dontSendSelectionEvent = false;
+		}
+	}
+	ScreenEntity::handleEvent(event);
+}
+
+
+void EntityEditorTreeView::refreshTree() {
+    syncNodeToEntity(treeContainer->getRootNode(), rootEntity);
+}
+
+EntityEditorTreeView::~EntityEditorTreeView() {
+    
+}
+
+void EntityEditorTreeView::Resize(Number width, Number height) {
+    treeContainer->Resize(width, height-30);
+    headerBg->Resize(width, 30);
+}

+ 66 - 5
IDE/Contents/Source/PolycodeEntityEditor.cpp

@@ -754,6 +754,58 @@ void EntityEditorMainView::Resize(Number width, Number height) {
     Update();
 }
 
+EntityEditorPropertyContainer::EntityEditorPropertyContainer() : UIElement() {
+    
+    propIconSelector = new UIIconSelector();
+    addChild(propIconSelector);
+    propIconSelector->addIcon("entityEditor/properties_icon.png");
+    propIconSelector->addIcon("entityEditor/icon_tree.png");
+    propIconSelector->addIcon("entityEditor/settings_icon.png");
+    propIconSelector->setPosition(10.0, 3.0);
+    propIconSelector->addEventListener(this, UIEvent::SELECT_EVENT);
+    
+    propertyView = new EntityEditorPropertyView();
+    addChild(propertyView);
+    propertyView->setPosition(0.0, 30.0);
+    currentView = propertyView;
+    
+    treeView = new EntityEditorTreeView();
+    addChild(treeView);
+    treeView->setPosition(0.0, 30.0);
+    treeView->visible = false;
+}
+
+void EntityEditorPropertyContainer::handleEvent(Event *event) {
+    if(event->getDispatcher() == propIconSelector) {
+        currentView->visible = false;
+        currentView->enabled = false;
+        switch(propIconSelector->getSelectedIndex()) {
+            case 0:
+                currentView = propertyView;
+            break;
+            case 1:
+                currentView = treeView;
+                treeView->refreshTree();
+            break;
+            case 2:
+                currentView = treeView;
+            break;
+        }
+        currentView->visible = true;
+        currentView->enabled = true;
+    }
+}
+
+EntityEditorPropertyContainer::~EntityEditorPropertyContainer() {
+    
+}
+
+void EntityEditorPropertyContainer::Resize(Number width, Number height) {
+    propertyView->Resize(width, height-30);
+    treeView->Resize(width, height-30);
+}
+
+
 PolycodeEntityEditor::PolycodeEntityEditor() : PolycodeEditor(true){
 	mainSizer = new UIHSizer(300, 300, 300, false);
 	addChild(mainSizer);
@@ -764,24 +816,31 @@ PolycodeEntityEditor::PolycodeEntityEditor() : PolycodeEditor(true){
     
     mainSizer->setMinimumSize(200);
     
-//    rightSizer = new UIVSizer(10, 10, 150, true);
-  //  mainSizer->addRightChild(rightSizer);
+    propertyContainer = new EntityEditorPropertyContainer();
+    propertyView = propertyContainer->propertyView;
+    treeView = propertyContainer->treeView;
     
-    propertyView = new EntityEditorPropertyView();
-//    rightSizer->addBottomChild(propertyView);
-    mainSizer->addRightChild(propertyView);
+    treeView->addEventListener(this, Event::CHANGE_EVENT);
+    
+    mainSizer->addRightChild(propertyContainer);
 }
 
 void PolycodeEntityEditor::handleEvent(Event *event) {
     
+    if(event->getDispatcher() == treeView) {
+        mainView->selectEntity(treeView->getSelectedEntity());
+    }
+    
     if(event->getDispatcher() == mainView) {
         switch(event->getEventCode()) {
             case Event::CHANGE_EVENT:
                 propertyView->setEntity(mainView->getSelectedEntity());
+                treeView->setSelectedEntity(mainView->getSelectedEntity());
             break;
         }
     }
     
+    
     PolycodeEditor::handleEvent(event);
 }
 
@@ -795,6 +854,8 @@ bool PolycodeEntityEditor::openFile(OSFileEntry filePath) {
     mainView->setObjectRoot(loadedInstance);
     mainView->setEditorPropsRecursive(loadedInstance);
     
+    treeView->setRootEntity(loadedInstance);
+    
 	return true;
 }
 

+ 32 - 48
IDE/Contents/Source/TransformGizmo.cpp

@@ -28,25 +28,14 @@ TransformGizmoMenu::TransformGizmoMenu(TransformGizmo *gizmo) : UIElement() {
 	processInputEvents = true;
     
 	this->gizmo = gizmo;
-		
-	moveModeButton = new UIImageButton("entityEditor/move_gizmo.png", 1.0, 24, 24);
-	addChild(moveModeButton);
-	moveModeButton->setPosition(4, 2);
-	moveModeButton->addEventListener(this, UIEvent::CLICK_EVENT);
-	
-	scaleModeButton = new UIImageButton("entityEditor/scale_gizmo.png", 1.0, 24, 24);
-	addChild(scaleModeButton);
-	scaleModeButton->setPosition(30, 2);
-	scaleModeButton->addEventListener(this, UIEvent::CLICK_EVENT);
-	
-	rotateModeButton = new UIImageButton("entityEditor/rotate_gizmo.png", 1.0, 24, 24);
-	addChild(rotateModeButton);
-	rotateModeButton->setPosition(56, 2);
-	rotateModeButton->addEventListener(this, UIEvent::CLICK_EVENT);
     
-    transformModeSelector = new UIImage("entityEditor/button_selector.png", 24, 24);
-    addChild(transformModeSelector);
-    transformModeSelector->setPosition(moveModeButton->getPosition());
+    transformSelector = new UIIconSelector();
+    addChild(transformSelector);
+    transformSelector->addIcon("entityEditor/move_gizmo.png");
+    transformSelector->addIcon("entityEditor/scale_gizmo.png");
+    transformSelector->addIcon("entityEditor/rotate_gizmo.png");
+    transformSelector->setPosition(4, 3.0);
+    transformSelector->addEventListener(this, UIEvent::SELECT_EVENT);
     
     orientationCombo = new UIComboBox(globalMenu, 100);
     orientationCombo->addComboItem("Global");
@@ -54,43 +43,38 @@ TransformGizmoMenu::TransformGizmoMenu(TransformGizmo *gizmo) : UIElement() {
     orientationCombo->setSelectedIndex(0);
     addChild(orientationCombo);
     orientationCombo->setPosition(100, 2);
+    orientationCombo->addEventListener(this, UIEvent::CHANGE_EVENT);
     
-	centerModeMedianButton = new UIImageButton("entityEditor/median_center.png", 1.0, 24, 24);
-	addChild(centerModeMedianButton);
-	centerModeMedianButton->setPosition(210, 2);
-	centerModeMedianButton->addEventListener(this, UIEvent::CLICK_EVENT);
-
-    centerModeCentersButton = new UIImageButton("entityEditor/individual_centers.png", 1.0, 24, 24);
-	addChild(centerModeCentersButton);
-	centerModeCentersButton->setPosition(238, 2);
-	centerModeCentersButton->addEventListener(this, UIEvent::CLICK_EVENT);
-
-    centerModeSelector = new UIImage("entityEditor/button_selector.png", 24, 24);
-    addChild(centerModeSelector);
-    centerModeSelector->setPosition(centerModeMedianButton->getPosition());
-
+    centerSelector = new UIIconSelector();
+    addChild(centerSelector);
+    centerSelector->addIcon("entityEditor/median_center.png");
+    centerSelector->addIcon("entityEditor/individual_centers.png");
+    centerSelector->setPosition(210, 3.0);
+    centerSelector->addEventListener(this, UIEvent::SELECT_EVENT);
     
-    orientationCombo->addEventListener(this, UIEvent::CHANGE_EVENT);
 }
 
 void TransformGizmoMenu::handleEvent(Event *event) {
-	if(event->getDispatcher() == moveModeButton) {
-		gizmo->setTransformMode(TransformGizmo::TRANSFORM_MOVE);
-        transformModeSelector->setPosition(moveModeButton->getPosition());
-	} else if(event->getDispatcher() == scaleModeButton) {
-		gizmo->setTransformMode(TransformGizmo::TRANSFORM_SCALE);
-        transformModeSelector->setPosition(scaleModeButton->getPosition());
-	} else if(event->getDispatcher() == rotateModeButton) {
-		gizmo->setTransformMode(TransformGizmo::TRANSFORM_ROTATE);
-        transformModeSelector->setPosition(rotateModeButton->getPosition());
+	if(event->getDispatcher() == transformSelector) {
+        switch(transformSelector->getSelectedIndex()) {
+            case 0:
+                gizmo->setTransformMode(TransformGizmo::TRANSFORM_MOVE);
+            break;
+            case 1:
+                gizmo->setTransformMode(TransformGizmo::TRANSFORM_SCALE);
+            break;
+            case 2:
+                gizmo->setTransformMode(TransformGizmo::TRANSFORM_ROTATE);
+            break;
+        }
 	} else if(event->getDispatcher() == orientationCombo) {
         gizmo->setTransformOrientation(orientationCombo->getSelectedIndex());
-    } else if(event->getDispatcher() == centerModeMedianButton) {
-        centerModeSelector->setPosition(centerModeMedianButton->getPosition());
-        gizmo->setCenterMode(TransformGizmo::CENTER_MODE_MEDIAN);
-    } else if(event->getDispatcher() == centerModeCentersButton) {
-        centerModeSelector->setPosition(centerModeCentersButton->getPosition());
-        gizmo->setCenterMode(TransformGizmo::CENTER_MODE_INDIVIDUAL);
+    } else if(event->getDispatcher() == centerSelector) {
+        if(centerSelector->getSelectedIndex() == 0) {
+            gizmo->setCenterMode(TransformGizmo::CENTER_MODE_MEDIAN);
+        } else {
+            gizmo->setCenterMode(TransformGizmo::CENTER_MODE_INDIVIDUAL);
+        }
     }
 }
 

+ 2 - 0
Modules/Contents/UI/CMakeLists.txt

@@ -23,6 +23,7 @@ SET(polycodeUI_SRCS
     Source/PolyUIWindow.cpp
     Source/PolyUIFileDialog.cpp
     Source/PolyUIMenuBar.cpp
+    Source/PolyUIIconSelector.cpp
 )
 
 SET(polycodeUI_HDRS
@@ -49,6 +50,7 @@ SET(polycodeUI_HDRS
     Include/PolyUIWindow.h
     Include/PolyUIFileDialog.h
     Include/PolyUIMenuBar.h
+    Include/PolyUIIconSelector.h
 )
 
 INCLUDE_DIRECTORIES(

+ 61 - 0
Modules/Contents/UI/Include/PolyUIIconSelector.h

@@ -0,0 +1,61 @@
+/*
+ Copyright (C) 2014 by Ivan Safrin
+ 
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+ 
+ The above copyright notice and this permission notice shall be included in
+ all copies or substantial portions of the Software.
+ 
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ THE SOFTWARE.
+ */
+
+#pragma once
+
+#include "PolyGlobals.h"
+#include "PolyEntity.h"
+#include "PolyUIEvent.h"
+#include "PolyUIBox.h"
+#include "PolyUIImageButton.h"
+#include "PolyUIElement.h"
+#include "PolyInputEvent.h"
+
+using namespace Polycode;
+
+
+class UIIconSelector : public UIElement {
+    public:
+        UIIconSelector(Number height = 0.0);
+        ~UIIconSelector();
+    
+        void handleEvent(Event *event);
+        void addIcon(String fileName);
+    
+        void selectIndex(unsigned int index);
+        unsigned int getSelectedIndex();
+    
+        void resetSize();
+    
+    protected:
+    
+        std::vector<UIImageButton*> icons;
+    
+        UIBox *bgRect;
+        UIBox *selectorRect;
+        int selectedIndex;
+    
+        Number selectorSize;
+        Number paddingX;
+        Number paddingY;
+};
+

+ 1 - 0
Modules/Contents/UI/Include/PolycodeUI.h

@@ -42,3 +42,4 @@
 #include "PolyUIMenu.h"
 #include "PolyUIFileDialog.h"
 #include "PolyUIMenuBar.h"
+#include "PolyUIIconSelector.h"

+ 116 - 0
Modules/Contents/UI/Source/PolyUIIconSelector.cpp

@@ -0,0 +1,116 @@
+/*
+ Copyright (C) 2014 by Ivan Safrin
+ 
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+ 
+ The above copyright notice and this permission notice shall be included in
+ all copies or substantial portions of the Software.
+ 
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ THE SOFTWARE.
+ */
+
+#include "PolyUIIconSelector.h"
+#include "PolyConfig.h"
+#include "PolyInputEvent.h"
+#include "PolyCoreServices.h"
+
+
+UIIconSelector::UIIconSelector(Number height) : UIElement() {
+    
+	Config *conf = CoreServices::getInstance()->getConfig();
+	
+	Number st = conf->getNumericValue("Polycode", "uiIconSelectorBgT");
+	Number sr = conf->getNumericValue("Polycode", "uiIconSelectorBgR");
+	Number sb = conf->getNumericValue("Polycode", "uiIconSelectorBgB");
+	Number sl = conf->getNumericValue("Polycode", "uiIconSelectorBgL");
+
+	paddingX = conf->getNumericValue("Polycode", "uiIconSelectorPaddingX");
+	paddingY = conf->getNumericValue("Polycode", "uiIconSelectorPaddingY");
+    
+	bgRect = new UIBox(conf->getStringValue("Polycode", "uiIconSelectorBg"),
+						   st,sr,sb,sl,
+						   10, 10);
+    addChild(bgRect);
+    
+    selectorSize = height;
+    if(selectorSize == 0.0) {
+        selectorSize = conf->getNumericValue("Polycode", "uiIconSelectorDefaultSize");
+    }
+    
+    st = conf->getNumericValue("Polycode", "uiIconSelectorBoxT");
+    sr = conf->getNumericValue("Polycode", "uiIconSelectorBoxR");
+    sb = conf->getNumericValue("Polycode", "uiIconSelectorBoxB");
+    sl = conf->getNumericValue("Polycode", "uiIconSelectorBoxL");
+    
+    selectorRect = new UIBox(conf->getStringValue("Polycode", "uiIconSelectorBox"),
+                             st,sr,sb,sl,
+                             selectorSize, selectorSize);
+    addChild(selectorRect);
+    selectorRect->visible = false;
+    resetSize();
+    
+}
+
+void UIIconSelector::addIcon(String fileName) {
+    UIImageButton *newIcon = new UIImageButton(fileName, 1.0, selectorSize, selectorSize);
+    icons.push_back(newIcon);
+    addChild(newIcon);
+    newIcon->addEventListener(this, UIEvent::CLICK_EVENT);
+    resetSize();
+    if(icons.size() == 1) {
+        selectIndex(0);
+    }
+}
+
+void UIIconSelector::selectIndex(unsigned int index) {
+    selectedIndex = index;
+    selectorRect->visible = true;
+    selectorRect->setPosition(paddingX + (index * selectorSize), paddingY);
+    dispatchEvent(new UIEvent(), UIEvent::SELECT_EVENT);
+}
+
+unsigned int UIIconSelector::getSelectedIndex() {
+    return selectedIndex;
+}
+
+void UIIconSelector::handleEvent(Event *event){
+    for(int i=0; i < icons.size(); i++) {
+        if(icons[i] == event->getDispatcher()) {
+            selectIndex(i);
+            return;
+        }
+    }
+}
+
+void UIIconSelector::resetSize() {
+    for(int i=0; i < icons.size(); i++) {
+        icons[i]->setPosition(paddingX+(selectorSize*i), paddingY);
+    }
+    
+    Number innerSize = icons.size() * selectorSize;
+    setWidth((paddingX*2)+innerSize);
+    setHeight((paddingY*2)+selectorSize);
+    
+    bgRect->resizeBox(bBox.x, bBox.y);
+}
+
+UIIconSelector::~UIIconSelector() {
+	if(!ownsChildren) {
+        for(int i=0; i < icons.size(); i++) {
+            delete icons[i];
+        }
+        delete bgRect;
+        delete selectorRect;
+    }
+}

برخی فایل ها در این مقایسه diff نمایش داده نمی شوند زیرا تعداد فایل ها بسیار زیاد است