Containers can be assigned ID values upon creation. These ID values must be unique amongst all other Containers. Giving a container an ID value will prevent the Container from being destroyed when all its children have been undocked. This allows for the addition of new children to this container later on, and the children will show up where they should.
The default ID value of ID_NONE means that the container has no ID and will be destroyed if all of its children are undocked.
Public Member Functions | |
virtual Size | absolute_to_client (const Size &absolute) const |
virtual Rect | absolute_to_client (const Rect &absolute) 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) |
Container (InterfaceManager &manager, const layout::Container &data, component_type type=CONTAINER) | |
virtual void | dock (Pointer< Component > child, Component *relative=0, ALIGNMENT where=NONE) |
virtual bool | drag_drop_sensitive (const Point &position, Component *&dragged_component) const |
Determines if the given point is sensitive to drag and drop operations. | |
ALIGNMENT | get_alignment () const |
virtual Rect | get_background_rect () const |
virtual Dimensions | get_borders () const |
virtual CHILD_ALIGNMENT | get_child_alignment () const |
const ComponentList & | get_children () const |
virtual Rect | get_client_rect () const |
Color | get_color (int part) const |
Size | get_desired_size () const |
virtual Component * | get_dock_target () |
Font | get_font (int id) const |
int | get_id () const |
virtual layout::Container * | get_layout () const |
InterfaceManager & | get_manager () const |
virtual Dimensions | get_margins () const |
virtual Size | get_max_size () const |
Size | get_min_size () const |
virtual std::string | get_name () const |
WidgetAdapter | get_native_widget () const |
Container * | get_parent () const |
virtual Rect | get_rect () const |
int | get_type () const |
void | hide () |
void | init (const layout::Container &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) |
virtual void | render (DeviceContext &dc) |
Point | screen_to_client (const Point &screen) |
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) |
void | show_menu (Menu *menu) |
Shows the given menu at the current mouse position. | |
virtual bool | shown () const |
virtual void | undock (Component *child) |
virtual void | undock () |
void | update () |
~Container () | |
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. | |
InterfaceManager & | m_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. | |
Container * | m_parent |
Out parent Container. | |
const component_type | m_type |
The type of component. Used by the layout save/load feature. |
ifm::Container::Container | ( | InterfaceManager & | manager, | |
const layout::Container & | data, | |||
component_type | type = CONTAINER | |||
) |
Constructs a container with the given alignment for its child components. The default alignment is HORIZONTAL.
ifm::Container::~Container | ( | ) |
Converts the given rect from absolute coordinates to client coordinates. Decreases the rect by the size of the margins and borders.
asbolute | The asbolute coordinates to convert |
void ifm::Container::add_children_to_layout | ( | layout::Container & | layout | ) | const [protected, virtual] |
Adds this Container's children to the given layout object.
void ifm::Component::capture_mouse | ( | ) | [inherited] |
Captures the mouse so that all mouse inputs are sent to this Widget.
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.
Converts the given rect from client coordinates to absolute coordinates. Increases the rect by the size of the margins and borders.
client | The client coordinates to convert |
Converts the given client coordinates to screen coordinates.
screen | The client coordinates to convert |
void ifm::Component::create_widget | ( | ) | [protected, inherited] |
Creates the native widget for the component.
Docks the child at the specified position.
void ifm::Container::dock | ( | Pointer< Component > | child, | |
Component * | relative = 0 , |
|||
ALIGNMENT | where = NONE | |||
) | [virtual] |
Dock a child component into this container at a position relative to the given component which is already a child of this container. The default arguments will dock the child after any existing children.
child | The child component to dock. | |
relative | The component to dock the child near. If 0, the child will be added after any existing children. | |
where | The relative position to dock next to the relative component. |
Reimplemented in ifm::TabbedContainer.
bool ifm::Component::drag_drop_sensitive | ( | const Point & | position, | |
Component *& | dragged_component | |||
) | const [virtual, inherited] |
Determines if the given point is sensitive to drag and drop operations.
position | The position to test given in client coordinates. | |
dragged_component | If the position is sensitive to drag and drop operations, the component that would be dragged is returned through this parameter. |
Reimplemented in ifm::TabbedContainer.
ALIGNMENT ifm::Container::get_alignment | ( | ) | const |
Rect ifm::Component::get_background_rect | ( | ) | const [virtual, inherited] |
Dimensions ifm::Component::get_borders | ( | ) | const [virtual, inherited] |
CHILD_ALIGNMENT ifm::Container::get_child_alignment | ( | ) | const [virtual] |
The child alignment depends on the container alignment.
Reimplemented in ifm::TabbedContainer.
const ComponentList & ifm::Container::get_children | ( | ) | const [virtual] |
Rect ifm::Component::get_client_rect | ( | ) | const [virtual, inherited] |
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.
Size ifm::Container::get_desired_size | ( | ) | const [virtual] |
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] |
int ifm::Container::get_id | ( | ) | const |
layout::Container * ifm::Container::get_layout | ( | ) | const [virtual] |
Returns the layout object representing the current state of this Container.
Implements ifm::Component.
Reimplemented in ifm::TabbedContainer.
InterfaceManager & ifm::Component::get_manager | ( | ) | const [inherited] |
Dimensions ifm::Component::get_margins | ( | ) | const [virtual, inherited] |
Size ifm::Component::get_max_size | ( | ) | const [virtual, inherited] |
A value of 0 in a given direction means no maximum size.
Size ifm::Container::get_min_size | ( | ) | const [virtual] |
std::string ifm::Component::get_name | ( | ) | const [virtual, inherited] |
WidgetAdapter ifm::Component::get_native_widget | ( | ) | const [inherited] |
Rect ifm::Component::get_rect | ( | ) | const [virtual, inherited] |
int ifm::Component::get_type | ( | ) | const [inherited] |
void ifm::Component::hide | ( | ) | [inherited] |
void ifm::Container::init | ( | const layout::Container & | data | ) |
Performs post-creation initialization, such as creating children.
bool ifm::Component::is_active | ( | ) | const [inherited] |
bool ifm::Component::on_left_down | ( | const MouseEventData & | data | ) | [virtual, inherited] |
Called when the user has pressed the left mouse button over this Component.
data | Data about this event |
Reimplemented in ifm::TabbedContainer.
bool ifm::Component::on_left_up | ( | const MouseEventData & | data | ) | [virtual, inherited] |
Called when the user has released the left mouse button over this Component.
data | Data about this event |
Reimplemented in ifm::TabbedContainer.
bool ifm::Component::on_menu_select | ( | int | id | ) | [virtual, inherited] |
Called when an item from a menu opened by this component is selected.
id | The identifier of the menu item that was selected. |
Reimplemented in ifm::TabbedContainer.
bool ifm::Component::on_mouse_leave | ( | const MouseEventData & | data | ) | [virtual, inherited] |
Called when the user has moved the mouse out of this Component.
data | Data about this event |
Reimplemented in ifm::TabbedContainer.
bool ifm::Component::on_mouse_move | ( | const MouseEventData & | data | ) | [virtual, inherited] |
Called when the user has moved the mouse over this Component.
data | Data about this event |
Reimplemented in ifm::TabbedContainer.
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::Component::render | ( | DeviceContext & | dc | ) | [virtual, inherited] |
Render this component onto the given device context
Reimplemented in ifm::TabbedContainer.
Converts the given screen coordinates to client coordinates.
screen | The screen coordinates to convert |
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] |
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::Component::set_focus | ( | ) | [virtual, inherited] |
Sets the focus to this Component's native widget.
Reimplemented in ifm::Panel, and ifm::TabbedContainer.
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] |
void ifm::Component::set_rect | ( | const Rect & | rect | ) | [inherited] |
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.
void ifm::Component::show_menu | ( | Menu * | menu | ) | [inherited] |
Shows the given menu at the current mouse position.
bool ifm::Component::shown | ( | ) | const [virtual, inherited] |
void ifm::Container::undock | ( | Component * | child | ) | [virtual] |
Undock a child of this Container.
Reimplemented in ifm::TabbedContainer.
void ifm::Container::undock | ( | ) | [virtual] |
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::Container::update | ( | ) | [virtual] |
Update the position of our children.
Reimplemented from ifm::Component.
Reimplemented in ifm::TabbedContainer.
bool ifm::Component::m_active [protected, inherited] |
Whether we or one of our children currently has focus.
ALIGNMENT ifm::Container::m_alignment [protected] |
Alignment within the interface.
Dimensions ifm::Component::m_borders [protected, inherited] |
The border widths.
ComponentList ifm::Container::m_children [protected] |
Child components.
ColorMap ifm::Component::m_colors [protected, inherited] |
Our color database.
const int ifm::Container::m_id [protected] |
ID.
InterfaceManager& ifm::Component::m_manager [protected, inherited] |
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.
WidgetAdapter ifm::Component::m_native_widget [protected, inherited] |
The native widget representing this component in the GUI.
Container* ifm::Component::m_parent [protected, inherited] |
Out parent Container.
const component_type ifm::Component::m_type [protected, inherited] |
The type of component. Used by the layout save/load feature.