src/window.h
branchcpp_gui
changeset 6260 740c702f6871
parent 6259 0f36789984b1
child 6261 5fd6b1cfa424
equal deleted inserted replaced
6259:0f36789984b1 6260:740c702f6871
   336 	byte m_color;                       ///< Widget colour, see docs/ottd-colourtext-palette.png
   336 	byte m_color;                       ///< Widget colour, see docs/ottd-colourtext-palette.png
   337 	bool m_is_closing : 1;              ///< Widget was logically destroyed
   337 	bool m_is_closing : 1;              ///< Widget was logically destroyed
   338 	bool m_dont_clip : 1;               ///< should not be clipped by parent (container)
   338 	bool m_dont_clip : 1;               ///< should not be clipped by parent (container)
   339 	StringID m_tooltips;                ///< Tooltips that are shown when rightclicking on a widget
   339 	StringID m_tooltips;                ///< Tooltips that are shown when rightclicking on a widget
   340 
   340 
       
   341 	Widget()
       
   342 		: m_container(NULL), m_id(0), m_rect(), m_data(0), m_display_flags(0), m_color(0)
       
   343 		, m_is_closing(false), m_tooltips(0)
       
   344 	{}
       
   345 
   341 	Widget(CompositeWidget *container, WidgetId id, byte display_flags, byte color, const Rect16 &rect, StringID tooltips)
   346 	Widget(CompositeWidget *container, WidgetId id, byte display_flags, byte color, const Rect16 &rect, StringID tooltips)
   342 		: m_container(container)
   347 		: m_container(container)
   343 		, m_id(id)
   348 		, m_id(id)
   344 		, m_rect(rect)
   349 		, m_rect(rect)
   345 		, m_data(0)
   350 		, m_data(0)
   386 
   391 
   387 protected:
   392 protected:
   388 	Widgets m_widgets;
   393 	Widgets m_widgets;
   389 
   394 
   390 public:
   395 public:
       
   396 	CompositeWidget()
       
   397 		: Widget()
       
   398 	{}
       
   399 
   391 	CompositeWidget(CompositeWidget *container, WidgetId id, byte display_flags, byte color, const Rect16 &rect, StringID tooltips)
   400 	CompositeWidget(CompositeWidget *container, WidgetId id, byte display_flags, byte color, const Rect16 &rect, StringID tooltips)
   392 		: Widget(container, id, display_flags, color, rect, tooltips)
   401 		: Widget(container, id, display_flags, color, rect, tooltips)
   393 	{}
   402 	{}
   394 
   403 
   395 	void AddWidget(Widget *wd);
   404 	void AddWidget(Widget *wd);
   397 	Widget* RemoveWidget(WidgetId id);
   406 	Widget* RemoveWidget(WidgetId id);
   398 
   407 
   399 	/*virtual*/ Widget* WidgetFromPt(const Point16 &pt);
   408 	/*virtual*/ Widget* WidgetFromPt(const Point16 &pt);
   400 
   409 
   401 	virtual void Close();
   410 	virtual void Close();
       
   411 
       
   412 	/*virtual*/ bool OnLeftClick(WindowEvent *ev);
   402 };
   413 };
   403 
   414 
   404 
   415 
   405 struct BaseWindow;
   416 struct BaseWindow;
   406 typedef CCountedPtr<BaseWindow> WindowPtr;
   417 typedef CCountedPtr<BaseWindow> WindowPtr;
   478 		return m_list.end();
   489 		return m_list.end();
   479 	}
   490 	}
   480 
   491 
   481 };
   492 };
   482 
   493 
   483 struct BaseWindow : public SimpleCountedObject {
   494 struct BaseWindow : public CompositeWidget {
   484 public:
   495 public:
   485 	static WindowList s_list;
   496 	static WindowList s_list;
   486 
   497 
   487 	WindowFlags flags4;
   498 	WindowFlags flags4;
   488 	WindowClass window_class;
   499 	WindowClass window_class;