ClanSoft logo
ClanSoft logo
Entire Class Index Main Class Index Cross Index Global Index

Class CL_Component

Component base class.
Contained in: global
Derived from: none
Derived by: CL_Button CL_Frame CL_GUIManager CL_Image CL_InputBox CL_Label CL_ListBox CL_PopupMenu CL_ProgressBar CL_ScrollBar CL_TreeItem CL_TreeView CL_Window
Group: GUI (Framework)

#include <ClanLib/gui.h>


public function member index:

Construction:

CL_Component(CL_Component* parent, CL_StyleManager* style = NULL);
CL_Component(const CL_Rect& pos, CL_Component* parent, CL_StyleManager* style = NULL);
virtual ~CL_Component();

Attributes:

CL_Component* get_parent() const;
CL_Component* get_root_parent();
CL_GUIManager* get_gui_manager() const;
CL_StyleManager* get_style_manager() const;
int get_width() const;
int get_height() const;
CL_Rect get_screen_rect() const;
const CL_Rect& get_position() const;
bool has_child(CL_Component* component) const;
const std::list<CL_Component* >& get_children() const;
CL_Rect get_children_rect();
CL_Component* get_component_at(int pos_x, int pos_y);
CL_Component* get_focus() const;
bool has_focus() const;
bool has_mouse_over() const;
bool is_visible() const;
bool is_enabled() const;
bool is_popup() const;
bool is_mouse_captured() const;
bool is_removeflag_set() const;
CL_Point get_mouse_position() const;
int get_tab_id() const;

Operations:

void set_tab_id(int id);
void set_position(const CL_Rect& new_pos);
void set_position(int new_x, int new_y);
void set_size(int new_width, int new_height);
void set_width(int width);
void set_height(int height);
void set_parent(CL_Component* parent);
void set_gui_manager(CL_GUIManager* gui);
void show(bool show = true);
void enable(bool enable = true);
void popup(bool popup);
void set_focus();
void raise();
void lower();
void capture_mouse();
void release_mouse();
void update();
void run(CL_Component* parent = NULL);
void quit();
void close();
void clear_removeflag();
void add_child(CL_Component* child, bool delete_child = false);
void remove_child(CL_Component* child);
void add_components(class CL_ComponentManager* component_manager);
void attach_style(CL_ComponentStyle* style);
void detach_style(CL_ComponentStyle* style);
void find_preferred_size();
CL_Component* find_tab_id(int tab_id);

Signals:

CL_Signal_v1<const CL_ComponentOptions& >& sig_set_options();
CL_Signal_v0& sig_paint();
CL_Signal_v0& sig_begin_paint();
CL_Signal_v0& sig_paint_children();
CL_Signal_v0& sig_end_paint();
CL_Signal_v2<CL_InputDevice* , const CL_Key& >& sig_input_down();
CL_Signal_v2<CL_InputDevice* , const CL_Key& >& sig_input_up();
CL_Signal_v1<const CL_Key& >& sig_key_down();
CL_Signal_v1<const CL_Key& >& sig_key_up();
CL_Signal_v1<const CL_Key& >& sig_mouse_down();
CL_Signal_v1<const CL_Key& >& sig_mouse_up();
CL_Signal_v2<int, int>& sig_mouse_move();
CL_Signal_v0& sig_mouse_enter();
CL_Signal_v0& sig_mouse_leave();
CL_Signal_v0& sig_got_focus();
CL_Signal_v0& sig_lost_focus();
CL_Signal_v2<int, int>& sig_resize();
CL_Signal_v2<int, int>& sig_move();
CL_Signal_v1<CL_Component* >& sig_child_before_add();
CL_Signal_v1<CL_Component* >& sig_child_add();
CL_Signal_v1<CL_Component* >& sig_child_before_remove();
CL_Signal_v1<CL_Component* >& sig_child_remove();
CL_Signal_v2<int& , int& >& sig_transform_coords();
CL_Signal_v1<CL_Point& >& sig_get_minimum_size();
CL_Signal_v1<CL_Point& >& sig_get_maximum_size();
CL_Signal_v1<CL_Point& >& sig_get_preferred_size();
 

Description:


Function Member Descriptions:

CL_Component::CL_Component - Component Constructor
CL_Component(CL_Component* parent, CL_StyleManager* style = NULL);


CL_Component::CL_Component - Component Constructor
CL_Component(const CL_Rect& pos, CL_Component* parent, CL_StyleManager* style = NULL);


CL_Component::add_child - Adds the specified component as a children to this component.
If 'delete_child' is true, the child will be deleted when the component is deleted.
void add_child(CL_Component* child, bool delete_child = false);


