128 */ |
128 */ |
129 virtual void OnCreate(EvtCreate &ev) {}; |
129 virtual void OnCreate(EvtCreate &ev) {}; |
130 virtual void OnDestroy(EvtDestroy &ev) {}; |
130 virtual void OnDestroy(EvtDestroy &ev) {}; |
131 virtual void OnPaint(EvtPaint &ev) = 0; |
131 virtual void OnPaint(EvtPaint &ev) = 0; |
132 virtual void OnKeyPress(EvtKeyPress &ev) {}; |
132 virtual void OnKeyPress(EvtKeyPress &ev) {}; |
133 virtual void OnLeftClick(EvtClick &ev); |
133 virtual void OnLeftButtonDown(EvtLeftButtonDown &ev) {}; |
134 virtual void OnRightClick(EvtRightClick &ev); |
134 virtual void OnLeftClick(EvtLeftClick &ev); |
|
135 virtual void OnRightButtonDown(EvtRightButtonDown &ev); |
135 virtual void OnMouseOver(EvtMouseOver &ev) {}; |
136 virtual void OnMouseOver(EvtMouseOver &ev) {}; |
136 virtual void OnResize(EvtResize &ev) {}; |
137 virtual void OnResize(EvtResize &ev) {}; |
137 virtual void OnResizeParent(EvtResizeParent &ev); |
138 virtual void OnResizeParent(EvtResizeParent &ev); |
138 |
139 |
139 /** |
140 /** |
145 * @function AddReflectHandlerT Registers reflected event handler. Use it from |
146 * @function AddReflectHandlerT Registers reflected event handler. Use it from |
146 * BaseWindow subclasses (Window implementations) to register custom event handler. |
147 * BaseWindow subclasses (Window implementations) to register custom event handler. |
147 * For example if you are implementing 'MyWindow' class and want to handle OnLeftClick() |
148 * For example if you are implementing 'MyWindow' class and want to handle OnLeftClick() |
148 * event for your button 'MyButton', define your handler method inside 'MyWindow' class |
149 * event for your button 'MyButton', define your handler method inside 'MyWindow' class |
149 * like: |
150 * like: |
150 * void MyWindow::MyButtonClickHandler(gui::EvtClick &e) |
151 * void MyWindow::MyButtonClickHandler(gui::EvtLeftClick &e) |
151 * { |
152 * { |
152 * ... |
153 * ... |
153 * } |
154 * } |
154 * then from inside OnCreate() handler, create your button 'my_button' and |
155 * then from inside OnCreate() handler, create your button 'my_button' and |
155 * call: |
156 * call: |
198 virtual void CreateWidgets() = 0; |
199 virtual void CreateWidgets() = 0; |
199 virtual void Close(); |
200 virtual void Close(); |
200 |
201 |
201 /*virtual*/ void OnCreate(EvtCreate &ev); |
202 /*virtual*/ void OnCreate(EvtCreate &ev); |
202 /*virtual*/ void OnPaint(EvtPaint &ev); |
203 /*virtual*/ void OnPaint(EvtPaint &ev); |
203 /*virtual*/ void OnLeftClick(EvtClick &ev); |
204 /*virtual*/ void OnLeftButtonDown(EvtLeftButtonDown &ev); |
204 /*virtual*/ void OnRightClick(EvtRightClick &ev); |
205 /*virtual*/ void OnRightButtonDown(EvtRightButtonDown &ev); |
205 /*virtual*/ void OnResize(EvtResize &ev); |
206 /*virtual*/ void OnResize(EvtResize &ev); |
206 }; |
207 }; |
207 |
208 |
208 struct Button : public Widget { |
209 struct Button : public Widget { |
209 typedef Widget super; |
210 typedef Widget super; |
247 {} |
248 {} |
248 |
249 |
249 /*virtual*/ void OnPaint(EvtPaint &ev); |
250 /*virtual*/ void OnPaint(EvtPaint &ev); |
250 }; |
251 }; |
251 |
252 |
252 struct ResizeBox : public Widget { |
253 struct CloseBox : public Button { |
|
254 typedef Button super; |
|
255 |
|
256 static const int16 DEFAULT_WIDTH = 11; |
|
257 static const int16 DEFAULT_HEIGHT = 14; |
|
258 |
|
259 public: |
|
260 CloseBox() |
|
261 : Button() |
|
262 {} |
|
263 |
|
264 CloseBox(CompositeWidget *container) |
|
265 : Button(container, -102, 0, container->m_color, Rect16(), 0) |
|
266 {} |
|
267 |
|
268 /*virtual*/ void OnCreate(EvtCreate &ev); |
|
269 /*virtual*/ void OnPaint(EvtPaint &ev); |
|
270 /*virtual*/ void OnLeftClick(EvtLeftClick &ev); |
|
271 }; |
|
272 |
|
273 struct Caption : public Widget { |
253 typedef Widget super; |
274 typedef Widget super; |
254 |
|
255 static const int16 DEFAULT_WIDTH = 11; |
|
256 static const int16 DEFAULT_HEIGHT = 11; |
|
257 |
|
258 protected: |
|
259 Point16 m_sizing_offset; |
|
260 CaptureTicket m_ticket_sizing; |
|
261 |
|
262 public: |
|
263 ResizeBox() |
|
264 : Widget() |
|
265 {} |
|
266 |
|
267 ResizeBox(CompositeWidget *container) |
|
268 : Widget(container, -101, 0, container->m_color, Rect16(), 0) |
|
269 {} |
|
270 |
|
271 /*virtual*/ void DrawBackground(EvtPaint &ev); |
|
272 void OnCaptureSizing(EvtMouseOver &e); |
|
273 |
|
274 /*virtual*/ void OnCreate(EvtCreate &ev); |
|
275 /*virtual*/ void OnPaint(EvtPaint &ev); |
|
276 /*virtual*/ void OnLeftClick(EvtClick &ev); |
|
277 /*virtual*/ void OnResizeParent(EvtResizeParent &ev); |
|
278 |
|
279 }; |
|
280 |
|
281 struct CaptionBar : public CompositeWidget { |
|
282 typedef CompositeWidget super; |
|
283 |
|
284 static const int16 DEFAULT_HEIGHT = 14; |
|
285 |
275 |
286 protected: |
276 protected: |
287 StringID m_text; |
277 StringID m_text; |
288 byte m_text_color; |
278 byte m_text_color; |
289 Point16 m_moving_offset; |
279 Point16 m_moving_offset; |
290 CaptureTicket m_ticket_moving; |
280 CaptureTicket m_ticket_moving; |
291 |
281 |
292 public: |
282 public: |
|
283 Caption() |
|
284 : Widget() |
|
285 , m_text(0) |
|
286 , m_text_color(0xFF) |
|
287 {} |
|
288 |
|
289 Caption(CompositeWidget *container, WidgetId id, byte display_flags, byte color, const Rect16 rect, byte text_color, StringID tooltips, StringID text) |
|
290 : Widget(container, id, display_flags, color, rect, tooltips) |
|
291 , m_text(text) |
|
292 , m_text_color(text_color) |
|
293 {} |
|
294 |
|
295 /*virtual*/ void DrawBackground(EvtPaint &ev); |
|
296 |
|
297 /*virtual*/ void OnCreate(EvtCreate &ev); |
|
298 /*virtual*/ void OnPaint(EvtPaint &ev); |
|
299 /*virtual*/ void OnLeftButtonDown(EvtLeftButtonDown &ev); |
|
300 void OnCaptureMoving(EvtMouseOver &e); |
|
301 }; |
|
302 |
|
303 struct CaptionBar : public CompositeWidget { |
|
304 typedef CompositeWidget super; |
|
305 |
|
306 static const int16 DEFAULT_HEIGHT = 14; |
|
307 |
|
308 protected: |
|
309 StringID m_text; |
|
310 byte m_text_color; |
|
311 Point16 m_moving_offset; |
|
312 CaptureTicket m_ticket_moving; |
|
313 |
|
314 public: |
293 CaptionBar() |
315 CaptionBar() |
294 : CompositeWidget() |
316 : CompositeWidget() |
295 , m_text(0) |
317 , m_text(0) |
296 , m_text_color(0xFF) |
318 , m_text_color(0xFF) |
297 {} |
319 {} |
301 , m_text(text) |
323 , m_text(text) |
302 , m_text_color(text_color) |
324 , m_text_color(text_color) |
303 {} |
325 {} |
304 |
326 |
305 /*virtual*/ void CreateWidgets(); |
327 /*virtual*/ void CreateWidgets(); |
|
328 |
|
329 /*virtual*/ void OnCreate(EvtCreate &ev); |
|
330 }; |
|
331 |
|
332 |
|
333 struct ResizeBox : public Widget { |
|
334 typedef Widget super; |
|
335 |
|
336 static const int16 DEFAULT_WIDTH = 11; |
|
337 static const int16 DEFAULT_HEIGHT = 11; |
|
338 |
|
339 protected: |
|
340 Point16 m_sizing_offset; |
|
341 CaptureTicket m_ticket_sizing; |
|
342 |
|
343 public: |
|
344 ResizeBox() |
|
345 : Widget() |
|
346 {} |
|
347 |
|
348 ResizeBox(CompositeWidget *container) |
|
349 : Widget(container, -101, 0, container->m_color, Rect16(), 0) |
|
350 {} |
|
351 |
306 /*virtual*/ void DrawBackground(EvtPaint &ev); |
352 /*virtual*/ void DrawBackground(EvtPaint &ev); |
307 |
353 void OnCaptureSizing(EvtMouseOver &e); |
308 /*virtual*/ void OnCreate(EvtCreate &ev); |
354 |
309 /*virtual*/ void OnPaint(EvtPaint &ev); |
355 /*virtual*/ void OnCreate(EvtCreate &ev); |
310 /*virtual*/ void OnLeftClick(EvtClick &ev); |
356 /*virtual*/ void OnPaint(EvtPaint &ev); |
311 void OnCaptureMoving(EvtMouseOver &e); |
357 /*virtual*/ void OnLeftButtonDown(EvtLeftButtonDown &ev); |
|
358 /*virtual*/ void OnResizeParent(EvtResizeParent &ev); |
|
359 |
312 }; |
360 }; |
313 |
361 |
314 |
362 |
315 |
363 |
316 |
364 |