NOCL  v0.1.0-2524
Modern C++ Class Library for GUI Projects
nocl::ButtonBox Class Reference

Container for aligning and sizing buttons the same way. More...

#include <ButtonBox.hpp>

Inheritance diagram for nocl::ButtonBox:
Collaboration diagram for nocl::ButtonBox:

Public Types

enum  ELayout {
  ELayout::kInvalid,
  ELayout::kSpread,
  ELayout::kEdge,
  ELayout::kStart,
  ELayout::kEnd,
  ELayout::kCenter,
  ELayout::kExpand
}
 Different layout styles that ButtonBox can use. More...
 
enum  EDirection {
  EDirection::kInvalid,
  EDirection::kHorizontal,
  EDirection::kVertical
}
 

Public Member Functions

virtual ~ButtonBox (void)
 Destructor. More...
 
 ButtonBox (const EDirection direction=EDirection::kHorizontal)
 Constructor. The default layout style is ELayout::kSpread. More...
 
virtual operator GtkButtonBox * (void) const
 Convert an instance of ButtonBox to GtkButtonBox*. More...
 
virtual ELayout layout (void)
 Retrieve the current layout style. Unless explicitely changed, the default layout style is ELayout::kSpread. More...
 
virtual ButtonBoxlayout (const ELayout layout_style)
 Specify the layout style to use. More...
 
virtual operator GtkBox * (void) const
 Convert an instance of Box to GtkBox*. More...
 
virtual int spacing (void)
 Get the spacing used between child components. More...
 
virtual Boxspacing (const int spacing)
 Set the spacing used between child components. More...
 
virtual bool homogeneous (void)
 Get the homogeneous value. More...
 
virtual Boxhomogeneous (const bool toggle)
 Set the homogeneous value. More...
 
virtual operator GtkContainer * (void) const
 Convert an instance of Container to GtkContainer*. More...
 
virtual Containeradd_child (GUIComponent &child)
 Add a child component to this container. More...
 
virtual Containerremove_child (GUIComponent &child)
 Remove a child component from this container. More...
 
virtual operator GtkWidget * (void) const
 Convert an instance of GUIComponent to GtkWidget*. More...
 
virtual GUIComponentmove_to (const Point &p)
 Move to the specified coordinates. More...
 
virtual Size natural_size (void)
 Get the natural size of a widget. More...
 
virtual Size minimum_size (void)
 Get the minimum size of a widget. More...
 
virtual GUIComponentminimum_size (const Size &s)
 Set the minimum size of a widget. More...
 
virtual GUIComponentminimum_size (const int width, const int height)
 Set the minimum size of a widget. More...
 
virtual GUIComponentshow (const bool toggle=true)
 Make the immediate component visible. More...
 
virtual GUIComponentshow_all (const bool toggle=true)
 Make the component and all child components visible. More...
 
virtual GUIComponenthide (void)
 Hide a single component. More...
 
virtual bool is_visible (void) const
 Determine if the widget is shown. More...
 

Static Public Member Functions

static WidgetToGUIComponentMapwidget_to_gui_component_map (void)
 There are times when we have a pointer to a Gtk+ widget, and we need to map it back to the corresponding NOCL GUI component. More...
 

Public Attributes

std::set< GUIComponent * > children
 Keep track of all children that have been added to this container. More...
 
Containerparent
 Pointer to the parent to which we've been added. Will be nullptr if this object hasn't been added to a parent container. More...
 
GtkWidget * gtk_widget
 Pointer to the underlying GTK framework. More...
 

Detailed Description

Container for aligning and sizing buttons the same way.

This corresponds to GtkButtonBox.

See also
https://developer.gnome.org/gtk3/stable/GtkButtonBox.html

Member Enumeration Documentation

◆ ELayout

Different layout styles that ButtonBox can use.

See also
layout()
Enumerator
kInvalid 
kSpread 

GTK_BUTTONBOX_SPREAD

ButtonBox_spread.png
kEdge 

GTK_BUTTONBOX_EDGE

ButtonBox_edge.png
kStart 

GTK_BUTTONBOX_START

ButtonBox_start.png
kEnd 

GTK_BUTTONBOX_END

ButtonBox_end.png
kCenter 

