ifm::Component Class Reference

Inheritance diagram for ifm::Component:

ifm::Container ifm::Panel ifm::TabbedContainer

List of all members.


Detailed Description

Base class for all components in IFM.

Components are each associated with a native widget which represents the component in the interface.

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)
virtual bool drag_drop_sensitive (const Point &position, Component *&dragged_component) const
 Determines if the given point is sensitive to drag and drop operations.
virtual Rect get_background_rect () const
virtual Dimensions get_borders () const
virtual const ComponentListget_children () const
virtual Rect get_client_rect () const
Color get_color (int part) const
virtual Size get_desired_size () const
virtual Componentget_dock_target ()
Font get_font (int id) const
virtual layout::Componentget_layout () const =0
InterfaceManagerget_manager () const
virtual Dimensions get_margins () const
virtual Size get_max_size () const
virtual Size get_min_size () const
virtual std::string get_name () const
WidgetAdapter get_native_widget () const
Containerget_parent () const
virtual Rect get_rect () const
int get_type () const
void hide ()
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)
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 ()
virtual void update ()
virtual ~Component ()

Static Public Member Functions

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

Protected Member Functions

 Component (InterfaceManager &manager, component_type type, const WidgetPtr &widget)
 Component (InterfaceManager &manager, const layout::Component &data, component_type type)
void create_widget ()

Protected Attributes

bool m_active
 Whether we or one of our children currently has focus.
Dimensions m_borders
 The border widths.
ColorMap m_colors
 Our color database.
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 Member Functions

void deref ()
void ref ()
friend void::intrusive_ptr_add_ref (ifm::Component *component)
friend void::intrusive_ptr_release (ifm::Component *component)

Private Attributes

int m_ref
 Tracks reference count.


Constructor & Destructor Documentation

ifm::Component::Component ( InterfaceManager manager,
const layout::Component data,
component_type  type 
) [protected]

Constructs the component and creates the native widget. The native widget's parent will initially be the managed window.

ifm::Component::~Component (  )  [virtual]

ifm::Component::Component ( InterfaceManager manager,
component_type  type,
const WidgetPtr widget 
) [protected]

Construct the component using an already created native widget.


Member Function Documentation

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

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

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::Component::capture_mouse (  ) 

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

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

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]

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

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  ) 

Converts the given client coordinates to screen coordinates.

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

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

Creates the native widget for the component.

void ifm::Component::deref (  )  [private]

Releases a reference. When the reference count is 0, this Component will be deleted.

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

Determines if the given point is sensitive to drag and drop operations.

Parameters:
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.
Returns:
Whether the given position is sensitive to drag and drop operations.

Reimplemented in ifm::TabbedContainer.

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

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]

Returns:
The current border sizes.

const ComponentList & ifm::Component::get_children (  )  const [virtual]

Only Container derivatives actually have children, but it is useful to be able to access the children of a Container even if you only hold a Component pointer to that container.

Note:
The default implementation returns an empty list since generic Components don't have children.
Returns:
The children of this Component.

Reimplemented in ifm::Container.

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

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

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

Color ifm::Component::get_color ( int  part  )  const

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::Component::get_desired_size (  )  const [virtual]

Returns:
The desired size

Reimplemented in ifm::Container, and ifm::TabbedContainer.

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

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

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

virtual layout::Component* ifm::Component::get_layout (  )  const [pure virtual]

Returns:
A layout object representing the current state of this Component.

Implemented in ifm::Container, ifm::Panel, and ifm::TabbedContainer.

InterfaceManager & ifm::Component::get_manager (  )  const

Returns:
The InterfaceManager managing this component.

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

Returns:
The current margin sizes.

Reimplemented in ifm::TabbedContainer.

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

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

Returns:
The maximum size.

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

Returns:
The minimum size.

Reimplemented in ifm::Container, ifm::Panel, and ifm::TabbedContainer.

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

Returns:
The name of this component.

Reimplemented in ifm::TabbedContainer.

WidgetAdapter ifm::Component::get_native_widget (  )  const

Returns:
The native widget representing this component.

Container * ifm::Component::get_parent (  )  const

Returns:
The parent Container.

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

Returns:
The size and position of this Component.

int ifm::Component::get_type (  )  const

Returns:
The type of this component.

void ifm::Component::hide (  ) 

bool ifm::Component::is_active (  )  const

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

bool ifm::Component::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 in ifm::TabbedContainer.

bool ifm::Component::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 in ifm::TabbedContainer.

bool ifm::Component::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 in ifm::TabbedContainer.

bool ifm::Component::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 in ifm::TabbedContainer.

bool ifm::Component::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 in ifm::TabbedContainer.

void ifm::Component::ref (  )  [private]

Adds a reference.

void ifm::Component::refresh ( const Rect rect  ) 

Refreshes an area of this component by rendering it.

void ifm::Component::refresh (  ) 

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

void ifm::Component::release_mouse (  ) 

Releases the mouse capture.

void ifm::Component::remove_color ( int  part  ) 

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

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

Render this component onto the given device context

Reimplemented in ifm::TabbedContainer.

Point ifm::Component::screen_to_client ( const Point screen  ) 

Converts the given screen coordinates to client coordinates.

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

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

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::Component::set_color ( int  part,
const Color color 
)

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

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

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]

Sets the minimum size.

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

Sets the name of this component.

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

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  ) 

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]

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  ) 

Shows the given menu at the current mouse position.

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

Returns:
Whether this component is shown or hidden.

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

Undock this component from its curent parent.

Note:
This operation may delete the parent.

Reimplemented in ifm::Container.

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

Updates the component, recalculating the positions of child components and performing other required tasks.

Reimplemented in ifm::Container, ifm::Panel, and ifm::TabbedContainer.

ifm::Component::void::intrusive_ptr_add_ref ( ifm::Component component  )  [private]

ifm::Component::void::intrusive_ptr_release ( ifm::Component component  )  [private]


Member Data Documentation

bool ifm::Component::m_active [protected]

Whether we or one of our children currently has focus.

The border widths.

Our color database.

The InterfaceManager managing this component.

The margin widths.

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

The name of the component.

The native widget representing this component in the GUI.

Out parent Container.

int ifm::Component::m_ref [private]

Tracks reference count.

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