![]() |
DI-Guy SDK Documentation
13.8
|
#include <diguyViewButtonPanel.h>
Public Member Functions | |
| const char * | get_name () |
| Returns the name of the object. More... | |
| int | get_position (int *ret_x, int *ret_y) |
| Returns the x and y coordinate of the panel. More... | |
| int | get_width () |
| Returns the width of the panel. More... | |
| int | get_height () |
| Returns the height of the panel. More... | |
| int | set_visible (int visible) |
| Makes button panel visible or invisible. More... | |
| int | set_minimized_state (int minimized) |
| Makes button panel minimized (or un-minimized). More... | |
| int | set_position (int x, int y) |
| Sets the position of the panel in its parent window. More... | |
| int | set_dimensions (int w, int h) |
| Sets the desired dimensions of the panel. More... | |
| int | set_depth (int z) |
| Sets the desired z depth of the panel. More... | |
| int | set_justifications (int h, int v) |
| Sets the horizontal/vertical justifications of the panel (see description in set_position()). More... | |
| int | set_spacing (int spacing) |
| Sets the spacing between items in panel. More... | |
| int | set_title (const char *title) |
| Sets the display title of the panel. More... | |
| int | add_button (const char *name, const char *lua_object_name, const char *lua_function_name, const char *style_sheet=NULL) |
| Adds a button to the panel and specifies the lua script that should be run upon press. More... | |
| int | add_button_with_script (const char *name, const char *script, const char *style_sheet=NULL) |
| Adds a button to the panel and specifies the lua script that should be run upon press. More... | |
| int | set_button_name (int index, const char *name) |
| Sets the name (text) of button at index n (zero-indexed). More... | |
| int | set_allow_toggle (int index, int can_toggle) |
| Sets whether or not the specified button will be a toggle button. More... | |
| int | set_selected_button (int index) |
| Sets the specified button to be the "selected" one within the panel. More... | |
| int | set_selected_button_by_name (const char *name) |
| Similar to set_selected_button(), but using button name (text). More... | |
| int | add_int_slider (const char *name, const char *lua_object_name, const char *lua_function_name, int init_val, int min_val, int max_val, const char *style_sheet=NULL) |
| Adds an integer slider to the panel and specifies the lua script that should be run upon the slider changing value. More... | |
| int | add_float_slider (const char *name, const char *lua_object_name, const char *lua_function_name, float init_val, float min_val, float max_val, const char *style_sheet=NULL) |
| Adds a continuous floating slider to the panel and specifies the lua script that should be run upon the slider changing value. More... | |
| int | set_slider_value (const char *name, float value) |
| Updates specified slider with the value specified. More... | |
| int | add_spacer (int pixels) |
| Adds a vertical or horizontal spacer element. More... | |
| void | set_item_visibility (int index, bool visible) |
| Change visibility of item specified by index. More... | |
| void | remove_all_items () |
| Clears all items out of panel. More... | |
| void | set_open_script (const char *lua_script) |
| Sets a Lua script to be called when panel is opened (un-minimized). More... | |
| void | set_minimize_script (const char *lua_script) |
| Sets a Lua script to be called when panel is opened (un-minimized). More... | |
| int | set_style_sheet (const char *sheet) |
| Passes a Qt style sheet to the panel. More... | |
Static Public Member Functions | |
| static diguyViewButtonPanel * | find_or_create_instance (const char *name, int horizontal=0, int title=1) |
| Returns the named button panel or creates it. More... | |
| static diguyViewButtonPanel * | make_instance (const char *name, int horizontal=0, int title=1) |
| Makes a button panel with the given name and attributes. More... | |
| static diguyViewButtonPanel * | get_instance (const char *name) |
| Returns a pointer to the named button panel, if it exists. More... | |
| static int | destroy_instance (const char *name) |
| Destroys named button panel, if found. More... | |
| static int | destroy_all () |
| Destroys all button panels. More... | |
Private Functions | |
The functions and variables past this point are for internal use only. No external access to them is expected or necessary. | |
| class | bdiViewButtonPanel |
| bdiViewButtonPanel * | m_panel |
| A pointer to internal data. More... | |
| static void | set_create_callback (makeButtonPanelCallback *the_callback) |
| bdiViewButtonPanel * | get_scripted_object () |
| diguyViewButtonPanel (bdiViewButtonPanel *panel) | |
| A private constructor. More... | |
| ~diguyViewButtonPanel () | |
| A private destructor. More... | |
|
private |
A private constructor.
|
private |
A private destructor.
|
static |
Returns the named button panel or creates it.
| name | name of panel (must be unique) |
| horizontal | if 1, make a horizontal panel |
| title | if 1, show panel title |
Returns:
pointer to the button panel
Callable From:
|
static |
Makes a button panel with the given name and attributes.
| name | name of panel (must be unique) |
| horizontal | if 1, make a horizontal panel |
| title | if 1, show panel title |
Returns:
pointer to the button panel
Callable From:
|
static |
Returns a pointer to the named button panel, if it exists.
Otherwise returns NULL.
| name | name of panel |
Returns:
pointer to the button panel or NULL
Callable From:
|
static |
Destroys named button panel, if found.
| name | name of panel |
Returns:
0 on success, -1 on failure
Callable From:
|
static |
Destroys all button panels.
Returns:
0 on success, -1 on failure
Callable From:
| const char* diguyViewButtonPanel::get_name | ( | ) |
Returns the name of the object.
This pointer will never be NULL.
Returns:
name of the object
Callable From:
| int diguyViewButtonPanel::get_position | ( | int * | ret_x, |
| int * | ret_y | ||
| ) |
Returns the x and y coordinate of the panel.
Callable From:
| int diguyViewButtonPanel::get_width | ( | ) |
Returns the width of the panel.
Callable From:
| int diguyViewButtonPanel::get_height | ( | ) |
Returns the height of the panel.
Callable From:
| int diguyViewButtonPanel::set_visible | ( | int | visible | ) |
Makes button panel visible or invisible.
| visible | pass 1 to make visible, 0 to make invisible |
Returns:
0 on success, -1 on failure
Callable From:
| int diguyViewButtonPanel::set_minimized_state | ( | int | minimized | ) |
Makes button panel minimized (or un-minimized).
| visible | pass 1 to make minimized, 0 to make full size |
Returns:
0 on success, -1 on failure
Callable From:
| int diguyViewButtonPanel::set_position | ( | int | x, |
| int | y | ||
| ) |
Sets the position of the panel in its parent window.
Coordinates work differently if panel is right/bottom justified on its x/y (see set_justification()). In that case, the coordinate will imply the position of the panel's right/bottom edge relative to the right/bottom edge of the containing window.
| x | x position, in pixels |
| y | y position, in pixels |
Returns:
0 on success, -1 on failure
Callable From:
| int diguyViewButtonPanel::set_dimensions | ( | int | w, |
| int | h | ||
| ) |
Sets the desired dimensions of the panel.
| w | width, in pixels |
| h | height, in pixels |
Returns:
0 on success, -1 on failure
Callable From:
| int diguyViewButtonPanel::set_depth | ( | int | z | ) |
Sets the desired z depth of the panel.
| z | depth |
Returns:
0 on success, -1 on failure
Callable From:
| int diguyViewButtonPanel::set_justifications | ( | int | h, |
| int | v | ||
| ) |
Sets the horizontal/vertical justifications of the panel (see description in set_position()).
| h | horizontal justification (> 0 for left, 0 for center, < 0 for right) |
| v | vertical justification (> 0 for top, 0 for center, < 0 for bottom) |
Returns:
0 on success, -1 on failure
Callable From:
| int diguyViewButtonPanel::set_spacing | ( | int | spacing | ) |
Sets the spacing between items in panel.
| spacing | spacing in pixels |
Returns:
0 on success, -1 on failure
Callable From:
| int diguyViewButtonPanel::set_title | ( | const char * | title | ) |
Sets the display title of the panel.
| title | text to show |
Returns:
0 on success, -1 on failure
Callable From:
| int diguyViewButtonPanel::add_button | ( | const char * | name, |
| const char * | lua_object_name, | ||
| const char * | lua_function_name, | ||
| const char * | style_sheet = NULL |
||
| ) |
Adds a button to the panel and specifies the lua script that should be run upon press.
| name | text of button |
| lua_object_name | name of lua table containing function to run |
| lua_function_name | name of lua function to run |
| style_sheet | optional css to set on button |
An example style sheet string: "QPushButton {background-color : rgba( 192, 210, 192, 192 ); }"
Returns:
index of the new button (zero-indexed)
Callable From:
| int diguyViewButtonPanel::add_button_with_script | ( | const char * | name, |
| const char * | script, | ||
| const char * | style_sheet = NULL |
||
| ) |
Adds a button to the panel and specifies the lua script that should be run upon press.
| name | text of button |
| script | Lua script to run (the script itself) |
| style_sheet | optional css to set on button |
An example style sheet string: "QPushButton {background-color : rgba( 192, 210, 192, 192 ); }"
Returns:
index of the new button (zero-indexed)
Callable From:
| int diguyViewButtonPanel::set_button_name | ( | int | index, |
| const char * | name | ||
| ) |
Sets the name (text) of button at index n (zero-indexed).
| index | index of button (starting from 0) |
Returns:
0 on success, -1 on failure
Callable From:
| int diguyViewButtonPanel::set_allow_toggle | ( | int | index, |
| int | can_toggle | ||
| ) |
Sets whether or not the specified button will be a toggle button.
A toggle button can be clicked back and forth between an on and off state, whereas a regular button provides only a once-off action.
| index | index of button (starting from 0) |
| can_toggle | true if toggle button |
Returns:
0 on success, -1 on failure
Callable From:
| int diguyViewButtonPanel::set_selected_button | ( | int | index | ) |
Sets the specified button to be the "selected" one within the panel.
The selected button may have a special appearance depending on style sheet. See notes for set_style_sheet().
| index | index of button (starting from 0) |
Returns:
0 on success, -1 on failure
Callable From:
| int diguyViewButtonPanel::set_selected_button_by_name | ( | const char * | name | ) |
Similar to set_selected_button(), but using button name (text).
| name | name (text) of button |
Returns:
0 on success, -1 on failure
Callable From:
| int diguyViewButtonPanel::add_int_slider | ( | const char * | name, |
| const char * | lua_object_name, | ||
| const char * | lua_function_name, | ||
| int | init_val, | ||
| int | min_val, | ||
| int | max_val, | ||
| const char * | style_sheet = NULL |
||
| ) |
Adds an integer slider to the panel and specifies the lua script that should be run upon the slider changing value.
lua function should be:
| name | text of label description |
| lua_object_name | name of lua table containing function to run |
| lua_function_name | name of lua function to run |
Returns:
index of the new slider (zero-indexed)
Callable From:
| int diguyViewButtonPanel::add_float_slider | ( | const char * | name, |
| const char * | lua_object_name, | ||
| const char * | lua_function_name, | ||
| float | init_val, | ||
| float | min_val, | ||
| float | max_val, | ||
| const char * | style_sheet = NULL |
||
| ) |
Adds a continuous floating slider to the panel and specifies the lua script that should be run upon the slider changing value.
lua function should be:
| name | text of label description |
| lua_object_name | name of lua table containing function to run |
| lua_function_name | name of lua function to run |
Returns:
index of the new slider (zero-indexed)
Callable From:
| int diguyViewButtonPanel::set_slider_value | ( | const char * | name, |
| float | value | ||
| ) |
Updates specified slider with the value specified.
| name | name of slider |
| value | value of slider |
| int diguyViewButtonPanel::add_spacer | ( | int | pixels | ) |
Adds a vertical or horizontal spacer element.
| void diguyViewButtonPanel::set_item_visibility | ( | int | index, |
| bool | visible | ||
| ) |
Change visibility of item specified by index.
| void diguyViewButtonPanel::remove_all_items | ( | ) |
Clears all items out of panel.
| void diguyViewButtonPanel::set_open_script | ( | const char * | lua_script | ) |
Sets a Lua script to be called when panel is opened (un-minimized).
| lua_script | the entire script |
| void diguyViewButtonPanel::set_minimize_script | ( | const char * | lua_script | ) |
Sets a Lua script to be called when panel is opened (un-minimized).
| lua_script | the entire script |
| int diguyViewButtonPanel::set_style_sheet | ( | const char * | sheet | ) |
Passes a Qt style sheet to the panel.
Sample one (user must replace "MAIN_BG_COLOR" and other tags with meaningful values):
**
"isSelected" used to set visual properties of selected button
-------------—
Sample two (user must replace "MAIN_BG_COLOR" and other tags with meaningful values):
**
"isToggled" used to set visual properties on button that is toggled on
-------------—
| sheet | the style sheet |
Returns:
0 on success, -1 on failure
Callable From:
|
inline |
|
static |
|
friend |
|
protected |
A pointer to internal data.