CL_Component::add_components - Add all components in a component manager.
void add_components(class CL_ComponentManager* component_manager);


CL_Component::attach_style - Attaches a component style to the component.
void attach_style(CL_ComponentStyle* style);


CL_Component::capture_mouse - Capture the mouse on the currently attached GUI manager. All mouse input
will be directed to this component until release_mouse() is called.
void capture_mouse();


CL_Component::clear_removeflag - Clears the remove flag... dunno what the remove flag means. -- mbn 3. okt 2000
void clear_removeflag();


CL_Component::close - "Closes" this component.
Hides and detaches component from parent.
void close();


CL_Component::detach_style - Removes a component style to the component.
void detach_style(CL_ComponentStyle* style);


CL_Component::enable - Enable/Disable user input.
void enable(bool enable = true);


CL_Component::find_preferred_size - Calculate a default size
void find_preferred_size();


CL_Component::find_tab_id - Returns the component with the specified tab ID.
CL_Component* find_tab_id(int tab_id);


CL_Component::get_children - Returns the list of child components.
const std::list<CL_Component* >& get_children() const;


CL_Component::get_children_rect - Returns the bounding rectangle of the component's children.
CL_Rect get_children_rect();


CL_Component::get_component_at - Returns the component at (pos_x, pos_y).
This functions searches for children recursively.
NULL is returned if the point is outside the component.
The component itself is returned if the component has no child at the specified point.
CL_Component* get_component_at(int pos_x, int pos_y);


CL_Component::get_focus - Returns the component that currently has the focus.
CL_Component* get_focus() const;


CL_Component::get_gui_manager - Returns the GUI manager that this component is attached to, or NULL if none.
CL_GUIManager* get_gui_manager() const;


CL_Component::get_height - Returns the height of the component.
int get_height() const;


CL_Component::get_mouse_position - Returns the current mouse position, relative to the component.
CL_Point get_mouse_position() const;


CL_Component::get_parent - Returns the parent component, or NULL if none.
CL_Component* get_parent() const;


CL_Component::get_position - Returns the position of this component.
const CL_Rect& get_position() const;


CL_Component::get_root_parent - Returns the root parent.
CL_Component* get_root_parent();


CL_Component::get_screen_rect - Returns the components position in screen coordinates.
CL_Rect get_screen_rect() const;


CL_Component::get_style_manager - Returns the style manager used by this component.
CL_StyleManager* get_style_manager() const;


CL_Component::get_tab_id - Returns the tab id of the component.
int get_tab_id() const;


CL_Component::get_width - Returns the width of the component.
int get_width() const;


CL_Component::has_child - Returns true if the passed component is a child of this component.
bool has_child(CL_Component* component) const;


CL_Component::has_focus - Returns true if component has the focus.
bool has_focus() const;


CL_Component::has_mouse_over - Returns true if the mouse is currently highlighting the component.
bool has_mouse_over() const;


CL_Component::is_enabled - Returns true if component accepts user input.
bool is_enabled() const;


CL_Component::is_mouse_captured - Returns true if component has mouse captured.
bool is_mouse_captured() const;


CL_Component::is_popup - Returns true if component is a popup window.
bool is_popup() const;


CL_Component::is_removeflag_set - I have no idea what this does... -- mbn 3. okt 2000.
bool is_removeflag_set() const;


CL_Component::is_visible - Returns true if component is visible.
bool is_visible() const;


CL_Component::lower - Lowers this component to the bottom of the parent component's stack.
void lower();


CL_Component::popup - Change popup flag.
void popup(bool popup);


CL_Component::quit - Quit the modal loop of the component
void quit();


CL_Component::raise - Raises this component to the top of the parent component's stack.
void raise();


CL_Component::release_mouse - Releases the mouse capture.
void release_mouse();


CL_Component::remove_child - Removes the specified child from the component.
void remove_child(CL_Component* child);


CL_Component::run - Run the component as a modal component until it returns
void run(CL_Component* parent = NULL);


CL_Component::set_focus - Give focus to this component.
void set_focus();


CL_Component::set_gui_manager - Sets the GUI manager this component is attached to.
void set_gui_manager(CL_GUIManager* gui);


CL_Component::set_height - Changes the height of the component.
void set_height(int height);


CL_Component::set_parent - Sets the parent of this component.
void set_parent(CL_Component* parent);


CL_Component::set_position - Sets the position (relative to its parent) and size of this component.
void set_position(const CL_Rect& new_pos);


CL_Component::set_position - Sets the position of this component (relative to its parent).
void set_position(int new_x, int new_y);