GTK_BUTTONBOX_CENTER

ButtonBox_center.png
kExpand 

GTK_BUTTONBOX_EXPAND

ButtonBox_expand.png

◆ EDirection

enum nocl::Box::EDirection
stronginherited
Enumerator
kInvalid 
kHorizontal 
kVertical 

Constructor & Destructor Documentation

◆ ~ButtonBox()

nocl::ButtonBox::~ButtonBox ( void  )
virtual

Destructor.

◆ ButtonBox()

nocl::ButtonBox::ButtonBox ( const EDirection  direction = EDirection::kHorizontal)

Constructor. The default layout style is ELayout::kSpread.

Exceptions
nocl::ExceptionThrows if Gtk+ fails to create a new window.

References nocl::GUIComponent::gtk_widget, kSpread, nocl::Box::kVertical, layout(), and NOCL_WHERE.

Here is the call graph for this function:

Member Function Documentation

◆ operator GtkButtonBox *()

nocl::ButtonBox::operator GtkButtonBox * ( void  ) const
virtual

Convert an instance of ButtonBox to GtkButtonBox*.

Exceptions
nocl::ExceptionObject was not created correctly and cannot be converted to GtkButtonBox*.

References nocl::GUIComponent::gtk_widget, and NOCL_WHERE.

◆ layout() [1/2]

nocl::ButtonBox::ELayout nocl::ButtonBox::layout ( void  )
virtual

Retrieve the current layout style. Unless explicitely changed, the default layout style is ELayout::kSpread.

Exceptions
nocl::ExceptionObject has an unknown style.

References kCenter, kEdge, kEnd, kExpand, kSpread, kStart, and NOCL_WHERE.

Referenced by ButtonBox().

Here is the caller graph for this function:

◆ layout() [2/2]

nocl::ButtonBox & nocl::ButtonBox::layout ( const ELayout  layout_style)
virtual

◆ operator GtkBox *()

nocl::Box::operator GtkBox * ( void  ) const
virtualinherited

Convert an instance of Box to GtkBox*.

Exceptions
nocl::ExceptionObject was not created correctly and cannot be converted to GtkBox*.

References nocl::GUIComponent::gtk_widget, and NOCL_WHERE.

◆ spacing() [1/2]

int nocl::Box::spacing ( void  )
virtualinherited

Get the spacing used between child components.

◆ spacing() [2/2]

nocl::Box & nocl::Box::spacing ( const int  spacing)
virtualinherited

Set the spacing used between child components.

For example:

  • spacing set to 5:
    ButtonBox_spacing_5.png
  • spacing set to 25:
    ButtonBox_spacing_25.png

◆ homogeneous() [1/2]

bool nocl::Box::homogeneous ( void  )
virtualinherited

Get the homogeneous value.

◆ homogeneous() [2/2]

nocl::Box & nocl::Box::homogeneous ( const bool  toggle)
virtualinherited

Set the homogeneous value.

Determines whether or not an attempt is made to resize all controls in a similar manner.

For example:

  • homogeneous disabled:
    ButtonBox_homogeneous_false.png
  • homogeneous enabled:
    ButtonBox_homogeneous_true.png

◆ operator GtkContainer *()

nocl::Container::operator GtkContainer * ( void  ) const
virtualinherited

Convert an instance of Container to GtkContainer*.

Exceptions
nocl::ExceptionObject was not created correctly and cannot be converted to GtkContainer*.

References nocl::GUIComponent::gtk_widget, and NOCL_WHERE.

◆ add_child()

nocl::Container & nocl::Container::add_child ( GUIComponent child)
virtualinherited

Add a child component to this container.

Exceptions
nocl::ExceptionChild-parent hierarchy doesn't make sense.

Reimplemented in nocl::Grid, nocl::Fixed, and nocl::Layout.

References nocl::Container::children, NOCL_WHERE, nocl::GUIComponent::parent, and nocl::Container::remove_child().

Here is the call graph for this function:

◆ remove_child()

nocl::Container & nocl::Container::remove_child ( GUIComponent child)
virtualinherited

Remove a child component from this container.

References nocl::Container::children, and nocl::GUIComponent::parent.

