GOffice.StyledObject¶
- Implementations:
Methods¶
|
|
|
|
|
|
|
|
|
|
|
|
Virtual Methods¶
None
Properties¶
None
Signals¶
None
Fields¶
None
Class Details¶
- class GOffice.StyledObject¶
- Bases:
- apply_theme(style)¶
- Parameters:
style (
GOffice.Style) – aGOffice.Stylethat will be themed
Apply appropriate theme style if meaningful, i.e. properties with auto flag set to
Trueshould be changed to default themeGOffice.value.
- fill(cr, preserve)¶
- Parameters:
cr (
cairo.Context) –cairo.Contextpreserve (
bool) – whether the current path should be preserved
fills the current path according to the item style and canvas scale.
- get_auto_style()¶
- Returns:
a new
GOffice.Style- Return type:
This function returns a new style that is initialized with the auto values for self. Caller is responsible for the result.
- get_document()¶
- Returns:
the
GOffice.Docassociated with the object if any.- Return type:
GOffice.DocorNone
A
GOffice.Docis necessary to store images. If noGOffice.Docis associated with the object, image filling will not be supported.
- get_style()¶
- Returns:
the styled object’s
GOffice.Style- Return type:
Simply an accessor function that returns self->style, without referencing it.
- set_cairo_line(cr)¶
- Parameters:
cr (
cairo.Context) –cairo.Context- Returns:
Trueif the line is not invisible- Return type:
Prepares the cairo context cr to draw a line according to the item style and canvas scale.
- set_style(style)¶
- Parameters:
style (
GOffice.Style) – aGOffice.Style- Returns:
Trueif new style may lead to change of object size, which happens when changingGOffice.fontsize for example.- Return type:
Sets a new style for self, and emits “style-changed” signal. This function does not take ownership of style.
The best way to change the style is to set the “style” property.
This function will fail if the new style and the previous style are the same. In that case, the function will always return false:
style = go_styled_object_get_style (gso); style->line.width = 2; size_changed = go_styled_object_set_style (gso, style);
In this sample, the call to
GOffice.StyledObject.set_style() is just useless. You need to check yourself if you really change the size, callGOffice.StyledObject.style_changed() to trigger the “style-changed” event. So the following code is much better:style = go_styled_object_get_style (gso); if (style->line.width != 2.) { style->line.width = 2; go_styled_object_style_changed (gso); size_changed = true; } else size_changed = FALSE;or even better:
style = go_style_dup (go_styled_object_get_style (gso)); style->line.width = 2; size_changed = go_styled_object_set_style (gso, style); g_object_unref (style);
- style_changed()¶
Called when the style changed. Might emit a signal if meaningful.