PNTK
Public Member Functions | Static Public Member Functions | Public Attributes | Friends | List of all members
pntk::gui_widget Class Reference

#include <gui_widget.h>

Inheritance diagram for pntk::gui_widget:
pntk::gui_object pntk::gui_button pntk::gui_canvas pntk::gui_container pntk::gui_label pntk::gui_scrollbar pntk::gui_separator pntk::gui_spacer pntk::gui_staticimage pntk::gui_textbox pntk::gui_tool pntk::gui_toolbar pntk::gui_widget_with_items pntk::gui_widget_with_toggle

Public Member Functions

virtual void init (bool visible=true)
 
virtual void set_configuration (gui_configuration &configuration)
 
virtual gui_configuration get_configuration ()
 
virtual void set_position (gui_point pos)
 
virtual void set_actual_position (gui_point pos)
 
gui_point get_position ()
 
gui_point get_actual_position ()
 
gui_point get_screen_position ()
 
virtual void set_size (gui_size size)
 
virtual void set_actual_size (gui_size size)
 
virtual gui_size get_size ()
 
gui_size get_actual_size ()
 
virtual gui_size get_min_size ()
 
virtual gui_size get_actual_min_size ()
 
virtual void show (bool state)
 
virtual bool is_owned ()
 
virtual void set_border (int border)
 
virtual int get_border ()
 
virtual void set_border_style (int style)
 
virtual int get_border_style ()
 
virtual void set_weight (int weight)
 
virtual int get_weight ()
 
virtual void set_alignment (int alignment)
 
virtual int get_alignment ()
 
virtual void set_style (int style)
 
virtual int get_style ()
 
virtual void set_font (gui_font *font)
 
virtual gui_fontget_font ()
 
virtual void set_system_cursor (gui_system_cursors cursor)
 
virtual gui_widgetget_parent ()
 
gui_widgetget_sibling (bool next)
 
gui_widgetget_sequential (bool next, bool wrap=false)
 
virtual void reparent (gui_widget *parent)
 
virtual bool is_container ()
 
virtual native_widget get_native_widget ()
 
virtual std::string get_self_name ()
 
virtual widget_types get_self_type ()
 
virtual void set_bg_color (gui_color color)
 
virtual void set_fg_color (gui_color color)
 
virtual gui_color get_bg_color ()
 
virtual gui_color get_fg_color ()
 
virtual void set_label (const std::string &text)
 
virtual std::string get_label ()
 
virtual void set_enabled (bool state)
 
virtual bool get_enabled ()
 
virtual bool is_visible ()
 
virtual bool is_ok ()
 
virtual void refresh (int flags=0, const gui_rect *area=nullptr)
 
gui_extra_data & get_extra_data ()
 
virtual void set_focus ()
 
virtual bool has_focus ()
 
void set_default ()
 
gui_size bound_by_requested (gui_size size)
 
void feed_mouse (int base_event, int events, bool &veto, gui_point cursor, int button)
 
virtual void set_tooltip (std::string label)
 
virtual std::string get_tooltip ()
 
virtual void __internal_set_size (gui_size size, bool propagate_to_os=true)
 
virtual void __internal_set_actual_size (gui_size size, bool propagate_to_os=true)
 
virtual void __internal_set_os_actual (gui_size size)
 
- Public Member Functions inherited from pntk::gui_object
void set_data (void *user_data)
 
void * get_data ()
 
virtual void connect (gui_event_listener *call_back, void *data=nullptr, bool managed=false)
 
virtual void disconnect (gui_event_listener *call_back, void *data=nullptr)
 
pntk::gui_listener_chain__internal_disconnect (pntk::gui_listener_chain *matching_chain)
 

Static Public Member Functions

static void get_widget_geometry (int alignment, gui_point base, gui_size max, gui_point &child_pos, gui_size &child_size)
 

Public Attributes

gui_fontfont
 
gui_system_cursors system_cursor
 
gui_size requested_size
 
gui_size extent
 
gui_extra_data extra_data
 

Friends

class gui_sizer_component
 
class sizer_component_fixed
 
class sizer_component_grid
 
class sizer_component_flex_grid
 
class sizer_component_horizontal
 
class sizer_component_vertical
 
class gui_sizer
 

Additional Inherited Members

- Public Types inherited from pntk::gui_object
typedef std::map< gui_object *, gui_listener_chain * > event_map
 
- Static Public Attributes inherited from pntk::gui_object
static event_map windowing_events
 

Detailed Description

An abstract foundational widget from which all widgets must inherit.

Member Function Documentation

◆ bound_by_requested()

gui_size pntk::gui_widget::bound_by_requested ( gui_size  size)