CL_Component::set_size - Sets the size of this component.
void set_size(int new_width, int new_height);


CL_Component::set_tab_id - Set the tab id of the component.
void set_tab_id(int id);


CL_Component::set_width - Changes the width of the component.
void set_width(int width);


CL_Component::show - Changes the visibility flag.
void show(bool show = true);


CL_Component::sig_begin_paint - Called prior to component drawing. Sets up a cliprect and translocates coordinates accordingly to this component.
CL_Signal_v0& sig_begin_paint();


CL_Component::sig_child_add - Called when a child component is added to the component.
CL_Signal_v1<CL_Component* >& sig_child_add();


CL_Component::sig_child_before_add - Called when a child component is about to be added to the component.
CL_Signal_v1<CL_Component* >& sig_child_before_add();


CL_Component::sig_child_before_remove - Called when a child component is about to be removed from the component.
CL_Signal_v1<CL_Component* >& sig_child_before_remove();


CL_Component::sig_child_remove - Called when a child component is removed from the component.
CL_Signal_v1<CL_Component* >& sig_child_remove();


CL_Component::sig_end_paint - Cleans up when component drawing is finished (cleans up cliprects and translocation stuff).
CL_Signal_v0& sig_end_paint();


CL_Component::sig_get_maximum_size - Called when needing to find the maximum size of the component.
Normally used by the themes.
CL_Signal_v1<CL_Point& >& sig_get_maximum_size();


CL_Component::sig_get_minimum_size - Called when needing to find the minimum size of the component.
Normally used by the themes.
CL_Signal_v1<CL_Point& >& sig_get_minimum_size();


CL_Component::sig_get_preferred_size - Called when needing to find the preferred size of the component.
Normally used by the themes.
CL_Signal_v1<CL_Point& >& sig_get_preferred_size();


CL_Component::sig_got_focus - Called when component gains focus.
CL_Signal_v0& sig_got_focus();


CL_Component::sig_input_down - Called when any inputdevice button is pressed (keyboard, mouse, joystick, etc).
CL_Signal_v2<CL_InputDevice* , const CL_Key& >& sig_input_down();


CL_Component::sig_input_up - Called when any inputdevice button is released (keyboard, mouse, joystick, etc)
CL_Signal_v2<CL_InputDevice* , const CL_Key& >& sig_input_up();


CL_Component::sig_key_down - Called when a key is pressed on keyboard.
CL_Signal_v1<const CL_Key& >& sig_key_down();


CL_Component::sig_key_up - Called when a key is released on keyboard.
CL_Signal_v1<const CL_Key& >& sig_key_up();


CL_Component::sig_lost_focus - Called when component lose focus.
CL_Signal_v0& sig_lost_focus();


CL_Component::sig_mouse_down - Called when a mousebutton is clicked.
The CL_Key contains the coordinates and which button was pressed
CL_Signal_v1<const CL_Key& >& sig_mouse_down();


CL_Component::sig_mouse_enter - Called when mouse enters the component area.
CL_Signal_v0& sig_mouse_enter();


CL_Component::sig_mouse_leave - Called when mouse leaves the component area.
CL_Signal_v0& sig_mouse_leave();


CL_Component::sig_mouse_move - Called when the mouse is moved.
CL_Signal_v2<int, int>& sig_mouse_move();


CL_Component::sig_mouse_up - Called when a mousebutton is released.
CL_Signal_v1<const CL_Key& >& sig_mouse_up();


CL_Component::sig_move - Called when component is moved.
The two parameters are the OLD positions of the component.
CL_Signal_v2<int, int>& sig_move();


CL_Component::sig_paint - Draws the component. Must be called in a begin_paint() / end_paint() session.
CL_Signal_v0& sig_paint();


CL_Component::sig_paint_children - Called after component drawing, and draws all the children.
CL_Signal_v0& sig_paint_children();


CL_Component::sig_resize - Called when component is resized.
The two parameters are the OLD width and height of the component.
CL_Signal_v2<int, int>& sig_resize();


CL_Component::sig_set_options - Update component with a new set of component options.
CL_Signal_v1<const CL_ComponentOptions& >& sig_set_options();


CL_Component::sig_transform_coords - Called when needing to convert parent coordinates into coordinates used by this component.
This is used in 3D guis to convert from screen coordinates to gui coordinates. (project the screen cordinates down on the plane that the gui is laying on)
CL_Signal_v2<int& , int& >& sig_transform_coords();


CL_Component::update - Calls sig_begin_paint(), then sig_paint(), and finally sig_end_paint().
void update();


CL_Component::~CL_Component - Component Destructor
virtual ~CL_Component();



Variable Member Descriptions: