omgui::Notebook Class Reference

#include <omgui/notebook.h>

Inherits omgui::Panel.

List of all members.


Detailed Description

A Notebook is a tabbed container. It contains a collection of "pages" allowing the user to select which page to view by selecting that pages tab.

A Notebook's minimum size is defined to be the largest of these two values:

A Notebook's maximum size is defined to be the smallest of these two values: Event Objects: Events:

Public Types

typedef omgui::api::Notebook api_type
typedef omgui::event_traits
< Window
event_traits
typedef NotebookInitializer Initializer

Public Member Functions

void add_ref ()
 Increments the reference count for this Widget.
void append_page (NotebookPage page, const string &name)
omgui::Connection connect (event_id event, SlotBase *slot, int priority=SIGNAL_PRIORITY_NORMAL)
 Connects an event using this Widget's object_id. Calls omgui::Manager::connect with supplied arguments.
void destroy ()
 Destroys this widget freeing all resources.
void disable ()
void enable (bool e)
 Enables or disables the widget. Disabled widgets cannot recieve user input.
void * get_handle () const
object_id get_id () const
api_typeget_impl () const
omgui::Size get_max_size () const
 Returns the maximum size of the Widget. A value of 0 for width or height indicates that there is no maximum size in that direction.
omgui::Size get_min_size () const
 Returns the minimum size of the Widget. A value of 0 for width or height indicates that there is no minimum size in that direction.
omgui::Size get_natural_size () const
NotebookPage get_page (int index) const
int get_page_count () const
int get_page_index (NotebookPage page) const
string get_page_name (NotebookPage page) const
Pointer< Panelget_parent () const
Pointer< Windowget_parent_window () const
omgui::Point get_position () const
omgui::Rect get_rect () const
NotebookPage get_selected_page () const
omgui::Size get_size () const
void hide ()
void insert_page (int where, NotebookPage page, const string &name)
void invalidate_cached_child_values ()
 Invalidates any cached child widget values which include minimum, maximum and natural sizes. These values can be cached by layout manager implementations for improved performance but must be invalidated when the value in the child widget changes so that the cached value can be updated.
bool is_enabled () const
 Determines whether or not the widget is enabled. If any of a widget's parents are disabled, the widget is considered disabled.
bool is_hidden () const
 Returns whether or not this Widget has been hidden.
bool is_orphaned () const
bool is_shown () const
 Returns whether or not the Widget is visible on the screen. If the Widget and all of its parent Widgets are not hidden then the Widget is shown.
void release ()
 Decrements the reference count for this Widget. Once the count reaches 0 the Widget will be deleted.
void remove_child (Widget *child)
NotebookPage remove_page (NotebookPage page)
bool select_next_page ()
bool select_previous_page ()
void set_max_size (const omgui::Size &s)
 Sets the maximum size of the widget. A value of 0 for width or height indicates that there is no maximum size in that direction.
void set_min_size (const omgui::Size &s)
 Sets the minimum size of the Widget. A value of 0 for width or height indicates that there is no minimum size in that direction. If the Widget's current size is less than the newly specified minimum size, the object will be resized so that its size is equal to the newly specified minimum size.
void set_natural_size (const omgui::Size &s)
void set_page_name (NotebookPage page, const string &name)
void set_position (const omgui::Point &p)
 Sets the position of a widget. If the widget is a TopLevel widget, the position value is in screen coordinates, otherwise it is client coordinates.
void set_rect (const omgui::Rect &r)
 Sets both the position and the size of the widget. If the widget is a TopLevel widget, the value is in screen coordinates, otherwise it is client coordinates.
bool set_selected_page (NotebookPage page)
void set_size (const omgui::Size &s)
 Sets the absolute size of this widget. If the widget is a TopLevel widget, the value is in screen coordinates, otherwise it is client coordinates.
void show (bool show=true, bool focus=false)
 Shows or hides a widget.
void update_layout ()
 Refreshes the layout by recalculating widget sizes and positions. Call after the visibility, layout information, mininum or maximum size of a child widget has changed, or if child widgets have been removed or added.

Static Public Member Functions

