mirror of
				https://github.com/RGBCube/serenity
				synced 2025-10-31 00:22:43 +00:00 
			
		
		
		
	 73fdbba59c
			
		
	
	
		73fdbba59c
		
	
	
	
	
		
			
			This was a workaround to be able to build on case-insensitive file systems where it might get confused about <string.h> vs <String.h>. Let's just not support building that way, so String.h can have an objectively nicer name. :^)
		
			
				
	
	
		
			34 lines
		
	
	
	
		
			882 B
		
	
	
	
		
			C++
		
	
	
	
	
	
			
		
		
	
	
			34 lines
		
	
	
	
		
			882 B
		
	
	
	
		
			C++
		
	
	
	
	
	
| #pragma once
 | |
| 
 | |
| #include <AK/String.h>
 | |
| #include <AK/Function.h>
 | |
| #include <LibGUI/GVariant.h>
 | |
| 
 | |
| class GWidget;
 | |
| class VBWidget;
 | |
| 
 | |
| class VBProperty {
 | |
|     friend class VBWidget;
 | |
| 
 | |
| public:
 | |
|     VBProperty(VBWidget&, const String& name, const GVariant& value);
 | |
|     VBProperty(VBWidget&, const String& name, Function<GVariant(const GWidget&)>&& getter, Function<void(GWidget&, const GVariant&)>&& setter);
 | |
|     ~VBProperty();
 | |
| 
 | |
|     String name() const { return m_name; }
 | |
|     const GVariant& value() const { return m_value; }
 | |
|     void set_value(const GVariant&);
 | |
| 
 | |
|     bool is_readonly() const { return m_readonly; }
 | |
|     void set_readonly(bool b) { m_readonly = b; }
 | |
| 
 | |
|     void sync();
 | |
| 
 | |
| private:
 | |
|     VBWidget& m_widget;
 | |
|     String m_name;
 | |
|     GVariant m_value;
 | |
|     Function<GVariant(const GWidget&)> m_getter;
 | |
|     Function<void(GWidget&, const GVariant&)> m_setter;
 | |
|     bool m_readonly { false };
 | |
| };
 |