ifm::TabbedContainer Class Reference

Inheritance diagram for ifm::TabbedContainer:

ifm::Container ifm::Component

List of all members.


Detailed Description

A TabbedContainer displays its children by creating a tab for each child allowing the user to select one tab at a time.

TabbedContainers have a caption which is used to display the name of the TabbedContainer (if one exists) as well as the name of the selected child. The format of the display is: [TabbedContainer::name - ]Child::name.

Public Member Functions

virtual Size absolute_to_client (const Size &absolute) const
virtual Rect absolute_to_client (const Rect &absolute) const
int calc_tab_height () const
int calc_tab_width (int tabIdx, int tabHeight) const
void capture_mouse ()
virtual Size client_to_absolute (const Size &client) const
virtual Rect client_to_absolute (const Rect &client) const
Point client_to_screen (const Point &client)
virtual void dock (Pointer< Component > child, Component *relative=0, ALIGNMENT alignment=NONE)
bool drag_drop_sensitive (const Point &position, Component *&dragged_component) const
ALIGNMENT get_alignment () const
virtual Rect get_background_rect () const
virtual Dimensions get_borders () const
virtual Rect get_caption_rect () const
virtual Rect get_caption_text_rect () const
Componentget_child (size_t i) const
CHILD_ALIGNMENT get_child_alignment () const
const ComponentListget_children () const
size_t get_children_count () const
virtual Rect get_client_rect () const
Rect get_close_button_rect () const
Color get_color (int part) const
Size get_desired_size () const
virtual Componentget_dock_target ()
Font get_font (int id) const
int get_id () const
BitmapPtr get_image (size_t i) const
virtual layout::TabbedContainerget_layout () const
InterfaceManagerget_manager () const
virtual Dimensions get_margins () const
virtual Size get_max_size () const
Size get_min_size () const
std::string get_name () const
WidgetAdapter get_native_widget () const
std::string get_page_name (size_t i) const
Containerget_parent () const
virtual Rect get_rect () const
Componentget_selected_child () const
int get_selection_index () const
Rect get_tab_area_rect () const
bool get_tab_from_pos (Tab &tab, const Point &position) const
int get_type () const
bool has_image (size_t i) const
void hide ()
void init (const layout::Container &data)
void init (const layout::TabbedContainer &data)
bool is_active () const
virtual bool on_left_down (const MouseEventData &data)
 Called when the user has pressed the left mouse button over this Component.
virtual bool on_left_up (const MouseEventData &data)
 Called when the user has released the left mouse button over this Component.
virtual bool on_menu_select (int id)
 Called when an item from a menu opened by this component is selected.
virtual bool on_mouse_leave (const MouseEventData &data)
 Called when the user has moved the mouse out of this Component.
virtual bool on_mouse_move (const MouseEventData &data)
 Called when the user has moved the mouse over this Component.
void refresh (const Rect &rect)
void refresh ()
void release_mouse ()
void remove_color (int part)
void render (DeviceContext &dc)
Point screen_to_client (const Point &screen)
void select_child (int i)
virtual void select_child (Component *child)
virtual void set_active (bool active)
virtual void set_alignment (ALIGNMENT alignment)
void set_color (int part, const Color &color)
virtual void set_focus ()
virtual void set_min_size (const Size &size)
void set_name (const std::string &name)
virtual void set_parent (Container *parent)
void set_rect (const Rect &rect)
virtual void show (bool show=true)
virtual bool show_caption () const
bool show_close_button () const
void show_menu (Menu *menu)
 Shows the given menu at the current mouse position.
bool show_tab_select_button () const
void show_tab_select_menu ()
virtual bool show_tabs () const
virtual bool shown () const
 TabbedContainer (InterfaceManager &manager, const layout::TabbedContainer &data)
virtual void undock ()
virtual void undock (Component *child)
void update ()
bool update_tabs ()
 ~TabbedContainer ()

Static Public Member Functions

static bool child_of (Component *parent, Component *child)

Protected Member Functions

virtual void add_children_to_layout (layout::Container &layout) const
void create_widget ()
void dock (Pointer< Component > child, ComponentList::iterator where)

Protected Attributes

bool m_active
 Whether we or one of our children currently has focus.
ALIGNMENT m_alignment
 Alignment within the interface.
Dimensions m_borders
 The border widths.
ComponentList m_children
 Child components.
ColorMap m_colors
 Our color database.
const int m_id
 ID.
InterfaceManagerm_manager
 The InterfaceManager managing this component.
Dimensions m_margins
 The margin widths.
std::string m_name
 The name of the component.
WidgetAdapter m_native_widget
 The native widget representing this component in the GUI.
Containerm_parent
 Out parent Container.
const component_type m_type
 The type of component. Used by the layout save/load feature.