static Pointer< Notebookcreate (const Initializer &initializer, object_id id=OBJECT_ID_ANY)

Protected Member Functions

void initialize (const Initializer &initializer)
 Constructs the native widget using the given initializer.
 Notebook (object_id id, api_type *impl)
 Notebook (object_id id)

Private Attributes

api_typem_impl

Member Typedef Documentation

Reimplemented from omgui::Panel.

typedef omgui::event_traits<Window> omgui::Notebook::event_traits

Reimplemented from omgui::Widget.


Constructor & Destructor Documentation

omgui::Notebook::Notebook ( object_id  id  )  [protected]

omgui::Notebook::Notebook ( object_id  id,
api_type impl 
) [protected]


Member Function Documentation

void Widget::add_ref (  )  [virtual, inherited]

Increments the reference count for this Widget.

Implements omgui::RefCountable.

void omgui::Notebook::append_page ( NotebookPage  page,
const string name 
)

Appends a NotebookPage after any existing pages.

Parameters:
page The NotebookPage to append
name The name of the NotebookPage
Postcondition:
page is now a child of this Notebook

If this page is the only page in the Notebook, it will be selected, visible, and the PAGE_CHANGED event will be sent. If not, the page will be hidden.

omgui::Connection Widget::connect ( event_id  event,
SlotBase slot,
int  priority = SIGNAL_PRIORITY_NORMAL 
) [inherited]

Connects an event using this Widget's object_id. Calls omgui::Manager::connect with supplied arguments.

Pointer< Notebook > omgui::Notebook::create ( const Initializer initializer,
object_id  id = OBJECT_ID_ANY 
) [static]

Creates a Notebook with the given object_id. An id of OBJECT_ID_ANY means that the widget will be assigned an autmoatically generated unique id.

void Widget::destroy (  )  [inherited]

Destroys this widget freeing all resources.

void Widget::disable (  )  [inherited]

void Widget::enable ( bool  e  )  [inherited]

Enables or disables the widget. Disabled widgets cannot recieve user input.

void * Widget::get_handle (  )  const [inherited]

Returns:
A native handle for the widget. This value is returned as a void*, and how you use this value is dependant on the port you are working with. For win32, simply casting the return value to a HWND is sufficient.
Todo:
Casting a pointer type to a type that isn't a pointer may not work under all circumstances

object_id omgui::Object::get_id (  )  const [inherited]

Returns:
This object's unique identifier

Reimplemented in omgui::MenuItem.

Notebook::api_type * omgui::Notebook::get_impl (  )  const

Reimplemented from omgui::Panel.

omgui::Size Widget::get_max_size (  )  const [inherited]

Returns the maximum size of the Widget. A value of 0 for width or height indicates that there is no maximum size in that direction.

Returns:
Maximum size of the widget.

omgui::Size Widget::get_min_size (  )  const [inherited]

Returns the minimum size of the Widget. A value of 0 for width or height indicates that there is no minimum size in that direction.

Returns:
Minimum size of the widget.

omgui::Size Widget::get_natural_size (  )  const [inherited]

Returns:
Natural size of the widget. The natural size is used by layout managers to determine how large to make widgets which are not expanded. Unless a natural size is explicitly specified by a call to set_natural_size or through an inintializer, this value is a calculated value and can vary from widget to widget and from port to port.

NotebookPage omgui::Notebook::get_page ( int  index  )  const

Returns the page at the given index within the Notebook.

Throws if the given index is invalid

Todo:
Be more specific about what will be thrown

int omgui::Notebook::get_page_count (  )  const

Returns:
The number of pages in the Notebook.

int omgui::Notebook::get_page_index ( NotebookPage  page  )  const

Returns the index of the given page within the Notebook. The first page has an index of 0.

Throws if the page is not in this notebook

Todo:
Be more specific about what will be thrown

string omgui::Notebook::get_page_name ( NotebookPage  page  )  const

Returns:
The name for the given NotebookPage

Pointer< Panel > Widget::get_parent (  )  const [inherited]

This function returns the parent Panel of this Widget. In the case where this Widget is the Content Panel of a Window, this function will return an empty pointer.

Returns:
The parent of this widget

