mirror of
				https://github.com/ciphervance/supercell-wx.git
				synced 2025-10-31 03:20:05 +00:00 
			
		
		
		
	Add callbacks to settings variables, use to update radar dialog location in settings dialog
This commit is contained in:
		
							parent
							
								
									87f611e026
								
							
						
					
					
						commit
						f7cc902eef
					
				
					 5 changed files with 136 additions and 2 deletions
				
			
		|  | @ -19,6 +19,13 @@ template<class T> | |||
| class SettingsVariable : public SettingsVariableBase | ||||
| { | ||||
| public: | ||||
|    /**
 | ||||
|     * Callback function for when a value changes. | ||||
|     * | ||||
|     * @param value New value | ||||
|     */ | ||||
|    typedef std::function<void(const T& value)> ValueCallbackFunction; | ||||
| 
 | ||||
|    explicit SettingsVariable(const std::string& name); | ||||
|    ~SettingsVariable(); | ||||
| 
 | ||||
|  | @ -173,6 +180,24 @@ public: | |||
|     */ | ||||
|    virtual void WriteValue(boost::json::object& json) const override; | ||||
| 
 | ||||
|    /**
 | ||||
|     * Registers a function to be called when the current value changes. The | ||||
|     * current value is passed to the callback function. | ||||
|     * | ||||
|     * @param callback Function to be called | ||||
|     */ | ||||
|    void RegisterValueChangedCallback(ValueCallbackFunction callback); | ||||
| 
 | ||||
|    /**
 | ||||
|     * Registers a function to be called when the staged value changes (or a | ||||
|     * value is unstaged or committed). The staged value is passed to the | ||||
|     * callback function (or in the case of unstaging or committing, the current | ||||
|     * value). | ||||
|     * | ||||
|     * @param callback Function to be called | ||||
|     */ | ||||
|    void RegisterValueStagedCallback(ValueCallbackFunction callback); | ||||
| 
 | ||||
| protected: | ||||
|    virtual bool Equals(const SettingsVariableBase& o) const override; | ||||
| 
 | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Dan Paulat
						Dan Paulat