| 
									
										
										
										
											2019-01-20 04:49:48 +01:00
										 |  |  | #pragma once
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-03-28 15:30:29 +01:00
										 |  |  | #include <LibGUI/GFrame.h>
 | 
					
						
							| 
									
										
										
										
											2019-07-18 10:15:00 +02:00
										 |  |  | #include <LibDraw/TextAlignment.h>
 | 
					
						
							| 
									
										
										
										
											2019-02-12 15:23:07 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | class GraphicsBitmap; | 
					
						
							| 
									
										
										
										
											2019-01-20 04:49:48 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-04-26 14:16:17 +02:00
										 |  |  | class GLabel : public GFrame { | 
					
						
							| 
									
										
										
										
											2019-07-25 19:49:28 +02:00
										 |  |  |     C_OBJECT(GLabel) | 
					
						
							| 
									
										
										
										
											2019-01-20 04:49:48 +01:00
										 |  |  | public: | 
					
						
							| 
									
										
										
										
											2019-04-08 18:58:44 +02:00
										 |  |  |     explicit GLabel(GWidget* parent = nullptr); | 
					
						
							| 
									
										
										
										
											2019-06-02 14:58:02 +02:00
										 |  |  |     GLabel(const StringView& text, GWidget* parent = nullptr); | 
					
						
							| 
									
										
										
										
											2019-01-20 04:49:48 +01:00
										 |  |  |     virtual ~GLabel() override; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     String text() const { return m_text; } | 
					
						
							| 
									
										
										
										
											2019-06-02 14:58:02 +02:00
										 |  |  |     void set_text(const StringView&); | 
					
						
							| 
									
										
										
										
											2019-01-20 04:49:48 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-07-11 15:52:15 +02:00
										 |  |  |     void set_icon(GraphicsBitmap*); | 
					
						
							| 
									
										
										
										
											2019-02-12 15:23:07 +01:00
										 |  |  |     const GraphicsBitmap* icon() const { return m_icon.ptr(); } | 
					
						
							|  |  |  |     GraphicsBitmap* icon() { return m_icon.ptr(); } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     TextAlignment text_alignment() const { return m_text_alignment; } | 
					
						
							|  |  |  |     void set_text_alignment(TextAlignment text_alignment) { m_text_alignment = text_alignment; } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-03-22 04:20:48 +01:00
										 |  |  |     bool should_stretch_icon() const { return m_should_stretch_icon; } | 
					
						
							|  |  |  |     void set_should_stretch_icon(bool b) { m_should_stretch_icon = b; } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-03-20 22:01:02 +01:00
										 |  |  |     void size_to_fit(); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-01-20 04:49:48 +01:00
										 |  |  | private: | 
					
						
							| 
									
										
										
										
											2019-01-21 00:46:08 +01:00
										 |  |  |     virtual void paint_event(GPaintEvent&) override; | 
					
						
							| 
									
										
										
										
											2019-01-20 04:49:48 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  |     String m_text; | 
					
						
							| 
									
										
										
										
											2019-06-21 18:37:47 +02:00
										 |  |  |     RefPtr<GraphicsBitmap> m_icon; | 
					
						
							| 
									
										
										
										
											2019-02-12 15:23:07 +01:00
										 |  |  |     TextAlignment m_text_alignment { TextAlignment::Center }; | 
					
						
							| 
									
										
										
										
											2019-03-22 04:20:48 +01:00
										 |  |  |     bool m_should_stretch_icon { false }; | 
					
						
							| 
									
										
										
										
											2019-01-20 04:49:48 +01:00
										 |  |  | }; |