Referenced by nocl::Container::add_child(), nocl::Grid::add_child(), nocl::Container::~Container(), and nocl::GUIComponent::~GUIComponent().

Here is the caller graph for this function:

◆ operator GtkWidget *()

nocl::GUIComponent::operator GtkWidget * ( void  ) const
virtualinherited

Convert an instance of GUIComponent to GtkWidget*.

References nocl::GUIComponent::gtk_widget.

◆ move_to()

nocl::GUIComponent & nocl::GUIComponent::move_to ( const Point p)
virtualinherited

Move to the specified coordinates.

Todo:

◆ natural_size()

nocl::Size nocl::GUIComponent::natural_size ( void  )
virtualinherited

Get the natural size of a widget.

References nocl::GUIComponent::minimum_size().

Referenced by nocl::GUIComponent::minimum_size().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ minimum_size() [1/3]

nocl::Size nocl::GUIComponent::minimum_size ( void  )
virtualinherited

Get the minimum size of a widget.

References nocl::GUIComponent::natural_size().

Referenced by nocl::GUIComponent::minimum_size(), and nocl::GUIComponent::natural_size().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ minimum_size() [2/3]

nocl::GUIComponent & nocl::GUIComponent::minimum_size ( const Size s)
virtualinherited

Set the minimum size of a widget.

References nocl::Size::height, nocl::GUIComponent::minimum_size(), and nocl::Size::width.

Here is the call graph for this function:

◆ minimum_size() [3/3]

nocl::GUIComponent & nocl::GUIComponent::minimum_size ( const int  width,
const int  height 
)
virtualinherited

Set the minimum size of a widget.

◆ show()

nocl::GUIComponent & nocl::GUIComponent::show ( const bool  toggle = true)
virtualinherited

Make the immediate component visible.

Parameters
[in]toggleSet to true to show the widget, or to false to hide the widget.
See also
hide()
show_all()
is_visible()

References nocl::GUIComponent::gtk_widget, and nocl::GUIComponent::hide().

Here is the call graph for this function:

◆ show_all()

nocl::GUIComponent & nocl::GUIComponent::show_all ( const bool  toggle = true)
virtualinherited

Make the component and all child components visible.

Parameters
[in]toggleSet to true to show the widget and all children, or to false to hide the widget.
See also
show()
hide()
is_visible()

References nocl::GUIComponent::gtk_widget, and nocl::GUIComponent::hide().

Here is the call graph for this function:

◆ hide()

nocl::GUIComponent & nocl::GUIComponent::hide ( void  )
virtualinherited

Hide a single component.

See also
show()
show_all()
is_visible()

References nocl::GUIComponent::gtk_widget.

Referenced by nocl::GUIComponent::show(), and nocl::GUIComponent::show_all().

Here is the caller graph for this function:

◆ is_visible()

bool nocl::GUIComponent::is_visible ( void  ) const
virtualinherited

Determine if the widget is shown.

See also
show()
show_all()
hide()

References nocl::GUIComponent::gtk_widget.

◆ widget_to_gui_component_map()

nocl::WidgetToGUIComponentMap & nocl::GUIComponent::widget_to_gui_component_map ( void  )
staticinherited

There are times when we have a pointer to a Gtk+ widget, and we need to map it back to the corresponding NOCL GUI component.

For example, during event handling, Gtk+ tells us which Gtk+ widget generated the event, but we need the corresponding NOCL object so we can call the event handler with a reference to the correct object.

Note
This is not intended for end-users to access directly!

Referenced by nocl::ButtonHandler::handle_button_events_for(), and nocl::GUIComponent::~GUIComponent().

Here is the caller graph for this function:

Member Data Documentation

◆ children

std::set<GUIComponent*> nocl::Container::children
inherited

Keep track of all children that have been added to this container.

Referenced by nocl::Container::add_child(), nocl::Grid::add_child(), nocl::Container::remove_child(), and nocl::Container::~Container().

◆ parent

Container* nocl::GUIComponent::parent
inherited

Pointer to the parent to which we've been added. Will be nullptr if this object hasn't been added to a parent container.

Referenced by nocl::Container::add_child(), nocl::Grid::add_child(), nocl::Container::remove_child(), and nocl::GUIComponent::~GUIComponent().

◆ gtk_widget


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