Private Attributes

bool m_allTabsCanFit
CaptionButton m_closeButton
bool m_mouseCaptured
CaptionButtonm_pressedButton
Componentm_selected_child
int m_tab_flags
std::vector< Tabm_tabs
CaptionButton m_tabSelectButton
MenuPtr m_tabSelectMenu


Constructor & Destructor Documentation

ifm::TabbedContainer::TabbedContainer ( InterfaceManager manager,
const layout::TabbedContainer data 
)

ifm::TabbedContainer::~TabbedContainer (  ) 


Member Function Documentation

Size ifm::Component::absolute_to_client ( const Size absolute  )  const [virtual, inherited]

Rect ifm::Component::absolute_to_client ( const Rect absolute  )  const [virtual, inherited]

Converts the given rect from absolute coordinates to client coordinates. Decreases the rect by the size of the margins and borders.

Parameters:
asbolute The asbolute coordinates to convert
Returns:
The client coordinates

void ifm::Container::add_children_to_layout ( layout::Container layout  )  const [protected, virtual, inherited]

Adds this Container's children to the given layout object.

int ifm::TabbedContainer::calc_tab_height (  )  const

int ifm::TabbedContainer::calc_tab_width ( int  tabIdx,
int  tabHeight 
) const

void ifm::Component::capture_mouse (  )  [inherited]

Captures the mouse so that all mouse inputs are sent to this Widget.

bool ifm::Component::child_of ( Component parent,
Component child 
) [static, inherited]

Because it is useful to know if one Component is a child of another Container but you will most likely only have a Component pointer to the Container, this method is provided as an easy way to determine this information. If the parent Component is not actually a Container, then clearly the child Component is not actually a child of it. If it is a Container, its child hierarchy will be searched for the child Component.

Returns:
Whether a Component is the child of another Component.

Size ifm::Component::client_to_absolute ( const Size client  )  const [virtual, inherited]

Rect ifm::Component::client_to_absolute ( const Rect client  )  const [virtual, inherited]

Converts the given rect from client coordinates to absolute coordinates. Increases the rect by the size of the margins and borders.

Parameters:
client The client coordinates to convert
Returns:
The absolute coordinates.

Point ifm::Component::client_to_screen ( const Point client  )  [inherited]

Converts the given client coordinates to screen coordinates.

Parameters:
screen The client coordinates to convert
Returns:
Screen coordinates

void ifm::Component::create_widget (  )  [protected, inherited]

Creates the native widget for the component.

void ifm::Container::dock ( Pointer< Component child,
ComponentList::iterator  where 
) [protected, inherited]

Docks the child at the specified position.

void ifm::TabbedContainer::dock ( Pointer< Component child,
Component relative = 0,
ALIGNMENT  alignment = NONE 
) [virtual]

Docks a chlid as a tab.

Parameters:
child The component to dock
relative Ignored
alignment Ignored

Reimplemented from ifm::Container.

bool ifm::TabbedContainer::drag_drop_sensitive ( const Point position,
Component *&  dragged_component 
) const [virtual]

The captions of TabbedContainers are drag and drop enabled.

Returns:
true whether the given point would begin a drag operation for the TabbedContainer or a child component.

Reimplemented from ifm::Component.

ALIGNMENT ifm::Container::get_alignment (  )  const [inherited]

Returns:
The alignment of this container.

Rect ifm::Component::get_background_rect (  )  const [virtual, inherited]

The background area is the area of the Component excluding borders.

Returns:
A Rect representing the background area of the Component.

Dimensions ifm::Component::get_borders (  )  const [virtual, inherited]

Returns:
The current border sizes.

Rect ifm::TabbedContainer::get_caption_rect (  )  const [virtual]

Returns the rect containing the caption.

Rect ifm::TabbedContainer::get_caption_text_rect (  )  const [virtual]

Returns the rect available to render the caption text.

Component * ifm::TabbedContainer::get_child ( size_t  i  )  const

CHILD_ALIGNMENT ifm::TabbedContainer::get_child_alignment (  )  const [virtual]

The child alignment depends on the container alignment.

Returns:
The child alignment for this container.

Reimplemented from ifm::Container.

const ComponentList & ifm::Container::get_children (  )  const [virtual, inherited]

Returns:
The child Components.

Reimplemented from ifm::Component.

size_t ifm::TabbedContainer::get_children_count (  )  const

Rect ifm::Component::get_client_rect (  )  const [virtual, inherited]

The client area is the area of the Component excluding margins and borders.

Returns:
A Rect representing the client area of the Component.

Rect ifm::TabbedContainer::get_close_button_rect (  )  const

Color ifm::Component::get_color ( int  part  )  const [inherited]

The components local color database will be searched first, and if no color is found InterfaceManager::get_color is used.

