Home | All Classes | Grouped Classes | Index | Search

# Class CL_Component

Component base class. More...

Derived from: none
Derived by: CL_Button CL_ComponentMoveHandler CL_ComponentResizeHandler CL_Frame CL_GUIManager CL_Image CL_InputBox CL_Label CL_ListBox CL_Menu CL_MenuItem CL_MenuNode CL_ProgressBar CL_RichEdit CL_ScrollBar CL_TreeItem CL_TreeView CL_Window
Group: GUI (Framework)

#include <ClanLib/gui.h>

Construction:

CL_Component | Component Constructor

Attributes:

get_client_area | Returns the client area of the component.
get_parent | Returns the parent component, or NULL if none.
get_root_parent | Returns the root parent.
get_gui_manager | Returns the GUI manager that this component is attached to, or NULL if none.
get_style_manager | Returns the style manager used by this component.
get_width | Returns the width of the component.
get_height | Returns the height of the component.
get_screen_x | Returns the components x position in screen coordinates.
get_screen_y | Returns the components y position in screen coordinates.
get_client_x | Returns the components x position in client coordinates.
get_client_y | Returns the components y position in client coordinates.
get_screen_rect | Returns the components position in screen coordinates.
client_to_screen | Returns the rect with coordinates converted from client to screen
screen_to_client | Returns the rect with coordinates converted from screen to client
get_position | Returns the position of this component.
get_position_with_children | Returns the position of this component after extending the rect to fit all children as well
get_minimum_size | Get the minimum size of the component.
get_maximum_size | Get the maximum size of the component.
get_preferred_size | Get the preferred size of the component.
get_vertical_policy | Returns the vertical size policy of the component.
get_horizontal_policy | Returns the horizontal size policy of the component.
get_layout | returns the layout for this component.
get_event_passing | Returns true if event passing is enabled.
has_child | Returns true if the passed component is a child of this component.
get_children | Returns the list of child components.
get_children_rect | Returns the bounding rectangle of the component's children.
get_component_at | Returns the component at (pos_x, pos_y).
get_focus | Returns the component that currently has the focus.
has_focus | Returns true if component has the focus.
is_focusable | Returns true if the component can be focused.
has_mouse_over | Returns true if the mouse is currently highlighting the component.
is_visible | Returns true if component is visible.
is_enabled | Returns true if component accepts user input.
is_mouse_captured | Returns true if component has mouse captured.
get_tab_id | Returns the tab id of the component.
get_style | Returns the component style.
is_modal | Returns true if component is in modal state.
has_modal_parent | Returns true if component have parents which on top of gui_manager modal stack.
is_topmost | Returns true if the topmost flag is set.

Operations:

set_tab_id | Set the tab id of the component.
set_position | Sets the position (relative to its parent) and size of this component.
set_size | Sets the size of this component.
set_width | Changes the width of the component.
set_height | Changes the height of the component.
set_minimum_size | Set the minimum size of the component.
set_maximum_size | Set the maximum size of the component.
set_preferred_size | Set the preferred size of the component.
set_vertical_policy | Set the vertical size policy of the component.
set_horizontal_policy | Set the horizontal size policy of the component.
set_layout | Set the layout for this component.
set_event_passing | Enables/disables the event passing to parent.
set_parent | Sets the parent of this component.
set_gui_manager | Sets the GUI manager this component is attached to.
show | Changes the visibility flag.
enable | Enable/disable user input.
set_focusable | Enable/disable the ability to focus component.
set_focus | Give focus to this component.
raise | Raises this component to the top of the parent component's stack.
lower | Lowers this component to the bottom of the parent component's stack.
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.
release_mouse | Releases the mouse capture.
update | Asks the GUI to repaint itself.
paint | Calls sig_begin_paint(), then sig_paint(), and finally sig_end_paint().
run | Run the component as a modal component until quit() is called.
quit | Quit the modal loop of the component.
close | "Closes" this component. Hides and detaches component from parent.
add_child | Adds the specified component as a children to this component.
remove_child | Removes the specified child from the component.
set_style | Sets a component style to the component.
find_preferred_size | Calculate a default size.
find_tab_id | Returns the component with the specified tab ID.
set_client_area | Set the client area of the component. Not used by user - only by other components.
set_topmost_flag | Sets or clears the topmost flag.
set_clipping | Enables automatic clipping when drawing component.

Signals:

sig_set_options | Update component with a new set of component options.
sig_paint | Draws the component. Must be called in a begin_paint() / end_paint() session.
sig_begin_paint | Called prior to component drawing. Sets up a cliprect and translocates coordinates accordingly to this component.
sig_paint_children | Called after component drawing, and draws all the children.
sig_end_paint | Cleans up when component drawing is finished (cleans up cliprects and translocation stuff).
sig_input_down | Called when any inputdevice button is pressed (keyboard, mouse, joystick, etc).
sig_input_up | Called when any inputdevice button is released (keyboard, mouse, joystick, etc)
sig_key_down | Called when a key is pressed on keyboard.
sig_key_up | Called when a key is released on keyboard.
sig_mouse_down | Called when a mousebutton is clicked. The CL_InputEvent contains the coordinates and which button was pressed
sig_mouse_up | Called when a mousebutton is released.
sig_mouse_dblclk | Called when a mousebutton is doubleclicked.
sig_mouse_move | Called when the mouse is moved.
sig_mouse_enter | Called when mouse enters the component area.
sig_mouse_leave | Called when mouse leaves the component area.
sig_got_focus | Called when component gains focus.
sig_lost_focus | Called when component lose focus.
sig_close | Called when component is closed.
sig_resize | Called when component is resized. The two parameters are the OLD width and height of the component.
sig_move | Called when component is moved. The two parameters are the OLD positions of the component.
sig_child_before_add | Called when a child component is about to be added to the component.
sig_child_add | Called when a child component is added to the component.
sig_child_before_remove | Called when a child component is about to be removed from the component.
sig_child_remove | Called when a child component is removed from the component.
sig_transform_coords | Called when needing to convert parent coordinates into coordinates used by this component.
sig_get_minimum_size | Called when needing to find the minimum size of the component. Normally used by the styles.
sig_get_maximum_size | Called when needing to find the maximum size of the component. Normally used by the styles.
sig_get_preferred_size | Called when needing to find the preferred size of the component. Normally used by the styles.

Implementation:

impl |

Detailed description:

!group=GUI/Framework! !header=gui.h!

The component class is the base class for any component/widget/control (or whatever you call it :)) in the GUI system. It is responsible for painting the component, painting of any child components of it, and it receives the input for a component.

Questions or comments, write to the ClanLib mailing list.