samples/gui: Added 'toolBars' sample showcasing extras' ToolBar together with the...
authorJerome St-Louis <jerome@ecere.com>
Sat, 4 Feb 2012 17:38:06 +0000 (00:38 +0700)
committerJerome St-Louis <jerome@ecere.com>
Sat, 4 Feb 2012 17:38:06 +0000 (00:38 +0700)
samples/guiAndGfx/toolBars/toolBarDemo.ec [new file with mode: 0644]
samples/guiAndGfx/toolBars/toolBars.epj [new file with mode: 0644]

diff --git a/samples/guiAndGfx/toolBars/toolBarDemo.ec b/samples/guiAndGfx/toolBars/toolBarDemo.ec
new file mode 100644 (file)
index 0000000..96bb733
--- /dev/null
@@ -0,0 +1,80 @@
+import "IconBag"
+import "ToolBar"
+
+enum ToolId { none, newWindow, goBack, goForward, goHome };
+
+class ToolBarDemo : Window
+{
+   background = activeBorder;
+   borderStyle = sizable;
+   hasMaximize = true;
+   hasMinimize = true;
+   hasClose = true;
+   size = { 840, 480 };
+   minClientSize = { 600, 300 };
+   nativeDecorations = true;
+
+   IconBag<ToolId> iconBag
+   {
+      window = this;
+      alphaBlend = true;
+      iconNames =
+      [
+         "<:ecere>emblems/unreadable.png",
+         "<:ecere>actions/windowNew.png",      /* newWindow */
+         "<:ecere>actions/goPrevious.png",     /* goBack */
+         "<:ecere>actions/goNext.png",         /* goForward */
+         "<:ecere>actions/goHome.png"          /* goHome */
+      ];
+   };
+
+   Stacker stack
+   {
+      this;
+      gap = 0;
+      direction = vertical;
+      background = activeBorder;
+      anchor = { left = 0, top = 0, right = 0, bottom = 0 };
+   };
+
+   ToolBar toolBar
+   {
+      stack, this;
+      iconBag = iconBag;
+      size = { h = 32 };
+
+      void NotifyToolClick(ToolButton button)
+      {
+         ToolId id = (ToolId)button.id;
+         switch(id)
+         {
+            case newWindow: break;
+            case goBack:    break;
+            case goForward: break;
+            case goHome:    break;
+         }
+      }
+   };
+
+   Window s1 { toolBar, size = { w = 8 } };
+   ToolButton goBack { toolBar, this, id = ToolId::goBack, toolTip = "Go Back" };
+   Window s2 { toolBar, size = { w = 2 } };
+   ToolButton goForward { toolBar, this, id = ToolId::goForward, toolTip = "Go Forward" };
+   Window s3 { toolBar, size = { w = 12 } };
+   ToolButton newWindow { toolBar, this, id = ToolId::newWindow, toolTip = "New Window" };
+   Window s4 { toolBar, size = { w = 2 } };
+   ToolButton goHome { toolBar, this, id = ToolId::goHome, toolTip = "Go Home" };
+
+   bool OnLoadGraphics()
+   {
+      iconBag.Load();
+      return true;
+   }
+
+   void OnUnloadGraphics()
+   {
+      iconBag.Unload();
+   }
+}
+
+ToolBarDemo tbDemo { };
diff --git a/samples/guiAndGfx/toolBars/toolBars.epj b/samples/guiAndGfx/toolBars/toolBars.epj
new file mode 100644 (file)
index 0000000..ef9e1ff
--- /dev/null
@@ -0,0 +1,40 @@
+{
+   "Version" : 0.2,
+   "ModuleName" : "toolBars",
+   "Options" : {
+      "Warnings" : "All",
+      "TargetType" : "Executable",
+      "TargetFileName" : "toolBars",
+      "Libraries" : [
+         "ecere"
+      ]
+   },
+   "Configurations" : [
+      {
+         "Name" : "Debug",
+         "Options" : {
+            "Debug" : true,
+            "Optimization" : "None",
+            "PreprocessorDefinitions" : [
+               "_DEBUG"
+            ]
+         }
+      },
+      {
+         "Name" : "Release",
+         "Options" : {
+            "Debug" : false,
+            "Optimization" : "Speed"
+         }
+      }
+   ],
+   "Files" : [
+      "toolBarDemo.ec",
+      "../../../extras/gui/IconBag.ec",
+      "../../../extras/gui/controls/ToolBar.ec"
+   ],
+   "ResourcesPath" : "",
+   "Resources" : [
+
+   ]
+}
\ No newline at end of file