Returns:
The color value to use for the given part when rendering this component.

Size ifm::TabbedContainer::get_desired_size (  )  const [virtual]

Returns:
The desired size

Reimplemented from ifm::Container.

Component * ifm::Component::get_dock_target (  )  [virtual, inherited]

When the user moves the mouse during a drag operation and hovers over a Component, this function is used to determine what component to display the DockTargets for. Docking will be performed relative to that component.

Reimplemented in ifm::Panel.

Font ifm::Component::get_font ( int  id  )  const [inherited]

Returns:
The Font used to render the given font id for this component.

int ifm::Container::get_id (  )  const [inherited]

Returns:
The ID of this container.

BitmapPtr ifm::TabbedContainer::get_image ( size_t  i  )  const

layout::TabbedContainer * ifm::TabbedContainer::get_layout (  )  const [virtual]

Returns the layout object representing the current state of this TabbedContainer.

Reimplemented from ifm::Container.

InterfaceManager & ifm::Component::get_manager (  )  const [inherited]

Returns:
The InterfaceManager managing this component.

Dimensions ifm::TabbedContainer::get_margins (  )  const [virtual]

Returns:
The current margin sizes.

Reimplemented from ifm::Component.

Size ifm::Component::get_max_size (  )  const [virtual, inherited]

A value of 0 in a given direction means no maximum size.

Returns:
The maximum size.

Size ifm::TabbedContainer::get_min_size (  )  const [virtual]

Returns the largest minimum size of our children accounting for any borders and margins we have.

Reimplemented from ifm::Container.

std::string ifm::TabbedContainer::get_name (  )  const [virtual]

Returns the name to display in the caption.

Reimplemented from ifm::Component.

WidgetAdapter ifm::Component::get_native_widget (  )  const [inherited]

Returns:
The native widget representing this component.

std::string ifm::TabbedContainer::get_page_name ( size_t  i  )  const

Container * ifm::Component::get_parent (  )  const [inherited]

Returns:
The parent Container.

Rect ifm::Component::get_rect (  )  const [virtual, inherited]

Returns:
The size and position of this Component.

Component * ifm::TabbedContainer::get_selected_child (  )  const

Returns:
The selected child Component.

int ifm::TabbedContainer::get_selection_index (  )  const

Rect ifm::TabbedContainer::get_tab_area_rect (  )  const

Returns:
The area where tabs can be displayed

bool ifm::TabbedContainer::get_tab_from_pos ( Tab tab,
const Point position 
) const

Finds which Tab is at the given position. Stores a copy of the tab data into the given Tab reference.

Returns:
Whether there was a tab at the position or not.

int ifm::Component::get_type (  )  const [inherited]

Returns:
The type of this component.

bool ifm::TabbedContainer::has_image ( size_t  i  )  const

void ifm::Component::hide (  )  [inherited]

void ifm::Container::init ( const layout::Container data  )  [inherited]

Performs post-creation initialization, such as creating children.

void ifm::TabbedContainer::init ( const layout::TabbedContainer data  ) 

Performs post-creation initialization, such as creating children.

bool ifm::Component::is_active (  )  const [inherited]

Returns:
Whether or not the keyboard focus exists within this component or one of its children.

bool ifm::TabbedContainer::on_left_down ( const MouseEventData data  )  [virtual]

Called when the user has pressed the left mouse button over this Component.

Parameters:
data Data about this event
Returns:
True if the event was processed, false otherwise.

Reimplemented from ifm::Component.

bool ifm::TabbedContainer::on_left_up ( const MouseEventData data  )  [virtual]

Called when the user has released the left mouse button over this Component.

Parameters:
data Data about this event
Returns:
True if the event was processed, false otherwise.

Reimplemented from ifm::Component.

bool ifm::TabbedContainer::on_menu_select ( int  id  )  [virtual]

Called when an item from a menu opened by this component is selected.

Parameters:
id The identifier of the menu item that was selected.
Returns:
True if the event was processed, false otherwise.

Reimplemented from ifm::Component.

bool ifm::TabbedContainer::on_mouse_leave ( const MouseEventData data  )  [virtual]

Called when the user has moved the mouse out of this Component.

Parameters:
data Data about this event
Returns:
True if the event was processed, false otherwise.

Reimplemented from ifm::Component.

bool ifm::TabbedContainer::on_mouse_move ( const MouseEventData data  )  [virtual]

Called when the user has moved the mouse over this Component.

Parameters:
data Data about this event
Returns:
True if the event was processed, false otherwise.

Reimplemented from ifm::Component.

void ifm::Component::refresh ( const Rect rect  )  [inherited]

Refreshes an area of this component by rendering it.

void ifm::Component::refresh (  )  [inherited]

Refreshes the component by rerendering it. Does not refresh children.

