Class: Wx::PersistenceManager

Inherits:
Object
  • Object
show all
Defined in:
lib/wx/doc/gen/persistence_manager.rb

Overview

Provides support for automatically saving and restoring object properties to persistent storage.

This class is the central element of wxWidgets persistence framework, see Persistent Objects Overview for its overview. This is a singleton class and its unique instance can be retrieved using PersistenceManager.get method.

Requires:

  • USE_CONFIG

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeWx::PersistenceManager (protected)

Protected default constructor.

This constructor is only provided for the derived classes, to use an object of this class static get method should be called.



113
# File 'lib/wx/doc/gen/persistence_manager.rb', line 113

def initialize; end

Class Method Details

.getWx::PersistenceManager

Returns the unique persistence manager object.

If set hadn’t been called before, a default persistence manager implementation is returned.



39
# File 'lib/wx/doc/gen/persistence_manager.rb', line 39

def self.get; end

.set(manager) ⇒ void

This method returns an undefined value.

Set the global persistence manager to use.

Call this method to specify a non-default persistence manager to use. It should usually be called very early (e.g. in App-derived class constructor or in the beginning of overridden App#on_init) to affect creation of all persistent controls and the object passed to it must have a lifetime long enough to be still alive when the persistent controls are destroyed and need it to save their state so typically this would be a global or a App member.

Parameters:



33
# File 'lib/wx/doc/gen/persistence_manager.rb', line 33

def self.set(manager) end

Instance Method Details

#disable_restoringvoid

This method returns an undefined value.

Globally disable restoring the persistence object properties.

By default, restoring properties in #restore is enabled but this function allows disabling it. This is mostly useful for testing.

See Also:



53
# File 'lib/wx/doc/gen/persistence_manager.rb', line 53

def disable_restoring; end

#disable_savingvoid

This method returns an undefined value.

Globally disable saving the persistence object properties.

By default, saving properties in #save is enabled but the program may wish to disable if, for example, it detects that it is running on a system which shouldn’t be modified in any way and so configuration file (or Windows registry) shouldn’t be written to.

See Also:



46
# File 'lib/wx/doc/gen/persistence_manager.rb', line 46

def disable_saving; end

#find(obj) ⇒ Wx::PersistentObject

Check if the object is registered and return the associated Wx::PersistentObject if it is or NULL otherwise.

Parameters:

Returns:



74
# File 'lib/wx/doc/gen/persistence_manager.rb', line 74

def find(obj) end

#get_configWx::ConfigBase (protected) Also known as: config

Return the config object to use.

By default the global Config, returned by ConfigBase#get, is used but a derived class could override this function to return a different one if necessary.

Returns:



119
# File 'lib/wx/doc/gen/persistence_manager.rb', line 119

def get_config; end

#get_key(who, name) ⇒ String (protected) Also known as: key

Return the path to use for saving the setting with the given name for the specified object.

Notice that the name argument is the name of the setting, not the name of the object itself which can be retrieved with its GetName() method. This method can be overridden by a derived class to change where in Config the different options are stored. By default, all settings of the persistent controls are stored under “Persistent_Options” group and grouped by control type (e.g. “Window” for top level windows or “Splitter”) and name, so that the position of a splitter called “sep” could be stored under “Persistent_Options/Splitter/sep/Position” key.

Parameters:

Returns:

  • (String)


129
# File 'lib/wx/doc/gen/persistence_manager.rb', line 129

def get_key(who, name) end

#register(obj) ⇒ Wx::PersistentObject #register(obj, po) ⇒ Wx::PersistentObject

Overloads:

  • #register(obj) ⇒ Wx::PersistentObject

    Register an object with the manager automatically creating a persistence adapter for it.

    This is equivalent to calling Register(void , wxPersistentObject ) with create_persistent_object(obj) as the second argument.

    Parameters:

    Returns:

  • #register(obj, po) ⇒ Wx::PersistentObject

    Register an object with the manager.

    Note that registering the object doesn’t do anything except allowing to call #restore for it later. If you want to register the object and restore its properties, use #register_and_restore. The manager takes ownership of po and will delete it when it is unregistered.

    Parameters:

    Returns:



69
# File 'lib/wx/doc/gen/persistence_manager.rb', line 69

def register(*args) end

#register_and_restore(obj) ⇒ Boolean #register_and_restore(obj, po) ⇒ Boolean

Overloads:



26
# File 'lib/wx/doc/gen/persistence_manager.rb', line 26

def register_and_restore(*args) end

#restore(obj) ⇒ Boolean

Restore the object properties previously saved by #save.

This method does nothing if #disable_restoring had been called.

true if the object properties were restored or false if nothing was found to restore or the saved settings were invalid.

Parameters:

Returns:

  • (Boolean)

See Also:



99
# File 'lib/wx/doc/gen/persistence_manager.rb', line 99

def restore(obj) end

#save(obj) ⇒ void

This method returns an undefined value.

Save the object properties to persistent storage.

This method does nothing if #disable_saving had been called.

Parameters:

See Also:



89
# File 'lib/wx/doc/gen/persistence_manager.rb', line 89

def save(obj) end

#save_and_unregister(obj) ⇒ void

This method returns an undefined value.

Combines both #save and #unregister calls.

Parameters:



104
# File 'lib/wx/doc/gen/persistence_manager.rb', line 104

def save_and_unregister(obj) end

#unregister(obj) ⇒ void

This method returns an undefined value.

Unregister the object and delete the associated Wx::PersistentObject.

For the persistent windows this is done automatically (via #save_and_unregister) when the window is destroyed so you only need to call this function explicitly if you are using custom persistent objects or if you want to prevent the object properties from being saved.

Parameters:



81
# File 'lib/wx/doc/gen/persistence_manager.rb', line 81

def unregister(obj) end