mirror of
				https://github.com/RGBCube/serenity
				synced 2025-10-31 11:02:43 +00:00 
			
		
		
		
	 a599317624
			
		
	
	
		a599317624
		
	
	
	
	
		
			
			This macro goes at the top of every CObject-derived class like so:
class SomeClass : public CObject {
    C_OBJECT(SomeClass)
public:
    ...
At the moment, all it does is create an override for the class_name() getter
but in the future this will be used to automatically insert member functions
into these classes.
		
	
			
		
			
				
	
	
		
			41 lines
		
	
	
	
		
			1 KiB
		
	
	
	
		
			C++
		
	
	
	
	
	
			
		
		
	
	
			41 lines
		
	
	
	
		
			1 KiB
		
	
	
	
		
			C++
		
	
	
	
	
	
| #pragma once
 | |
| 
 | |
| #include <LibGUI/GListView.h>
 | |
| #include <LibGUI/GWidget.h>
 | |
| 
 | |
| class GButton;
 | |
| class GTextEditor;
 | |
| 
 | |
| class GComboBox : public GWidget {
 | |
|     C_OBJECT(GComboBox)
 | |
| public:
 | |
|     explicit GComboBox(GWidget* parent = nullptr);
 | |
|     virtual ~GComboBox() override;
 | |
| 
 | |
|     String text() const;
 | |
|     void set_text(const String&);
 | |
| 
 | |
|     void open();
 | |
|     void close();
 | |
|     void select_all();
 | |
| 
 | |
|     GModel* model() { return m_list_view->model(); }
 | |
|     const GModel* model() const { return m_list_view->model(); }
 | |
|     void set_model(NonnullRefPtr<GModel>);
 | |
| 
 | |
|     bool only_allow_values_from_model() const { return m_only_allow_values_from_model; }
 | |
|     void set_only_allow_values_from_model(bool);
 | |
| 
 | |
|     Function<void(const String&)> on_change;
 | |
|     Function<void()> on_return_pressed;
 | |
| 
 | |
| protected:
 | |
|     virtual void resize_event(GResizeEvent&) override;
 | |
| 
 | |
| private:
 | |
|     GTextEditor* m_editor { nullptr };
 | |
|     GButton* m_open_button { nullptr };
 | |
|     GWindow* m_list_window { nullptr };
 | |
|     GListView* m_list_view { nullptr };
 | |
|     bool m_only_allow_values_from_model { false };
 | |
| };
 |