void ifm::Component::release_mouse (  )  [inherited]

Releases the mouse capture.

void ifm::Component::remove_color ( int  part  )  [inherited]

Removes a color for the given part from this components local color database.

void ifm::TabbedContainer::render ( DeviceContext dc  )  [virtual]

Renders this component

Reimplemented from ifm::Component.

Point ifm::Component::screen_to_client ( const Point screen  )  [inherited]

Converts the given screen coordinates to client coordinates.

Parameters:
screen The screen coordinates to convert
Returns:
Client coordinates

void ifm::TabbedContainer::select_child ( int  i  ) 

void ifm::TabbedContainer::select_child ( Component child  )  [virtual]

Selects the given child making it the active tab.

void ifm::Component::set_active ( bool  active  )  [virtual, inherited]

Called when this component or one of its children gains or loses focus. This function will call set_active on the parent component.

void ifm::Container::set_alignment ( ALIGNMENT  alignment  )  [virtual, inherited]

Specify the alignment of this container.

If the container is a top level container: LEFT, RIGHT, TOP and BOTTOM are used to specify what side of the application the container is docked against.

FLOATING is used to specify that this container is the root container of a floating window.

DOCKED is used to signify that this container is docked into another container.

void ifm::Component::set_color ( int  part,
const Color color 
) [inherited]

Sets a color for the given part in this components local color database.

void ifm::TabbedContainer::set_focus (  )  [virtual]

Sets focus to the selected child Component.

Reimplemented from ifm::Component.

void ifm::Component::set_min_size ( const Size size  )  [virtual, inherited]

Sets the minimum size.

void ifm::Component::set_name ( const std::string &  name  )  [inherited]

Sets the name of this component.

void ifm::Component::set_parent ( Container parent  )  [virtual, inherited]

Sets the parent Component for this Component. The act of changing the parent component must also change the parent of the native widget.

void ifm::Component::set_rect ( const Rect rect  )  [inherited]

Sets the size of this Component. Any children will be repositioned.

This method is not virtual because calling it will invoke the update() method, which is where components should perform their own special processing that needs to be done with their size and position changed.

void ifm::Component::show ( bool  show = true  )  [virtual, inherited]

Shows or Hides this component. When showing a component, all parents will also be shown to ensure that the component is visible.

Reimplemented in ifm::Panel.

bool ifm::TabbedContainer::show_caption (  )  const [virtual]

Returns:
True if this container should display a caption

bool ifm::TabbedContainer::show_close_button (  )  const

void ifm::Component::show_menu ( Menu menu  )  [inherited]

Shows the given menu at the current mouse position.

bool ifm::TabbedContainer::show_tab_select_button (  )  const

void ifm::TabbedContainer::show_tab_select_menu (  ) 

Displays a menu listing all tabs so the user can pick one. Used when some tabs are not visible.

bool ifm::TabbedContainer::show_tabs (  )  const [virtual]

Returns:
True if the tabs should be shown

bool ifm::Component::shown (  )  const [virtual, inherited]

Returns:
Whether this component is shown or hidden.

void ifm::Container::undock (  )  [virtual, inherited]

If this Container is a top level Container, removes this Container from the list of top level Containers. Otherwise, undocks from the parent Container.

Reimplemented from ifm::Component.

void ifm::TabbedContainer::undock ( Component child  )  [virtual]

Undock a child of this Container.

Reimplemented from ifm::Container.

void ifm::TabbedContainer::update (  )  [virtual]

Update the position of our children.

Todo:
Find a better way to fix rounding errors

Reimplemented from ifm::Container.

bool ifm::TabbedContainer::update_tabs (  ) 

Returns:
Whether or not all tabs could fit


Member Data Documentation

bool ifm::Component::m_active [protected, inherited]

Whether we or one of our children currently has focus.

ALIGNMENT ifm::Container::m_alignment [protected, inherited]

Alignment within the interface.

Dimensions ifm::Component::m_borders [protected, inherited]

The border widths.

ComponentList ifm::Container::m_children [protected, inherited]

Child components.

ColorMap ifm::Component::m_colors [protected, inherited]

Our color database.

const int ifm::Container::m_id [protected, inherited]

ID.

The InterfaceManager managing this component.

Dimensions ifm::Component::m_margins [protected, inherited]

The margin widths.

std::string ifm::Component::m_name [protected, inherited]

The name of the component.

The native widget representing this component in the GUI.

Container* ifm::Component::m_parent [protected, inherited]

Out parent Container.

std::vector<Tab> ifm::TabbedContainer::m_tabs [private]

const component_type ifm::Component::m_type [protected, inherited]

The type of component. Used by the layout save/load feature.


doxygen Get IFM - Interface Management System at SourceForge.net. Fast, secure and Free Open Source software downloads