Takes a size value and returns a version of that size that is within the minimum/maximum size requested by the user.

◆ feed_mouse()

void pntk::gui_widget::feed_mouse ( int  base_event,
int  events,
bool &  veto,
gui_point  cursor,
int  button 
)

Feed raw mouse events into this function to automatically handle propogation of specific events.

◆ get_actual_min_size()

virtual gui_size pntk::gui_widget::get_actual_min_size ( )
virtual

◆ get_actual_position()

gui_point pntk::gui_widget::get_actual_position ( )

Returns the position of the widget within its container (ignoring all border padding).

◆ get_actual_size()

gui_size pntk::gui_widget::get_actual_size ( )

Returns the extent of the widget (ignoring the border padding).

◆ get_alignment()

virtual int pntk::gui_widget::get_alignment ( )
virtual

Returns the alignment value of the widget.

◆ get_bg_color()

virtual gui_color pntk::gui_widget::get_bg_color ( )
virtual

Returns the widgets background color.

◆ get_border()

virtual int pntk::gui_widget::get_border ( )
virtual

Returns the border/padding size of the widget.

◆ get_border_style()

virtual int pntk::gui_widget::get_border_style ( )
virtual

Returns the current border style of the widget.

Reimplemented in pntk::gui_sizer.

◆ get_enabled()

virtual bool pntk::gui_widget::get_enabled ( )
virtual

Returns if the widget is enabled.

◆ get_extra_data()

gui_extra_data& pntk::gui_widget::get_extra_data ( )

Returns a gui_extra_data structure for this widget.

◆ get_fg_color()

virtual gui_color pntk::gui_widget::get_fg_color ( )
virtual

Returns the widgets foreground color.

◆ get_font()

virtual gui_font* pntk::gui_widget::get_font ( )
virtual

Returns the widgets font.

◆ get_label()

virtual std::string pntk::gui_widget::get_label ( )
virtual

◆ get_min_size()

virtual gui_size pntk::gui_widget::get_min_size ( )
virtual

Returns minimum size of the widget (including all border padding).

Reimplemented in pntk::gui_sizer, and pntk::gui_custom.

◆ get_native_widget()

virtual native_widget pntk::gui_widget::get_native_widget ( )
virtual

Returns the underlaying native widget implementation.

◆ get_parent()

virtual gui_widget* pntk::gui_widget::get_parent ( )
virtual

Returns the widgets parent if it has one.

◆ get_position()

gui_point pntk::gui_widget::get_position ( )

Returns the position of the widget within its container (including all border padding).

◆ get_screen_position()

gui_point pntk::gui_widget::get_screen_position ( )

Returns the position of the widget within the screen.

◆ get_self_name()

virtual std::string pntk::gui_widget::get_self_name ( )
virtual

◆ get_self_type()

virtual widget_types pntk::gui_widget::get_self_type ( )
virtual

◆ get_sequential()

gui_widget* pntk::gui_widget::get_sequential ( bool  next,
bool  wrap = false 
)

Returns the next/previous (based on next) widget from the sequence of them in the window if there is one. Specify true for wrap to wrap around and thus always return a value.

◆ get_sibling()

gui_widget* pntk::gui_widget::get_sibling ( bool  next)

Returns the widgets next/previous sibling if it has one.

◆ get_size()

virtual gui_size pntk::gui_widget::get_size ( )
virtual

Returns the extent of the widget (including all border padding).

Reimplemented in pntk::gui_container, and pntk::gui_sizer.

◆ get_style()

virtual int pntk::gui_widget::get_style ( )
virtual

Returns the widgets style flag.

◆ get_weight()

virtual int pntk::gui_widget::get_weight ( )
virtual

Returns the widgets weight/scale factor.

◆ get_widget_geometry()

static void pntk::gui_widget::get_widget_geometry ( int  alignment,
gui_point  base,
gui_size  max,
gui_point child_pos,
gui_size child_size 
)
static

Calculates the width, height, and position of the given alignment, the offset as base, the @ max size, the current child_pos and then minimum child_size.

◆ has_focus()

virtual bool pntk::gui_widget::has_focus ( )
virtual

Returns a boolean that indicates if this widget has the keyboard focus.

Reimplemented in pntk::gui_graphic_listbox, pntk::gui_dataless_listbox, and pntk::gui_notebook.

◆ init()

virtual void pntk::gui_widget::init ( bool  visible = true)
virtual

Initializes the widget, setting default values to its members.

Reimplemented in pntk::gui_sizer.

◆ is_container()

virtual bool pntk::gui_widget::is_container ( )
virtual

Returns whether or not this widget is a container, or subclassed from container.