Pointer< Window > Widget::get_parent_window (  )  const [inherited]

This function returns the Window which this Widget is either directly or indirectly a child of. In the case where this Widget is a Window, this function returns the owner Window, or an empty pointer if the Window is unowned.

Returns:
The Window which contains this widget.

omgui::Point Widget::get_position (  )  const [inherited]

Returns:
Position of the widget. If the widget is a TLW TLW, the position is in screen coordinates. Otherwise, the position is in client coordinates.

omgui::Rect Widget::get_rect (  )  const [inherited]

Returns:
Position and Size of this widget as a rectangle.

NotebookPage omgui::Notebook::get_selected_page (  )  const

Returns:
The currently selected NotebookPage. If there is no selection, an empty pointer will be returned.

omgui::Size Widget::get_size (  )  const [inherited]

Returns:
Absolute size of the widget

void Widget::hide (  )  [inherited]

void omgui::Notebook::initialize ( const Initializer initializer  )  [protected]

Constructs the native widget using the given initializer.

void omgui::Notebook::insert_page ( int  where,
NotebookPage  page,
const string name 
)

Inserts a NotebookPage at the given position.

Parameters:
where The position to place the NotebookPage
page The NotebookPage to append
name The name of the NotebookPage
Postcondition:
page is now a child of this Notebook

If this page is the only page in the Notebook, it will be selected, visible, and the PAGE_CHANGED event will be sent. If not, the page will be hidden.

void omgui::Panel::invalidate_cached_child_values (  )  [inherited]

Invalidates any cached child widget values which include minimum, maximum and natural sizes. These values can be cached by layout manager implementations for improved performance but must be invalidated when the value in the child widget changes so that the cached value can be updated.

bool Widget::is_enabled (  )  const [inherited]

Determines whether or not the widget is enabled. If any of a widget's parents are disabled, the widget is considered disabled.

Returns:
Whether or not the widget is enabled

bool Widget::is_hidden (  )  const [inherited]

Returns whether or not this Widget has been hidden.

If show(true) has been called the Widget is considered not to be hidden. If show(false) or hide() have been called the Widget is considered hidden. A Widget is also considered hidden if it was created without specifying show in its initializer. The hidden state of the parent Widget has no effect on the hidden state of this Widget.

Note:
The return value is not equivilant to !is_shown().
Todo:
Implement for gtk2 and cocoa

bool omgui::Panel::is_orphaned (  )  const [inherited]

Returns:
Whether or not this panel is orphaned.

bool Widget::is_shown (  )  const [inherited]

Returns whether or not the Widget is visible on the screen. If the Widget and all of its parent Widgets are not hidden then the Widget is shown.

Note:
The return value is not equivilant to !is_hidden().
Todo:
Verify the newly documented behavior for this function on gtk2 and cocoa ports

void Widget::release (  )  [virtual, inherited]

Decrements the reference count for this Widget. Once the count reaches 0 the Widget will be deleted.

Implements omgui::RefCountable.

void omgui::Panel::remove_child ( Widget child  )  [inherited]

Removes a child window from this panel. This function will automatically be called by the library when needed. You should never have to call it yourself.

NotebookPage omgui::Notebook::remove_page ( NotebookPage  page  ) 

Removes the given NotebookPage from the Notebook.

Postcondition:
page is now orphaned and hidden

If page was the selected page, the next NotebookPage will be selected, if one exists. In this event, PAGE_CHANGED will be sent, but PAGE_CHANGING will not, as the change cannot be vetoed. If you would like a specific page to be selected after removing this one, select that page manually before you remove this one.

Returns:
The NotebookPage that was removed

bool omgui::Notebook::select_next_page (  ) 

Selects the next tab in the Notebook. If the last tab is currently selected, the next tab is considered to be the first tab. Both PAGE_CHANGING and PAGE_CHANGED events will be sent.

Returns:
True if the next page was selected.

bool omgui::Notebook::select_previous_page (  ) 

Selects the previous tab in the Notebook. If the first tab is currently selected, the previous tab is considered to be the last tab. Both PAGE_CHANGING and PAGE_CHANGED events will be sent.

