mirror of
				https://github.com/RGBCube/serenity
				synced 2025-10-31 15:22: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.
		
	
			
		
			
				
	
	
		
			34 lines
		
	
	
	
		
			846 B
		
	
	
	
		
			C++
		
	
	
	
	
	
			
		
		
	
	
			34 lines
		
	
	
	
		
			846 B
		
	
	
	
		
			C++
		
	
	
	
	
	
| #pragma once
 | |
| 
 | |
| #include <LibGUI/GAbstractButton.h>
 | |
| 
 | |
| class GRadioButton : public GAbstractButton {
 | |
|     C_OBJECT(GRadioButton)
 | |
| public:
 | |
|     GRadioButton(const StringView& text, GWidget* parent);
 | |
|     virtual ~GRadioButton() override;
 | |
| 
 | |
|     virtual void click() override;
 | |
| 
 | |
| protected:
 | |
|     virtual void paint_event(GPaintEvent&) override;
 | |
| 
 | |
| private:
 | |
|     // These don't make sense for a radio button, so hide them.
 | |
|     using GAbstractButton::auto_repeat_interval;
 | |
|     using GAbstractButton::set_auto_repeat_interval;
 | |
| 
 | |
|     virtual bool is_radio_button() const final { return true; }
 | |
| 
 | |
|     template<typename Callback>
 | |
|     void for_each_in_group(Callback);
 | |
|     static Size circle_size();
 | |
| };
 | |
| 
 | |
| template<>
 | |
| inline bool is<GRadioButton>(const CObject& object)
 | |
| {
 | |
|     if (!is<GWidget>(object))
 | |
|         return false;
 | |
|     return to<GWidget>(object).is_radio_button();
 | |
| }
 |