Class: Wx::PersistentObject

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

Overview

Base class for persistent object adapters.

See Persistent Objects Overview for an overview of persistent objects within wxWidgets. wxWidgets persistence framework is non-intrusive, i.e. can work with the classes which have no relationship to nor knowledge of it. To allow this, an intermediate persistence adapter is used: this is just a simple object which provides the methods used by PersistenceManager to save and restore the object properties and implements them using the concrete class methods. You may derive your own classes from PersistentObject to implement persistence support for your common classes, see Defining Custom Persistent Windows.

See Also:

  • wxPersistentWindow<>

Requires:

  • USE_CONFIG

Direct Known Subclasses

PersistentWindowBase

Instance Method Summary collapse

Instance Method Details

#get_kindString Also known as: kind

Returns the string uniquely identifying the objects supported by this adapter.

This method is called from #save_value and #restore_value and normally returns some short (but not too cryptic) strings, e.g. "Checkbox".

Returns:

  • (String)


36
# File 'lib/wx/doc/gen/persistent_object.rb', line 36

def get_kind; end

#get_nameString Also known as: name

Returns the string uniquely identifying the object we’re associated with among all the other objects of the same type.

This method is used together with #get_kind to construct the unique full name of the object in e.g. a configuration file.

Returns:

  • (String)


43
# File 'lib/wx/doc/gen/persistent_object.rb', line 43

def get_name; end

#restoreBoolean

Restore the object properties.

The implementation of this method should use #restore_value.

Returns:

  • (Boolean)


30
# File 'lib/wx/doc/gen/persistent_object.rb', line 30

def restore; end

#restore_value(name) ⇒ Object? (protected)

Restore a value saved by #save_value.

Parameters:

  • name (String)

    The name of the value in the configuration file.

Returns:

  • (Object, nil)

    The value if successfully read, nil otherwise



22
# File 'lib/wx/doc/persistent_object.rb', line 22

def restore_value(name); end

#savevoid

This method returns an undefined value.

Save the object properties.

The implementation of this method should use #save_value.



24
# File 'lib/wx/doc/gen/persistent_object.rb', line 24

def save; end

#save_value(name, value) ⇒ Boolean (protected)

Save the specified value using the given name.

Parameters:

  • name (String)

    The name of the value in the configuration file.

  • value (::Object)

    The value to save, currently must be a type supported by wxConfig.

Returns:

  • (Boolean)

    true if the value was saved or false if an error occurred.



16
# File 'lib/wx/doc/persistent_object.rb', line 16

def save_value(name, value); end