3 extern int __ecereVMethodID___ecereNameSpace__ecere__gui__Window_OnLeftButtonUp;
8 a.OnLeftButtonUp(0,0,0);
11 class ToolBox : Window
14 background = formColor;
15 borderStyle = sizable;
17 //size = { 200, 500 };
19 anchor = { right = 0 };
20 //anchor = { right = 0, top = 0, bottom = 0 };
31 ObjectInfo selectedClass;
32 CodeEditor codeEditor;
33 char * selectedControl;
36 Menu viewMenu { menu, $"View" };
37 MenuItem { viewMenu, $"View Toolbox" };
43 property char * controlClass
47 arrowControl.checked = true;
49 ((Designer)GetActiveDesigner()).objectClass = null;
53 return (char *)className;
56 property CodeEditor codeEditor
58 set { this.codeEditor = value; }
60 property ObjectInfo selectedClass
64 if(value != selectedClass ||
65 (value && value.instance && (!selectedClass.instance || selectedClass.instance._class != value.instance._class)))
69 selectedControl = null;
71 selectedClass = value;
73 for(control = (Button)firstChild; control; control = next)
75 next = (Button)control.next;
76 if(control != arrowControl && !control.nonClient)
79 selectedControl = (char *)control.id;
83 // TOFIX: It seems the virtual space does not get adjusted by only destroying the buttons?
84 scrollArea = { 0, 0 };
86 //className = null; // Had to drag twice on code...
87 arrowControl.checked = true;
89 if(value && value.instance)
93 ((Designer)GetActiveDesigner()).FillToolBox();
99 bool OnClose(bool parentClosing)
103 ide.RepositionWindows(false);
104 return parentClosing;
107 bool OnKeyDown(Key key, unichar ch)
111 if(ide.activeClient) ide.activeClient.Activate();
117 void AddControl(Class _class)
119 Button control = CreateControl(&controlY, (const char *)eClass_GetProperty(_class, "icon"), _class.name, _class.name);
121 if(selectedControl && !strcmp(selectedControl, _class.name))
123 control.checked = true;
124 strcpy(className, _class.name);
125 ((Designer)GetActiveDesigner()).objectClass = className;
132 arrowControl = CreateControl(&y, ":others/mousePointer.png", $"Pointer", null);
133 arrowControl.checked = true;
137 bool OnLeftButtonUp(int x, int y, Modifiers mods)
139 Designer designer = (Designer)GetActiveDesigner();
140 if(designer && designer.isDragging)
142 ((Designer)GetActiveDesigner()).isDragging = false;
144 return rootWindow.MouseMessage(__ecereVMethodID___ecereNameSpace__ecere__gui__Window_OnLeftButtonUp,
145 x + absPosition.x + clientStart.x, y + absPosition.y + clientStart.y, &mods, false, false);
150 Button CreateControl(int * y, const char * bitmapFile, const char * text, const void * id)
158 minClientSize.w = 120;
160 anchor = Anchor { left = 5, top = *y, right = 5 };
162 bitmap = { bitmapFile };
165 bool NotifyPushed(Button control, int x, int y, Modifiers mods)
167 control.checked = true;
168 strcpy(className, control.text); //id;
169 if((Designer)GetActiveDesigner())
171 ((Designer)GetActiveDesigner()).objectClass = control.id ? className : null; //(char *)control.text; //id;
172 ((Designer)GetActiveDesigner()).isDragging = true;
173 control.ReleaseCapture();
175 cursor = ((GuiApplication)__thisModule.application).GetCursor(arrow);
180 bool NotifyDoubleClick(Button control, int x, int y, Modifiers mods)
182 if(control != arrowControl)
183 codeEditor.AddControl();
187 bool NotifyReleased(Button control, int x, int y, Modifiers mods)
189 // ((Designer)GetActiveDesigner()).isDragging = false;