Returns:
True if the previous page was selected.

void Widget::set_max_size ( const omgui::Size s  )  [inherited]

Sets the maximum size of the widget. A value of 0 for width or height indicates that there is no maximum size in that direction.

If the Widget's current size is greater than the newly specified maximum size, the object will be resized so that its size is equal to the newly specified maximum size.

void Widget::set_min_size ( const omgui::Size s  )  [inherited]

Sets the minimum size of the Widget. A value of 0 for width or height indicates that there is no minimum size in that direction. If the Widget's current size is less than the newly specified minimum size, the object will be resized so that its size is equal to the newly specified minimum size.

If a child of this Widget has a minimum size larger than the minimum size of this Widget, the minimum size of this Widget will be effectively equal to the minimum size of that child Widget. This has an important implication for Windows and their content panels. If a Window has a minimum size of X, and a Panel A with minimum size Y > X is specified as the Window's content panel, the minimum content size of the Window is effectively Y. If a new Panel B with minimum size Z < Y is specified as the Window's content panel, the effective minimum content size for the window will be Y.

If an Widget is specified with a minimum size that is larger than the Widgets maximum size, or if a maximum size is later specified which is smaller than an existing minimum size, the minimum size will always take precedence over the maximal size. A minimum size of (100,100) and a maximal size of (50,50) results in a minimum size of (100,100) and a maximum size of (100,100). If the minimum size is later changed to (25,25), the maximum size is again (50,50) and the minimum size is (25,25). This case also applies to Window's and their content panels. A content panel's minimum size always takes precedence over a Window's maximum content size.

void Widget::set_natural_size ( const omgui::Size s  )  [inherited]

Sets the natural size for this widget. The natural size is used by layout managers to determine how large to make widgets which are not expanded. The default natural size has a width and height of 0, which means that an acceptible natural size will be calculated for the width and height. You can override the calculated value by specifying your own value for the width and or height.

void omgui::Notebook::set_page_name ( NotebookPage  page,
const string name 
)

Changes the name for the given NotebookPage

Parameters:
page The page who's name will be changed
name The new name for the NotebookPage

void Widget::set_position ( const omgui::Point p  )  [inherited]

Sets the position of a widget. If the widget is a TopLevel widget, the position value is in screen coordinates, otherwise it is client coordinates.

void Widget::set_rect ( const omgui::Rect r  )  [inherited]

Sets both the position and the size of the widget. If the widget is a TopLevel widget, the value is in screen coordinates, otherwise it is client coordinates.

bool omgui::Notebook::set_selected_page ( NotebookPage  page  ) 

Selects the specified NoteboookPage.

This function will generate PAGE_CHANGING and PAGE_CHANGED events. If PAGE_CHANGING is vetoed, the page will not be changed and PAGE_CHANGED will not be sent.

Note:
If an attempt is made to select the currently selected page, neither PAGE_CHANGING or PAGE_CHANGED will be sent, and this function will return true.
Parameters:
page The NotebookPage to select
Returns:
Whether or not the page was actually selected.

void Widget::set_size ( const omgui::Size s  )  [inherited]

Sets the absolute size of this widget. If the widget is a TopLevel widget, the value is in screen coordinates, otherwise it is client coordinates.

If the size value specified is smaller than the minimum size or larger than the maximum size, the size value actually set will be equal to the minimum size or maximum size respectively.

void Widget::show ( bool  show = true,
bool  focus = false 
) [inherited]

Shows or hides a widget.

Note:
If this widget is a Panel which is currently functioning as a NotebookPage, this function will have no effect. Panel's which are NotebookPages are shown and hidden by the Notebook itself.

Reimplemented in omgui::TopLevel.

void omgui::Panel::update_layout (  )  [inherited]

Refreshes the layout by recalculating widget sizes and positions. Call after the visibility, layout information, mininum or maximum size of a child widget has changed, or if child widgets have been removed or added.

Todo:
Child widgets need to invalidate the cached min, max, and natural sizes in their parent TableLayout if their min max or natural size changes so that update_layout functions correctly.


Member Data Documentation

Reimplemented from omgui::Panel.


doxygen SourceForge.net Logo