Bonobo API Reference Manual | |||
---|---|---|---|
<<< Previous Page | Home | Up | Next Page >>> |
struct BonoboUIEngine; typedef BonoboUIEngineClass; enum BonoboUIError; |
"add-hint" void user_function ( |
The Bonobo UI code as exposed through the
The Engine can be tweaked by getting its pointer from an associated BonoboWindow eg. this can be useful for setting the configuration path. To allow a BonoboWindow to be configurable you need to do:
Example 1. How to make your UI user configurable
bonobo_ui_engine_config_set_path ( bonobo_window_get_ui_engine (win), "/my-application-name/UIConfig/kvps"); |
Key value pairs (kvps) are stored in this, mangled into a comma delimited string and these are used to clobber the XML on merges, eg.
inside your ~/.gnome/my-application-name file, will ensure that whenever the item with path '/Toolbar' is modified the 'look="both"' attribute will be stamped onto it, effecively forcing a certain look.typedef struct { GtkObjectClass parent_class; /* Signals */ void (*add_hint) (BonoboUIEngine *engine, const char *str); void (*remove_hint) (BonoboUIEngine *engine); void (*emit_verb_on) (BonoboUIEngine *engine, BonoboUINode *node); void (*emit_event_on) (BonoboUIEngine *engine, BonoboUINode *node, const char *state); } BonoboUIEngineClass; |
typedef enum { BONOBO_UI_ERROR_OK = 0, BONOBO_UI_ERROR_BAD_PARAM, BONOBO_UI_ERROR_INVALID_PATH, BONOBO_UI_ERROR_INVALID_XML } BonoboUIError; |
|
Construct a new bonobo_ui_engine
engine : | the engine. |
Returns : | the constructed engine. |
|
Create a new
Returns : | the new UI Engine. |
void bonobo_ui_engine_config_set_path ( |
engine : | |
path : |
|
const char* bonobo_ui_engine_config_get_path ( |
engine : | |
Returns : |
|
void bonobo_ui_engine_add_sync ( |
Add a
engine : | the enginer |
sync : | the synchronizer |
void bonobo_ui_engine_remove_sync ( |
Remove a specified
engine : | the engine |
sync : | the sync |
|
Retrieve a list of available synchronizers.
engine : | the engine |
Returns : | a GSList of |
void bonobo_ui_engine_update ( |
This function is called to update the entire UI model synchronizing any changes in it with the widget tree where neccessary
engine : | the engine. |
void bonobo_ui_engine_update_node ( |
This function is used to write recursive synchronizers and is intended only for internal / privilaged use.
engine : | the engine |
node : | the node to start updating. |
void bonobo_ui_engine_queue_update ( |
This function is used to queue a state update on widget, essentialy transfering any state from the XML model into the widget view. This is queued to avoid re-enterancy problems.
engine : | the engine |
widget : | the widget to update later |
node : | the node |
cmd_node : | the associated command's node |
|
A helper function for synchronizers, this creates a control if possible from the node's associated object, stamps the node as containing a control and sets its widget.
engine : | the engine |
node : | the control node. |
Returns : | a Control's GtkWidget. |
BonoboUINode* bonobo_ui_engine_widget_get_node ( |
accesses a widget's associated node.
widget : | the widget |
Returns : | the BonoboUINode associated with this widget |
void bonobo_ui_engine_widget_set_node ( |
Used internaly to associate a widget with a node, some synchronisers need to be able to execute code on widget creation.
engine : | the engine |
widget : | the widget |
node : | the node |
void bonobo_ui_engine_prune_widget_info ( |
This function destroys any widgets associated with node and all its children, if save_custom, any widget that is a custom widget ( such as a control ) will be preserved. All widgets flagged ROOT are preserved always.
engine : | the engine |
node : | the node |
save_custom : | whether to save custom widgets |
BonoboUINode* bonobo_ui_engine_get_path ( |
This routine gets a node from the internal XML tree pointed at by path
engine : | the engine. |
path : | the path into the tree |
Returns : | the node. |
void bonobo_ui_engine_dirty_tree ( |
Mark all the node's children as being dirty and needing a re-synch with their widget views.
engine : | the engine |
node : | the node |
void bonobo_ui_engine_clean_tree ( |
This cleans the tree, marking the node and its children as not needing a re-synch with their widget views.
engine : | the engine |
node : | the node |
void bonobo_ui_engine_dump ( |
This is a debugging function mostly for internal and testing use, it dumps the XML tree, including the assoicated, and overridden nodes in a wierd hackish format to the out stream with the helpful msg prepended.
engine : | the engine |
out : | the FILE stream to dump to |
msg : | user visible message |
|
engine : | the engine |
node : | the node |
Returns : | the CORBA_Object associated with a node |
|
accesses the node's dirty flag.
engine : | the engine |
node : | the node |
Returns : | whether the node is marked dirty |
|
Gets the widget associated with node
engine : | the engine |
node : | the node |
Returns : | the widget |
const char* bonobo_ui_engine_node_get_id ( |
Each component has an associated textual id or name - see bonobo_ui_engine_register_component
engine : | the engine |
node : | the node |
Returns : | the component id associated with the node |
BonoboUINode* bonobo_ui_engine_get_cmd_node ( |
This function seeks the command node associated with from_node in engine 's internal tree.
engine : | the engine |
from_node : | the node |
Returns : | the command node or NULL |
void bonobo_ui_engine_node_set_dirty ( |
Set node s dirty bit to dirty.
engine : | the engine |
node : | the node |
dirty : | whether the node should be dirty. |
void bonobo_ui_engine_stamp_custom ( |
Marks a node as containing a custom widget.
engine : | the engine |
node : | the node |
void bonobo_ui_engine_stamp_root ( |
This stamps node with widget which is marked as being a ROOT node, so the engine will never destroy it.
engine : | the engine |
node : | the node |
widget : | the root widget |
void bonobo_ui_engine_add_hint ( |
This fires the 'add_hint' signal.
engine : | the engine |
str : | the hint string |
void bonobo_ui_engine_remove_hint ( |
This fires the 'remove_hint' signal
engine : | the engine |
void bonobo_ui_engine_emit_verb_on ( |
This fires the 'emit_verb' signal
engine : | the engine |
node : | the node |
void bonobo_ui_engine_emit_event_on ( |
This fires the 'emit_event_on' signal
engine : | the engine |
node : | the node |
state : | the new state of the node |
void bonobo_ui_engine_emit_verb_on_w ( |
This function looks up the node from widget and emits the 'emit_verb_on' signal on that node.
engine : | the engine |
widget : | the widget |
void bonobo_ui_engine_emit_event_on_w ( |
This function looks up the node from widget and emits the 'emit_event_on' signal on that node passint state as the new state.
engine : | the engine |
widget : | the widget |
state : | the new state |
char* bonobo_ui_engine_get_attr (BonoboUINode *node, BonoboUINode *cmd_node, const char *attr); |
This function is used to get node attributes in many UI synchronizers, it first attempts to get the attribute from node, and if this fails falls back to cmd_node.
node : | the node |
cmd_node : | the command's node |
attr : | the attribute name |
Returns : | the attr or NULL if it doesn't exist. |
void bonobo_ui_engine_widget_attach_node ( |
Associate node with widget
widget : | the widget |
node : | the node |
void bonobo_ui_engine_deregister_dead_components ( |
Detect any components that have died and deregister them - unmerging their UI elements.
engine : | the engine |
void bonobo_ui_engine_deregister_component_by_ref ( |
Deregisters component with reference ref from engine.
engine : | the engine |
ref : | the ref. |
void bonobo_ui_engine_deregister_component ( |
Deregisters component of name from engine.
engine : | the engine |
name : | the component name |
void bonobo_ui_engine_register_component ( |
Registers component with engine by name.
engine : | the engine |
name : | a name to associate a component with |
component : | the component |
|
accesses the node's component names.
engine : | the engine |
Returns : | the names of all registered components |
|
accesses the components associated with the engine.
engine : | the engine |
name : | the name of the component to fetch |
Returns : | the component with name name |
|
This function fetches the node at path in the internal structure, and if node_only dumps the node to an XML string, otherwise it dumps it and its children.
engine : | the engine |
path : | the path into the tree |
node_only : | just the node, or children too. |
Returns : | the XML string - use bonobo_ui_node_free_string to free |
|
engine : | the engine |
path : | the path into the tree |
Returns : | true if the node at path exists |
BonoboUIError bonobo_ui_engine_xml_merge_tree ( |
This function merges the XML tree into the internal tree representation as children of the node at path in engine.
engine : | the engine |
path : | the path into the tree |
tree : | the nodes |
component : | the component ID associated with these nodes. |
Returns : | flag on error |
BonoboUIError bonobo_ui_engine_xml_rm ( |
Remove a chunk of the xml tree pointed at by path in engine, if by_component then only remove items associated with that component - possibly revealing other overridden items.
engine : | the engine |
path : | the path into the tree |
by_component : | whether to remove elements from only a specific component |
Returns : | flag on error |
BonoboUIError bonobo_ui_engine_object_set ( |
This associates a CORBA Object reference with a node in the tree, most often this is done to insert a Control's reference into a 'control' element.
engine : | the engine |
path : | the path into the tree |
object : | an object reference |
ev : | CORBA exception environment |
Returns : | flag if success |
BonoboUIError bonobo_ui_engine_object_get ( |
This extracts a CORBA object reference associated with the node at path in engine, and returns it in the reference pointed to by object.
engine : | the engine |
path : | the path into the tree |
object : | an pointer to an object reference |
ev : | CORBA exception environment |
Returns : | flag if success |
void bonobo_ui_engine_set_ui_container ( |
Associates a given UI Container with this BonoboUIEngine.
engine : | the engine |
ui_container : | a UI Container bonobo object. |
void bonobo_ui_engine_freeze ( |
This increments the freeze count on the tree, while this count > 0 no syncronization between the internal XML model and the widget views occurs. This means that many simple merges can be glupped together with little performance impact and overhead.
engine : | the engine |
void bonobo_ui_engine_thaw ( |
This decrements the freeze count and if it is 0 causes the UI widgets to be re-synched with the XML model, see also bonobo_ui_engine_freeze
engine : | the engine |