Reimplemented in pntk::gui_container.

◆ is_ok()

virtual bool pntk::gui_widget::is_ok ( )
virtual

Returns a boolean that represents the state of the internal native widget. If the native widget is instantiated correctly, this is true, false otherwise.

◆ is_owned()

virtual bool pntk::gui_widget::is_owned ( )
virtual

Returns whether or not the widget has a parent.

◆ is_visible()

virtual bool pntk::gui_widget::is_visible ( )
virtual

Returns if the widget is visible.

◆ refresh()

virtual void pntk::gui_widget::refresh ( int  flags = 0,
const gui_rect area = nullptr 
)
virtual

Forces the window to repaint.

Reimplemented in pntk::gui_custom.

◆ reparent()

virtual void pntk::gui_widget::reparent ( gui_widget parent)
virtual

Removed the widget from its current parent container and puts it in the given parent container with the same alignment and size requests.

◆ set_actual_position()

virtual void pntk::gui_widget::set_actual_position ( gui_point  pos)
virtual

Sets the position (top left corner) of the widget (ignoring all border padding) within its container to the given pos.

◆ set_actual_size()

virtual void pntk::gui_widget::set_actual_size ( gui_size  size)
virtual

Sets the extent of the widget (not counting the border padding) to the given size.

Reimplemented in pntk::gui_container, and pntk::gui_window.

◆ set_alignment()

virtual void pntk::gui_widget::set_alignment ( int  alignment)
virtual

Sets the widgets alignment (if it has a parent) to the given alignment value. Alignments include GUI_ALIGN_RIGHT, GUI_ALIGN_LEFT, GUI_ALIGN_TOP, GUI_ALIGN_BOTTOM, GUI_ALIGN_CENTER_H, GUI_ALIGN_CENTER_V, GUI_EXPAND_H, GUI_EXPAND_V

◆ set_bg_color()

virtual void pntk::gui_widget::set_bg_color ( gui_color  color)
virtual

Sets the widgets background to the given color.

Reimplemented in pntk::gui_graphic_listbox, and pntk::gui_dataless_listbox.

◆ set_border()

virtual void pntk::gui_widget::set_border ( int  border)
virtual

Sets the border/padding size of the widget.

◆ set_border_style()

virtual void pntk::gui_widget::set_border_style ( int  style)
virtual

Sets the border/padding style of the widget. Styles include GUI_BORDER_NONE, GUI_BORDER_TOP, GUI_BORDER_BOTTOM, GUI_BORDER_LEFT, GUI_BORDER_RIGHT, GUI_BORDER_ALL

◆ set_default()

void pntk::gui_widget::set_default ( )

Sets this widget as the default widget that is activated when the user presses Enter on the window.

◆ set_enabled()

virtual void pntk::gui_widget::set_enabled ( bool  state)
virtual

Sets enabled state of the widget to the given state

◆ set_fg_color()

virtual void pntk::gui_widget::set_fg_color ( gui_color  color)
virtual

Sets the widgets foreground to the given color.

Reimplemented in pntk::gui_graphic_listbox, and pntk::gui_dataless_listbox.

◆ set_focus()

virtual void pntk::gui_widget::set_focus ( )
virtual

Sets the keyboard focus to this widget if it is a focusable widget.

Reimplemented in pntk::gui_graphic_listbox, pntk::gui_dataless_listbox, and pntk::gui_notebook.

◆ set_font()

virtual void pntk::gui_widget::set_font ( gui_font font)
virtual

Sets the widgets font.

Reimplemented in pntk::gui_custom.

◆ set_label()

virtual void pntk::gui_widget::set_label ( const std::string &  text)
virtual

◆ set_position()

virtual void pntk::gui_widget::set_position ( gui_point  pos)
virtual

Sets the position (top left corner) of the widget (including all border padding) within its container to the given pos.

Reimplemented in pntk::gui_window.

◆ set_size()

virtual void pntk::gui_widget::set_size ( gui_size  size)
virtual

Sets the extent of the widget (including all border padding) to the given size.

◆ set_style()

virtual void pntk::gui_widget::set_style ( int  style)
virtual

◆ set_system_cursor()

virtual void pntk::gui_widget::set_system_cursor ( gui_system_cursors  cursor)
virtual

Sets the widgets system cursor.

◆ set_weight()

virtual void pntk::gui_widget::set_weight ( int  weight)
virtual

Sets the widgets weight/scale factor (if it has a parent) to the given weight

◆ show()

virtual void pntk::gui_widget::show ( bool  state)
virtual

Sets visibility of the widget to the given state


The documentation for this class was generated from the following file: