| 
									
										
										
										
											2018-10-10 15:12:38 +02:00
										 |  |  | #pragma once
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-05-28 11:53:16 +02:00
										 |  |  | #include <AK/AKString.h>
 | 
					
						
							|  |  |  | #include <AK/Badge.h>
 | 
					
						
							|  |  |  | #include <AK/HashMap.h>
 | 
					
						
							| 
									
										
										
										
											2019-04-10 16:14:44 +02:00
										 |  |  | #include <LibCore/CElapsedTimer.h>
 | 
					
						
							| 
									
										
										
										
											2019-05-28 11:53:16 +02:00
										 |  |  | #include <LibCore/CObject.h>
 | 
					
						
							| 
									
										
										
										
											2019-07-18 10:15:00 +02:00
										 |  |  | #include <LibDraw/Color.h>
 | 
					
						
							|  |  |  | #include <LibDraw/Font.h>
 | 
					
						
							| 
									
										
										
										
											2019-07-20 16:46:01 +02:00
										 |  |  | #include <LibDraw/Orientation.h>
 | 
					
						
							| 
									
										
										
										
											2019-07-18 10:15:00 +02:00
										 |  |  | #include <LibDraw/Rect.h>
 | 
					
						
							| 
									
										
										
										
											2019-07-20 16:46:01 +02:00
										 |  |  | #include <LibGUI/GEvent.h>
 | 
					
						
							|  |  |  | #include <LibGUI/GShortcut.h>
 | 
					
						
							| 
									
										
										
										
											2018-10-10 15:12:38 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-01-09 02:06:04 +01:00
										 |  |  | class GraphicsBitmap; | 
					
						
							| 
									
										
										
										
											2019-04-20 21:56:56 +02:00
										 |  |  | class GAction; | 
					
						
							| 
									
										
										
										
											2019-02-10 11:07:13 +01:00
										 |  |  | class GLayout; | 
					
						
							| 
									
										
										
										
											2019-04-12 17:10:30 +02:00
										 |  |  | class GMenu; | 
					
						
							| 
									
										
										
										
											2019-01-20 04:49:48 +01:00
										 |  |  | class GWindow; | 
					
						
							| 
									
										
										
										
											2018-10-12 01:03:22 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-06-07 17:13:23 +02:00
										 |  |  | enum class SizePolicy { | 
					
						
							| 
									
										
										
										
											2019-05-28 11:53:16 +02:00
										 |  |  |     Fixed, | 
					
						
							|  |  |  |     Fill | 
					
						
							|  |  |  | }; | 
					
						
							| 
									
										
										
										
											2019-06-07 17:13:23 +02:00
										 |  |  | enum class HorizontalDirection { | 
					
						
							| 
									
										
										
										
											2019-05-28 11:53:16 +02:00
										 |  |  |     Left, | 
					
						
							|  |  |  |     Right | 
					
						
							|  |  |  | }; | 
					
						
							| 
									
										
										
										
											2019-06-07 17:13:23 +02:00
										 |  |  | enum class VerticalDirection { | 
					
						
							| 
									
										
										
										
											2019-05-28 11:53:16 +02:00
										 |  |  |     Up, | 
					
						
							|  |  |  |     Down | 
					
						
							|  |  |  | }; | 
					
						
							| 
									
										
										
										
											2019-02-10 11:07:13 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-04-10 17:01:54 +02:00
										 |  |  | class GWidget : public CObject { | 
					
						
							| 
									
										
										
										
											2018-10-10 15:12:38 +02:00
										 |  |  | public: | 
					
						
							| 
									
										
										
										
											2019-01-20 04:49:48 +01:00
										 |  |  |     explicit GWidget(GWidget* parent = nullptr); | 
					
						
							| 
									
										
										
										
											2019-01-21 00:46:08 +01:00
										 |  |  |     virtual ~GWidget() override; | 
					
						
							| 
									
										
										
										
											2019-01-20 04:49:48 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-02-10 11:07:13 +01:00
										 |  |  |     GLayout* layout() { return m_layout.ptr(); } | 
					
						
							|  |  |  |     void set_layout(OwnPtr<GLayout>&&); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     SizePolicy horizontal_size_policy() const { return m_horizontal_size_policy; } | 
					
						
							|  |  |  |     SizePolicy vertical_size_policy() const { return m_vertical_size_policy; } | 
					
						
							|  |  |  |     SizePolicy size_policy(Orientation orientation) { return orientation == Orientation::Horizontal ? m_horizontal_size_policy : m_vertical_size_policy; } | 
					
						
							|  |  |  |     void set_size_policy(SizePolicy horizontal_policy, SizePolicy vertical_policy); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     Size preferred_size() const { return m_preferred_size; } | 
					
						
							|  |  |  |     void set_preferred_size(const Size&); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-04-08 18:58:44 +02:00
										 |  |  |     bool has_tooltip() const { return !m_tooltip.is_empty(); } | 
					
						
							|  |  |  |     String tooltip() const { return m_tooltip; } | 
					
						
							| 
									
										
										
										
											2019-06-02 14:58:02 +02:00
										 |  |  |     void set_tooltip(const StringView& tooltip) { m_tooltip = tooltip; } | 
					
						
							| 
									
										
										
										
											2019-04-08 18:58:44 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-04-12 02:51:16 +02:00
										 |  |  |     bool is_enabled() const { return m_enabled; } | 
					
						
							|  |  |  |     void set_enabled(bool); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-05-02 03:46:37 +02:00
										 |  |  |     bool updates_enabled() const { return m_updates_enabled; } | 
					
						
							|  |  |  |     void set_updates_enabled(bool); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-04-10 16:56:55 +02:00
										 |  |  |     virtual void event(CEvent&) override; | 
					
						
							| 
									
										
										
										
											2019-01-21 00:46:08 +01:00
										 |  |  |     virtual void paint_event(GPaintEvent&); | 
					
						
							| 
									
										
										
										
											2019-02-09 11:19:38 +01:00
										 |  |  |     virtual void resize_event(GResizeEvent&); | 
					
						
							| 
									
										
										
										
											2019-01-21 00:46:08 +01:00
										 |  |  |     virtual void show_event(GShowEvent&); | 
					
						
							|  |  |  |     virtual void hide_event(GHideEvent&); | 
					
						
							|  |  |  |     virtual void keydown_event(GKeyEvent&); | 
					
						
							|  |  |  |     virtual void keyup_event(GKeyEvent&); | 
					
						
							|  |  |  |     virtual void mousemove_event(GMouseEvent&); | 
					
						
							|  |  |  |     virtual void mousedown_event(GMouseEvent&); | 
					
						
							|  |  |  |     virtual void mouseup_event(GMouseEvent&); | 
					
						
							| 
									
										
										
										
											2019-05-13 19:52:57 +02:00
										 |  |  |     virtual void mousewheel_event(GMouseEvent&); | 
					
						
							| 
									
										
										
										
											2019-03-25 01:42:15 +01:00
										 |  |  |     virtual void click_event(GMouseEvent&); | 
					
						
							|  |  |  |     virtual void doubleclick_event(GMouseEvent&); | 
					
						
							| 
									
										
										
										
											2019-04-18 04:12:27 +02:00
										 |  |  |     virtual void context_menu_event(GContextMenuEvent&); | 
					
						
							| 
									
										
										
										
											2019-04-10 16:56:55 +02:00
										 |  |  |     virtual void focusin_event(CEvent&); | 
					
						
							|  |  |  |     virtual void focusout_event(CEvent&); | 
					
						
							|  |  |  |     virtual void enter_event(CEvent&); | 
					
						
							|  |  |  |     virtual void leave_event(CEvent&); | 
					
						
							|  |  |  |     virtual void child_event(CChildEvent&) override; | 
					
						
							| 
									
										
										
										
											2019-05-25 13:40:57 +02:00
										 |  |  |     virtual void change_event(GEvent&); | 
					
						
							| 
									
										
										
										
											2019-01-21 00:46:08 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-04-11 03:34:37 +02:00
										 |  |  |     // This is called after children have been painted.
 | 
					
						
							|  |  |  |     virtual void second_paint_event(GPaintEvent&); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-01-21 00:46:08 +01:00
										 |  |  |     Rect relative_rect() const { return m_relative_rect; } | 
					
						
							|  |  |  |     Point relative_position() const { return m_relative_rect.location(); } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-02-09 14:30:05 +01:00
										 |  |  |     Rect window_relative_rect() const; | 
					
						
							| 
									
										
										
										
											2019-04-08 18:58:44 +02:00
										 |  |  |     Rect screen_relative_rect() const; | 
					
						
							| 
									
										
										
										
											2019-02-09 14:30:05 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-01-21 00:46:08 +01:00
										 |  |  |     int x() const { return m_relative_rect.x(); } | 
					
						
							|  |  |  |     int y() const { return m_relative_rect.y(); } | 
					
						
							|  |  |  |     int width() const { return m_relative_rect.width(); } | 
					
						
							|  |  |  |     int height() const { return m_relative_rect.height(); } | 
					
						
							| 
									
										
										
										
											2019-07-01 02:46:36 -05:00
										 |  |  |     int length(Orientation orientation) const { return orientation == Orientation::Vertical ? height() : width(); } | 
					
						
							| 
									
										
										
										
											2018-10-12 14:15:14 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  |     Rect rect() const { return { 0, 0, width(), height() }; } | 
					
						
							| 
									
										
										
										
											2019-01-21 00:46:08 +01:00
										 |  |  |     Size size() const { return m_relative_rect.size(); } | 
					
						
							| 
									
										
										
										
											2018-10-10 16:49:36 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-10-10 15:12:38 +02:00
										 |  |  |     void update(); | 
					
						
							| 
									
										
										
										
											2019-02-10 14:28:39 +01:00
										 |  |  |     void update(const Rect&); | 
					
						
							| 
									
										
										
										
											2018-10-10 15:12:38 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-01-26 11:24:16 +01:00
										 |  |  |     virtual bool accepts_focus() const { return false; } | 
					
						
							| 
									
										
										
										
											2019-06-21 10:09:57 +02:00
										 |  |  |     virtual bool supports_keyboard_activation() const { return false; } | 
					
						
							| 
									
										
										
										
											2019-01-26 11:24:16 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-01-21 00:46:08 +01:00
										 |  |  |     bool is_focused() const; | 
					
						
							|  |  |  |     void set_focus(bool); | 
					
						
							| 
									
										
										
										
											2018-10-13 17:52:47 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-10-10 16:49:36 +02:00
										 |  |  |     struct HitTestResult { | 
					
						
							| 
									
										
										
										
											2019-01-20 04:49:48 +01:00
										 |  |  |         GWidget* widget { nullptr }; | 
					
						
							| 
									
										
										
										
											2019-04-16 13:25:00 +02:00
										 |  |  |         Point local_position; | 
					
						
							| 
									
										
										
										
											2018-10-10 16:49:36 +02:00
										 |  |  |     }; | 
					
						
							| 
									
										
										
										
											2019-04-16 13:25:00 +02:00
										 |  |  |     HitTestResult hit_test(const Point&); | 
					
						
							|  |  |  |     GWidget* child_at(const Point&) const; | 
					
						
							| 
									
										
										
										
											2019-04-16 03:47:55 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-01-20 04:49:48 +01:00
										 |  |  |     virtual const char* class_name() const override { return "GWidget"; } | 
					
						
							| 
									
										
										
										
											2018-10-10 16:49:36 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-01-24 23:40:12 +01:00
										 |  |  |     void set_relative_rect(const Rect&); | 
					
						
							| 
									
										
										
										
											2019-02-09 11:19:38 +01:00
										 |  |  |     void set_relative_rect(int x, int y, int width, int height) { set_relative_rect({ x, y, width, height }); } | 
					
						
							| 
									
										
										
										
											2019-02-08 00:14:37 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-04-14 04:10:43 +02:00
										 |  |  |     void set_x(int x) { set_relative_rect(x, y(), width(), height()); } | 
					
						
							|  |  |  |     void set_y(int y) { set_relative_rect(x(), y, width(), height()); } | 
					
						
							|  |  |  |     void set_width(int width) { set_relative_rect(x(), y(), width, height()); } | 
					
						
							|  |  |  |     void set_height(int height) { set_relative_rect(x(), y(), width(), height); } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-02-02 08:05:14 +01:00
										 |  |  |     void move_to(const Point& point) { set_relative_rect({ point, relative_rect().size() }); } | 
					
						
							| 
									
										
										
										
											2019-02-08 00:14:37 +01:00
										 |  |  |     void move_to(int x, int y) { move_to({ x, y }); } | 
					
						
							|  |  |  |     void resize(const Size& size) { set_relative_rect({ relative_rect().location(), size }); } | 
					
						
							|  |  |  |     void resize(int width, int height) { resize({ width, height }); } | 
					
						
							| 
									
										
										
										
											2018-10-10 16:49:36 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-04-16 22:59:27 +02:00
										 |  |  |     void move_by(int x, int y) { move_by({ x, y }); } | 
					
						
							|  |  |  |     void move_by(const Point& delta) { set_relative_rect({ relative_position().translated(delta), size() }); } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-01-21 00:46:08 +01:00
										 |  |  |     Color background_color() const { return m_background_color; } | 
					
						
							|  |  |  |     Color foreground_color() const { return m_foreground_color; } | 
					
						
							| 
									
										
										
										
											2018-10-11 01:48:09 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-01-21 00:46:08 +01:00
										 |  |  |     void set_background_color(Color color) { m_background_color = color; } | 
					
						
							|  |  |  |     void set_foreground_color(Color color) { m_foreground_color = color; } | 
					
						
							| 
									
										
										
										
											2018-10-11 01:48:09 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-07-10 21:00:34 +02:00
										 |  |  |     // FIXME: Implement these.
 | 
					
						
							| 
									
										
										
										
											2019-07-20 16:46:01 +02:00
										 |  |  |     void set_backcolor(const StringView&) {} | 
					
						
							|  |  |  |     void set_forecolor(const StringView&) {} | 
					
						
							| 
									
										
										
										
											2019-07-10 21:00:34 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-07-10 21:12:09 +02:00
										 |  |  |     void set_autofill(bool b) { set_fill_with_background_color(b); } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-01-20 04:49:48 +01:00
										 |  |  |     GWindow* window() | 
					
						
							| 
									
										
										
										
											2018-10-12 01:03:22 +02:00
										 |  |  |     { | 
					
						
							| 
									
										
										
										
											2019-01-21 00:46:08 +01:00
										 |  |  |         if (auto* pw = parent_widget()) | 
					
						
							| 
									
										
										
										
											2018-10-12 01:03:22 +02:00
										 |  |  |             return pw->window(); | 
					
						
							|  |  |  |         return m_window; | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-01-20 04:49:48 +01:00
										 |  |  |     const GWindow* window() const | 
					
						
							| 
									
										
										
										
											2018-10-12 01:03:22 +02:00
										 |  |  |     { | 
					
						
							| 
									
										
										
										
											2019-01-21 00:46:08 +01:00
										 |  |  |         if (auto* pw = parent_widget()) | 
					
						
							| 
									
										
										
										
											2018-10-12 01:03:22 +02:00
										 |  |  |             return pw->window(); | 
					
						
							|  |  |  |         return m_window; | 
					
						
							|  |  |  |     } | 
					
						
							| 
									
										
										
										
											2018-10-11 16:52:40 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-01-20 07:03:38 +01:00
										 |  |  |     void set_window(GWindow*); | 
					
						
							| 
									
										
										
										
											2018-10-12 02:41:27 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-05-27 04:06:01 +02:00
										 |  |  |     GWidget* parent_widget(); | 
					
						
							|  |  |  |     const GWidget* parent_widget() const; | 
					
						
							| 
									
										
										
										
											2018-10-11 16:52:40 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-01-21 00:46:08 +01:00
										 |  |  |     void set_fill_with_background_color(bool b) { m_fill_with_background_color = b; } | 
					
						
							|  |  |  |     bool fill_with_background_color() const { return m_fill_with_background_color; } | 
					
						
							| 
									
										
										
										
											2018-10-14 00:21:42 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-10-14 13:06:05 +02:00
										 |  |  |     const Font& font() const { return *m_font; } | 
					
						
							| 
									
										
										
										
											2019-07-11 16:02:39 +02:00
										 |  |  |     void set_font(Font*); | 
					
						
							|  |  |  |     void set_font(Font& font) { set_font(&font); } | 
					
						
							| 
									
										
										
										
											2018-10-14 13:06:05 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-01-27 08:48:34 +01:00
										 |  |  |     void set_global_cursor_tracking(bool); | 
					
						
							|  |  |  |     bool global_cursor_tracking() const; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-02-10 11:07:13 +01:00
										 |  |  |     void notify_layout_changed(Badge<GLayout>); | 
					
						
							| 
									
										
										
										
											2019-03-30 13:53:30 +01:00
										 |  |  |     void invalidate_layout(); | 
					
						
							| 
									
										
										
										
											2019-02-10 11:07:13 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-03-15 16:12:06 +01:00
										 |  |  |     bool is_visible() const { return m_visible; } | 
					
						
							|  |  |  |     void set_visible(bool); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-03-29 02:20:22 +01:00
										 |  |  |     bool spans_entire_window_horizontally() const; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-04-11 03:34:37 +02:00
										 |  |  |     bool is_greedy_for_hits() const { return m_greedy_for_hits; } | 
					
						
							|  |  |  |     void set_greedy_for_hits(bool b) { m_greedy_for_hits = b; } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-04-16 03:47:55 +02:00
										 |  |  |     void move_to_front(); | 
					
						
							|  |  |  |     void move_to_back(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     bool is_frontmost() const; | 
					
						
							|  |  |  |     bool is_backmost() const; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-04-20 21:56:56 +02:00
										 |  |  |     GAction* action_for_key_event(const GKeyEvent&); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     void register_local_shortcut_action(Badge<GAction>, GAction&); | 
					
						
							|  |  |  |     void unregister_local_shortcut_action(Badge<GAction>, GAction&); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-05-27 03:52:33 +02:00
										 |  |  |     template<typename Callback> | 
					
						
							|  |  |  |     void for_each_child_widget(Callback callback) | 
					
						
							|  |  |  |     { | 
					
						
							| 
									
										
										
										
											2019-05-28 11:53:16 +02:00
										 |  |  |         for_each_child([&](auto& child) { | 
					
						
							| 
									
										
										
										
											2019-05-27 04:06:01 +02:00
										 |  |  |             if (is<GWidget>(child)) | 
					
						
							|  |  |  |                 return callback(to<GWidget>(child)); | 
					
						
							| 
									
										
										
										
											2019-05-27 03:52:33 +02:00
										 |  |  |             return IterationDecision::Continue; | 
					
						
							|  |  |  |         }); | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-05-23 22:37:21 +02:00
										 |  |  |     virtual bool is_radio_button() const { return false; } | 
					
						
							| 
									
										
										
										
											2019-06-12 05:57:26 +02:00
										 |  |  |     virtual bool is_abstract_button() const { return false; } | 
					
						
							| 
									
										
										
										
											2019-05-23 22:37:21 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-10-10 15:12:38 +02:00
										 |  |  | private: | 
					
						
							| 
									
										
										
										
											2019-03-15 16:12:06 +01:00
										 |  |  |     virtual bool is_widget() const final { return true; } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-02-09 11:19:38 +01:00
										 |  |  |     void handle_paint_event(GPaintEvent&); | 
					
						
							| 
									
										
										
										
											2019-02-10 11:07:13 +01:00
										 |  |  |     void handle_resize_event(GResizeEvent&); | 
					
						
							| 
									
										
										
										
											2019-04-01 22:03:32 +02:00
										 |  |  |     void handle_mousedown_event(GMouseEvent&); | 
					
						
							| 
									
										
										
										
											2019-05-15 22:17:09 +02:00
										 |  |  |     void handle_mousedoubleclick_event(GMouseEvent&); | 
					
						
							| 
									
										
										
										
											2019-03-25 01:42:15 +01:00
										 |  |  |     void handle_mouseup_event(GMouseEvent&); | 
					
						
							| 
									
										
										
										
											2019-04-10 16:56:55 +02:00
										 |  |  |     void handle_enter_event(CEvent&); | 
					
						
							|  |  |  |     void handle_leave_event(CEvent&); | 
					
						
							| 
									
										
										
										
											2019-02-10 11:07:13 +01:00
										 |  |  |     void do_layout(); | 
					
						
							| 
									
										
										
										
											2019-05-15 02:39:58 +02:00
										 |  |  |     void focus_previous_widget(); | 
					
						
							|  |  |  |     void focus_next_widget(); | 
					
						
							| 
									
										
										
										
											2019-02-09 11:19:38 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-01-20 04:49:48 +01:00
										 |  |  |     GWindow* m_window { nullptr }; | 
					
						
							| 
									
										
										
										
											2019-02-10 11:07:13 +01:00
										 |  |  |     OwnPtr<GLayout> m_layout; | 
					
						
							| 
									
										
										
										
											2018-10-12 01:03:22 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-01-21 00:46:08 +01:00
										 |  |  |     Rect m_relative_rect; | 
					
						
							| 
									
										
										
										
											2019-02-19 01:42:53 +01:00
										 |  |  |     Color m_background_color; | 
					
						
							|  |  |  |     Color m_foreground_color; | 
					
						
							| 
									
										
										
										
											2019-06-21 18:37:47 +02:00
										 |  |  |     RefPtr<Font> m_font; | 
					
						
							| 
									
										
										
										
											2019-04-08 18:58:44 +02:00
										 |  |  |     String m_tooltip; | 
					
						
							| 
									
										
										
										
											2018-10-11 12:33:03 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-02-10 11:07:13 +01:00
										 |  |  |     SizePolicy m_horizontal_size_policy { SizePolicy::Fill }; | 
					
						
							|  |  |  |     SizePolicy m_vertical_size_policy { SizePolicy::Fill }; | 
					
						
							|  |  |  |     Size m_preferred_size; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-03-10 13:16:36 +01:00
										 |  |  |     bool m_fill_with_background_color { false }; | 
					
						
							| 
									
										
										
										
											2019-03-15 16:12:06 +01:00
										 |  |  |     bool m_visible { true }; | 
					
						
							| 
									
										
										
										
											2019-04-11 03:34:37 +02:00
										 |  |  |     bool m_greedy_for_hits { false }; | 
					
						
							| 
									
										
										
										
											2019-04-12 02:51:16 +02:00
										 |  |  |     bool m_enabled { true }; | 
					
						
							| 
									
										
										
										
											2019-04-18 22:57:24 +02:00
										 |  |  |     bool m_layout_dirty { false }; | 
					
						
							| 
									
										
										
										
											2019-05-02 03:46:37 +02:00
										 |  |  |     bool m_updates_enabled { true }; | 
					
						
							| 
									
										
										
										
											2019-03-25 01:42:15 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-04-20 21:56:56 +02:00
										 |  |  |     HashMap<GShortcut, GAction*> m_local_shortcut_actions; | 
					
						
							| 
									
										
										
										
											2018-10-10 15:12:38 +02:00
										 |  |  | }; | 
					
						
							| 
									
										
										
										
											2019-05-27 04:06:01 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-05-28 11:53:16 +02:00
										 |  |  | template<> | 
					
						
							|  |  |  | inline bool is<GWidget>(const CObject& object) | 
					
						
							| 
									
										
										
										
											2019-05-27 04:06:01 +02:00
										 |  |  | { | 
					
						
							|  |  |  |     return object.is_widget(); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | inline GWidget* GWidget::parent_widget() | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     if (parent() && is<GWidget>(*parent())) | 
					
						
							|  |  |  |         return &to<GWidget>(*parent()); | 
					
						
							|  |  |  |     return nullptr; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | inline const GWidget* GWidget::parent_widget() const | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     if (parent() && is<GWidget>(*parent())) | 
					
						
							|  |  |  |         return &to<const GWidget>(*parent()); | 
					
						
							|  |  |  |     return nullptr; | 
					
						
							|  |  |  | } |