CrystalSpace

Public API Reference

Main Page | Modules | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | File Members | Related Pages

csComponent Class Reference
[Components]

Graphics system component: a menu, window etc. More...

#include <csws/cscomp.h>

Inheritance diagram for csComponent:

csApp csButton csDialog csGrid csGridCell csGridView csHint csInputLine csKeyboardAccelerator csListBox csListBoxItem csMenu csMenuItem csNotebook csScrollBar csSplitter csStatic csTimer csTitleBar csTreeBox csTreeItem csWindow List of all members.

Public Member Functions

 csComponent (csComponent *iParent)
 Create a component and insert it into parent's child list if parent != 0.
virtual ~csComponent ()
 Destroy component and remove it from parent't child list.
virtual void Insert (csComponent *comp)
 Insert a child component.
virtual void Delete (csComponent *comp)
 Delete a child component.
void DeleteAll ()
 Delete all children components.
void InsertClipChild (csComponent *clipchild)
 Insert a 'clip child'.
void DeleteClipChild (csComponent *clipchild)
 Remove a 'clip child'.
csComponentGetClipParent ()
 Return the 'clip parent' component.
virtual bool SetFocused (csComponent *comp)
 Focus a child component.
csComponentGetFocused ()
 Get the focused child window.
bool Select ()
 Select (focus) this component and return true if successful.
virtual csComponentNextChild (csComponent *start=0, bool disabled=false)
 Return next visible selectable child window after 'start'.
virtual csComponentPrevChild (csComponent *start=0, bool disabled=false)
 Return previous visible selectable child window before 'start'.
virtual csComponentNextControl (csComponent *start=0)
 Return next control after 'start', looping through groups.
virtual csComponentPrevControl (csComponent *start=0)
 Return previous control before 'start', looping through groups.
virtual csComponentNextGroup (csComponent *start=0)
 Return control in next group after 'start'.
virtual csComponentPrevGroup (csComponent *start=0)
 Return control in previous group before 'start'.
bool FixFocused ()
 Fix the focused child if it is not selectable (find another).
bool SetZorder (csComponent *comp, csComponent *below)
 Change Z-order of a child component above 'below' (can be 0 for lowest Z-order) neightbour.
csComponentGetTop ()
 Get the top Z-order child window.
void SetPalette (int *iPalette, int iPaletteSize)
 Set component logical palette.
void SetPalette (int iPaletteID)
 Same, but accepts the index into cswsPalette[] array.
void ResetPalette ()
 Reset the palette of the component to the palette it had at startup.
void SetColor (int Index, int Color)
 Set a color value in palette (makes a copy of *palette if not already).
int GetColor (int Index)
 Get a color from logical palette.
virtual void SetText (const char *iText)
 Most components have a text string field.
virtual void GetText (char *oText, size_t iTextSize) const
 Query component text.
virtual const char * GetText () const
 Same, but you cannot change returned value.
csComponentForEach (bool(*func)(csComponent *child, void *param), void *param=0, bool Zorder=false)
 For each child component call a function with a optional arg Function returns the first child on which func returnes 'true' Function can scan from top-Z child (Zorder == true) or from focused child (Zorder == false).
csComponentGetChild (ID find_id) const
 Find a child component by its ID.
void SetApp (csApp *newapp)
 Set the application for this object and all its children.
virtual bool HandleEvent (iEvent &Event)
 Handle a event and return true if processed.
virtual bool PreHandleEvent (iEvent &Event)
 Handle a event BEFORE all others.
virtual bool PostHandleEvent (iEvent &Event)
 Handle a event if nobody eaten it.
void * SendCommand (int CommandCode, void *Info=0)
 Send a command to this window and returns the Info field of iEvent object.
void * SendBroadcast (int CommandCode, void *Info=0)
 Send a broadcast to this window and returns the Info field of iEvent object.
csComponentGetDefault ()
 Find the 'default' child.
void Redraw ()
 Redraw the component if it has a dirty area.
virtual void Draw ()
 Draw the component (only dirty rectangle should be redrawn).
virtual void Show (bool focused=false)
 Show the component (and activate it if focused == true).
virtual void Hide ()
 Hide the component.
virtual bool SetRect (int xmin, int ymin, int xmax, int ymax)
 Set component rectangle to given. Return false if not changed.
bool SetRect (csRect &rect)
 Same, but with csRect argument.
bool SetDragRect (int xmin, int ymin, int xmax, int ymax)
 Calls SetRect after calling FixPosition and FixSize (used when dragging).
void SetPos (int x, int y)
 Set component position to given X and Y.
void SetSize (int w, int h)
 Set component size to given Width and Height.
void Center (bool iHoriz=true, bool iVert=true)
 Center window inside parent.
virtual bool Maximize ()
 Maximize window if it is not already and if DragStyle has CS_DRAG_SIZEABLE.
virtual bool Restore ()
 Restore window if it is maximized and if DragStyle has CS_DRAG_SIZEABLE.
void Invalidate (csRect &area, bool IncludeChildren=false, csComponent *below=0)
 Invalidate a area of component (force a redraw of this area).
void Invalidate (int xmin, int ymin, int xmax, int ymax, bool IncludeChildren=false, csComponent *below=0)
 Same, but with coordinates instead of rectangle.
void Invalidate (bool IncludeChildren=false, csComponent *below=0)
 Same, but invalidates entire component (and possibly all children).
virtual void SetState (int mask, bool enable)
 Set/clear given component state flags.
int GetState (int mask)
 Return component state flags.
void SetDragStyle (int iDragStyle)
 Set drag style flags.
int GetDragStyle ()
 Query drag style flags.
void SetResizeMode (int iResizeMode)
 Set resize mode flags.
int GetResizeMode ()
 Query resize mode flags.
void LocalToGlobal (int &x, int &y)
 Convert a pair of X,Y coordinates from local to global coordinate system.
void GlobalToLocal (int &x, int &y)
 Convert a pair of X,Y coordinates from global to local coordinate system.
void OtherToThis (csComponent *from, int &x, int &y)
 Convert a X,Y pair from coordinate system of another window to this one.
void Drag (int x, int y, int DragMode)
 Drag a window with mouse located at (x,y) window-local coordinates.
void SetMouse (csMouseCursorID Cursor)
 Set mouse cursor pointer.
virtual void Close ()
 Destroy this component.
csComponentGetChildAt (int x, int y, bool(*func)(csComponent *, void *)=0, void *data=0)
 Get the (possibly child) component that is topmost at given x,y location.
void SetSizingCursor (int dragtype)
 Set mouse cursor to one of sizing cursors depending on drag mode flags (dragtype should be any combination of CS_DRAG_XXX bits).
bool GetMousePosition (int &x, int &y)
 Query current mouse location (returns true if mouse is inside this component).
bool HandleDragEvent (iEvent &Event, int BorderW, int BorderH)
 Handle a mouse drag event.
virtual void FixPosition (int &newX, int &newY)
 Fix new window position before assigning to component.
virtual void FixSize (int &newW, int &newH)
 Fix new window size before assigning to component.
virtual void SuggestSize (int &w, int &h)
 Return the recommended minimal size of component.
virtual void SetSuggestedSize (int dw, int dh)
 Set the size of component to minimal possible plus delta.
void FindMaxFreeRect (csRect &area)
 Find the maximal rectangle uncovered by child windows.
virtual char * GetSkinName ()
 Get the name of the skip slice for this component (if not 0).
virtual csSkinGetSkin ()
 Get the closest in window hierarchy skin object.
void SetClipRect (int xmin, int ymin, int xmax, int ymax)
 Set clipping rectangle.
void SetClipRect ()
 Disable clipping.
void SetFont (iFont *iNewFont)
 Set font for this component.
virtual void GetFont (iFont *&oFont)
 Query current text font for this component.
void Box (int xmin, int ymin, int xmax, int ymax, int colindx)
 Draw a box.
void Line (float x1, float y1, float x2, float y2, int colindx)
 Draw a line.
void Pixel (int x, int y, int colindx)
 Draw a pixel.
void Text (int x, int y, int fgindx, int bgindx, const char *s)
 Draw a text string: if bg < 0 background is not drawn.
void Pixmap (csPixmap *s2d, int x, int y, int w, int h, uint8 Alpha=0)
 Draw a (scaled) 2D sprite.
void Pixmap (csPixmap *s2d, int x, int y, uint8 Alpha=0)
 Draw a (non-scaled) 2D sprite.
void Pixmap (csPixmap *s2d, int x, int y, int w, int h, int orgx, int orgy, uint8 Alpha=0)
 Draw a (tiled) pixmap (orgy stands for "origin y", not what you though of - shame!).
void Texture (iTextureHandle *tex, int x, int y, int w, int h, int orgx, int orgy, uint8 Alpha=0)
 Draw a (possibly tiled) texture, possibly semi-transparent.
int GetTextSize (const char *text, int *oHeight=0)
 Return the width of given text using current font (and possibly height).
int GetTextChars (const char *text, int iWidth)
 Return how many letters from given string fits in this number of pixels.
void Rect3D (int xmin, int ymin, int xmax, int ymax, int darkindx, int lightindx)
 Draw a 3D-looking thin rectangle.
void ObliqueRect3D (int xmin, int ymin, int xmax, int ymax, int cornersize, int darkindx, int lightindx)
 Draw a 3D rectangle with two oblique corners (used for buttons, for example).
void Clear (int colindx)
 Clear the entire component with given color.
void ClearZbuffer (int xmin, int ymin, int xmax, int ymax)
 Clear the Z-buffer in the given rectangle.
void ClearZbuffer ()
 Clear the Z-buffer in the area covered by this component.
void DrawUnderline (int iX, int iY, const char *iText, size_t iUnderlinePos, int iColor)
 -------------------------------------- Utility drawing functions ---------- Draw a underline under iText drawn at iX,iY with iColor

Public Attributes

csComponentfocused
 The focused child window.
csComponenttop
 The top-Z child window.
csComponentnext
 Next and previous neightbours.
csComponentprev
 Next and previous neightbours.
csComponentparent
 Parent component or 0.
csAppapp
 Top-level application object.
csSkinSliceskinslice
 Component skin slice.
void ** skindata
 Abstract pointer for internal use by skin slice.
ID id
 Component ID, unique within its parrent's child ring.
csRect bound
 Component size/position rectangle.

Protected Member Functions

void Clip (cswsRectVector &rect, csComponent *last, bool forchild=false)
 Clip a set of rectangles so that they will contain only rectangles uncovered by other windows.
void ClipChild (cswsRectVector &rect, csComponent *child)
 Clip the rectangle set against given child.
void FastClip (cswsRectVector &rect)
 Perform fast clipping by using the pre-cached visible region initialized at start of Redraw().
bool CheckHotKey (iEvent &iEvent, char iHotKey)
 Check if the keyboard event fits given hot key.
bool ApplySkin (csSkin *Skin)
 Apply a skin only to this component: returns true on success.
void CheckDirtyTD (csRect &ioR)
 Perform a check of this component and all dirty children' dirty areas: if child component is transparent, unify his dirty area with this component's dirty area.
void CheckDirtyBU (csRect &ioR)
 Same as CheckDirtyTD but the check is performed in the inverse direction - from bottom up (`BU').

Static Protected Member Functions

void PrepareLabel (const char *iLabel, char *&oLabel, size_t &oUnderlinePos)
 Prepare a label.
size_t WordLeft (const char *iText, size_t StartPos)
 Utility functions: return position one word left from StartPos.
size_t WordRight (const char *iText, size_t StartPos)
 Return position one word right from StartPos.

Protected Attributes

int state
 Object state flags (see CSS_XXX flags).
csRect dirty
 Rectangle that should be redrawn.
csRect clip
 Clipping rectangle (if not empty).
int * palette
 Component palette and palette length.
int palettesize
 Component palette and palette length.
int * originalpalette
 Original component palette.
csRect OrgBound
 Original bound when window is maximized.
char DragStyle
 Window drag style (see CS_DRAG_XXX above).
char ResizeMode
 What to do when parent size changes (see CS_LOCK_XXX flags).
csComponentclipparent
 Component against which this component is clipped

.

char * text
 Most components contain a text string. Unify the interface.
iFontFont
 Current font (or 0 if should use parent font).
int FontSize
 Current font size.
csArray< csComponent * > clipchildren
 An array of 'clip children', i.e. components which are clipped inside our bounds.

Static Protected Attributes

int dragX
 Used on drag operations.
csRectdragBound
 The component bound before drag started.
cswsRectVectorvisregion
 This field is used to cache current clipping region during every Redraw().

Detailed Description

Graphics system component: a menu, window etc.

This is an abstract base class: all windowing system classes should be subclassed from csComponent. Each component can have a number of child components. Child components are chained together in a ring list; the only case when a 0 can be encountered in this list is when component has no children. When a component has at least one child and if you traverse the child list you should take care to avoid looping forever through them.

A csComponent object is a rectangle area of screen which can contain absolutely any content. The object is responsible for filling all pixels within that rectangle, i.e. underlying windows will never touch other window's area. If the component's `state' field has the CSS_TRANSPARENT bit set, the component can have partially transparent parts (those are filled by underlying component(s)). In this case the underlying components are painted before this component, and then anything you draw inside the Draw() method is overlayed onto parent component's image.

Definition at line 351 of file cscomp.h.


Constructor & Destructor Documentation

csComponent::csComponent csComponent iParent  ) 
 

Create a component and insert it into parent's child list if parent != 0.

virtual csComponent::~csComponent  )  [virtual]
 

Destroy component and remove it from parent't child list.


Member Function Documentation

bool csComponent::ApplySkin csSkin Skin  )  [protected]
 

Apply a skin only to this component: returns true on success.

void csComponent::Box int  xmin,
int  ymin,
int  xmax,
int  ymax,
int  colindx
 

Draw a box.

Referenced by Clear().

void csComponent::Center bool  iHoriz = true,
bool  iVert = true
 

Center window inside parent.

void csComponent::CheckDirtyBU csRect ioR  )  [protected]
 

Same as CheckDirtyTD but the check is performed in the inverse direction - from bottom up (`BU').

This routine checks if the transparent child components are covered by this component's dirty area; if so, the respective areas of child windows are marked as dirty as well.

void csComponent::CheckDirtyTD csRect ioR  )  [protected]
 

Perform a check of this component and all dirty children' dirty areas: if child component is transparent, unify his dirty area with this component's dirty area.

You will never need to call this function manually; this is done automatically. The `TD' prefix stands for `top-doen', that is the Z-order in which the check is performed.

bool csComponent::CheckHotKey iEvent iEvent,
char  iHotKey
[protected]
 

Check if the keyboard event fits given hot key.

void csComponent::Clear int  colindx  )  [inline]
 

Clear the entire component with given color.

Definition at line 814 of file cscomp.h.

References bound, Box(), csRect::Height(), and csRect::Width().

void csComponent::ClearZbuffer  )  [inline]
 

Clear the Z-buffer in the area covered by this component.

Definition at line 821 of file cscomp.h.

References bound, csRect::Height(), and csRect::Width().

void csComponent::ClearZbuffer int  xmin,
int  ymin,
int  xmax,
int  ymax
 

Clear the Z-buffer in the given rectangle.

void csComponent::Clip cswsRectVector rect,
csComponent last,
bool  forchild = false
[protected]
 

Clip a set of rectangles so that they will contain only rectangles uncovered by other windows.

Initial rectangles are in local coordinates, final rectangles are in global coordinates.

void csComponent::ClipChild cswsRectVector rect,
csComponent child
[protected]
 

Clip the rectangle set against given child.

virtual void csComponent::Close  )  [virtual]
 

Destroy this component.

You should not call any methods or use any variables after this! When this function returns, the object is already destroyed.

virtual void csComponent::Delete csComponent comp  )  [virtual]
 

Delete a child component.

Reimplemented in csApp, csListBox, csMenu, and csTreeItem.

void csComponent::DeleteAll  ) 
 

Delete all children components.

void csComponent::DeleteClipChild csComponent clipchild  ) 
 

Remove a 'clip child'.

void csComponent::Drag int  x,
int  y,
int  DragMode
 

Drag a window with mouse located at (x,y) window-local coordinates.

virtual void csComponent::Draw  )  [virtual]
 

Draw the component (only dirty rectangle should be redrawn).

Reimplemented in csApp, csColorWheel, csGridCell, csGridView, csGrid, csHint, csInputLine, csLayout, csMenuItem, csMenu, csNotebook, csSpinBox, csSplitter, csStatic, csTreeItem, and csTreeBox.

void csComponent::DrawUnderline int  iX,
int  iY,
const char *  iText,
size_t  iUnderlinePos,
int  iColor
 

-------------------------------------- Utility drawing functions ---------- Draw a underline under iText drawn at iX,iY with iColor

void csComponent::FastClip cswsRectVector rect  )  [protected]
 

Perform fast clipping by using the pre-cached visible region initialized at start of Redraw().

This has the side effect that any drawing operation that happens outside the Draw() method is effectively clipped away.

void csComponent::FindMaxFreeRect csRect area  ) 
 

Find the maximal rectangle uncovered by child windows.

bool csComponent::FixFocused  ) 
 

Fix the focused child if it is not selectable (find another).

virtual void csComponent::FixPosition int &  newX,
int &  newY
[virtual]
 

Fix new window position before assigning to component.

virtual void csComponent::FixSize int &  newW,
int &  newH
[virtual]
 

Fix new window size before assigning to component.

Reimplemented in csDialog, csGridView, csGrid, csLayout, and csWindow.

csComponent* csComponent::ForEach bool(*)(csComponent *child, void *param)  func,
void *  param = 0,
bool  Zorder = false
 

For each child component call a function with a optional arg Function returns the first child on which func returnes 'true' Function can scan from top-Z child (Zorder == true) or from focused child (Zorder == false).

csComponent* csComponent::GetChild ID  find_id  )  const
 

Find a child component by its ID.

csComponent* csComponent::GetChildAt int  x,
int  y,
bool(*)(csComponent *, void *)  func = 0,
void *  data = 0
 

Get the (possibly child) component that is topmost at given x,y location.

This is useful, for example, to get the component under mouse cursor. You can provide a test function that will be called for "transparent" childs; if the child has the CSS_TRANSPARENT flag set, this routine will be called to determine whenever we should go further below this child. If the routine is 0, it will stop at the first transparent child. If the routine returns true, GetChildAt() will return given child component.

csComponent* csComponent::GetClipParent  )  [inline]
 

Return the 'clip parent' component.

Definition at line 449 of file cscomp.h.

int csComponent::GetColor int  Index  )  [inline]
 

Get a color from logical palette.

Definition at line 516 of file cscomp.h.

References palette.

csComponent* csComponent::GetDefault  ) 
 

Find the 'default' child.

int csComponent::GetDragStyle  )  [inline]
 

Query drag style flags.

Definition at line 643 of file cscomp.h.

csComponent* csComponent::GetFocused  )  [inline]
 

Get the focused child window.

Definition at line 456 of file cscomp.h.

virtual void csComponent::GetFont iFont *&  oFont  )  [virtual]
 

Query current text font for this component.

Reimplemented in csApp.

bool csComponent::GetMousePosition int &  x,
int &  y
 

Query current mouse location (returns true if mouse is inside this component).

int csComponent::GetResizeMode  )  [inline]
 

Query resize mode flags.

Definition at line 651 of file cscomp.h.

virtual csSkin* csComponent::GetSkin  )  [virtual]
 

Get the closest in window hierarchy skin object.

Reimplemented in csApp.

virtual char* csComponent::GetSkinName  )  [virtual]
 

Get the name of the skip slice for this component (if not 0).

Reimplemented in csButton, csDialog, csListBoxItem, csListBox, csScrollBar, csTitleBar, and csWindow.

int csComponent::GetState int  mask  )  [inline]
 

Return component state flags.

Definition at line 635 of file cscomp.h.

References state.

Referenced by csWindow::GetAlpha(), csDialog::GetAlpha(), and csDialog::GetOverlayAlpha().

virtual const char* csComponent::GetText  )  const [inline, virtual]
 

Same, but you cannot change returned value.

Reimplemented in csWindow.

Definition at line 530 of file cscomp.h.

virtual void csComponent::GetText char *  oText,
size_t  iTextSize
const [virtual]
 

Query component text.

int csComponent::GetTextChars const char *  text,
int  iWidth
 

Return how many letters from given string fits in this number of pixels.

int csComponent::GetTextSize const char *  text,
int *  oHeight = 0
 

Return the width of given text using current font (and possibly height).

csComponent* csComponent::GetTop  )  [inline]
 

Get the top Z-order child window.

Definition at line 490 of file cscomp.h.

void csComponent::GlobalToLocal int &  x,
int &  y
 

Convert a pair of X,Y coordinates from global to local coordinate system.

bool csComponent::HandleDragEvent iEvent Event,
int  BorderW,
int  BorderH
 

Handle a mouse drag event.

Check if mouse cursor is within BorderW/BorderH distance from window border; for mouse move events just sets the corresponding mouse shape (if DragMode has CS_DRAG_SIZEABLE bit set). If event is a mouse down event and mouse cursor falls within that distance from window border either resize or move window mode is entered. The function returns "true" if event has been processed, and false if it can be processed by other handlers. This function is handy to call from event handlers of all windows that can be resized and/or moved, example:

   switch (Event.Type)
   {
     case csevMouseDown:
     case csevMouseMove:
       if (HandleDragEvent (Event, BorderWidth, BorderHeight))
         return true;
       return csComponent::HandleEvent (Event);
     ...
   }
 

virtual bool csComponent::HandleEvent iEvent Event  )  [virtual]
 

Handle a event and return true if processed.

Reimplemented in csApp, csButton, csCheckBox, csColorWheel, csDialog, csGridView, csGrid, csInputLine, csLayout, csListBoxItem, csListBox, csMenuItem, csMenu, csNotebook, csRadioButton, csScrollBar, csSpinBox, csSplitter, csStatic, csTimer, csTreeItem, csTreeBox, csTitleBar, csWindow, and csWindowList.

virtual void csComponent::Hide  )  [virtual]
 

Hide the component.

virtual void csComponent::Insert csComponent comp  )  [virtual]
 

Insert a child component.

Reimplemented in csApp, csLayout, csListBox, csMenu, csTreeItem, and csTreeBox.

void csComponent::InsertClipChild csComponent clipchild  ) 
 

Insert a 'clip child'.

void csComponent::Invalidate bool  IncludeChildren = false,
csComponent below = 0
[inline]
 

Same, but invalidates entire component (and possibly all children).

Definition at line 628 of file cscomp.h.

References Invalidate().

void csComponent::Invalidate int  xmin,
int  ymin,
int  xmax,
int  ymax,
bool  IncludeChildren = false,
csComponent below = 0
[inline]
 

Same, but with coordinates instead of rectangle.

Definition at line 620 of file cscomp.h.

References Invalidate().

void csComponent::Invalidate csRect area,
bool  IncludeChildren = false,
csComponent below = 0
 

Invalidate a area of component (force a redraw of this area).

If fIncludeChildren is true, all child components that covers this area of parent will be partially invalidated as well. Additionaly, if 'below' is not 0, only the child components that are below 'below' in Z-order or CSS_TRANSPARENT components that are 'above' in Z-order will be invalidated.

Referenced by Invalidate(), csListBoxItem::SetOffset(), and csButton::SetText().

void csComponent::Line float  x1,
float  y1,
float  x2,
float  y2,
int  colindx
 

Draw a line.

void csComponent::LocalToGlobal int &  x,
int &  y
 

Convert a pair of X,Y coordinates from local to global coordinate system.

virtual bool csComponent::Maximize  )  [virtual]
 

Maximize window if it is not already and if DragStyle has CS_DRAG_SIZEABLE.

Reimplemented in csWindow.

virtual csComponent* csComponent::NextChild csComponent start = 0,
bool  disabled = false
[virtual]
 

Return next visible selectable child window after 'start'.

virtual csComponent* csComponent::NextControl csComponent start = 0  )  [virtual]
 

Return next control after 'start', looping through groups.

virtual csComponent* csComponent::NextGroup csComponent start = 0  )  [virtual]
 

Return control in next group after 'start'.

void csComponent::ObliqueRect3D int  xmin,
int  ymin,
int  xmax,
int  ymax,
int  cornersize,
int  darkindx,
int  lightindx
 

Draw a 3D rectangle with two oblique corners (used for buttons, for example).

void csComponent::OtherToThis csComponent from,
int &  x,
int &  y
 

Convert a X,Y pair from coordinate system of another window to this one.

This works faster than GlobalToLocal/LocalToGlobal pair in the case when this component is a N-th level parent for the 'from' component.

void csComponent::Pixel int  x,
int  y,
int  colindx
 

Draw a pixel.

void csComponent::Pixmap csPixmap s2d,
int  x,
int  y,
int  w,
int  h,
int  orgx,
int  orgy,
uint8  Alpha = 0
 

Draw a (tiled) pixmap (orgy stands for "origin y", not what you though of - shame!).

void csComponent::Pixmap csPixmap s2d,
int  x,
int  y,
uint8  Alpha = 0
[inline]
 

Draw a (non-scaled) 2D sprite.

Definition at line 792 of file cscomp.h.

References csPixmap::Height(), Pixmap(), and csPixmap::Width().

void csComponent::Pixmap csPixmap s2d,
int  x,
int  y,
int  w,
int  h,
uint8  Alpha = 0
 

Draw a (scaled) 2D sprite.

Referenced by Pixmap().

virtual bool csComponent::PostHandleEvent iEvent Event  )  [virtual]
 

Handle a event if nobody eaten it.

Reimplemented in csApp, csButton, csKeyboardAccelerator, and csStatic.

virtual bool csComponent::PreHandleEvent iEvent Event  )  [virtual]
 

Handle a event BEFORE all others.

You will receive ALL events including focused events. For example, a object will receive mouse events even if object is not visible. A object should take care not to block events expected by other objects.

Reimplemented in csApp, csHint, and csMenu.

void csComponent::PrepareLabel const char *  iLabel,
char *&  oLabel,
size_t &  oUnderlinePos
[static, protected]
 

Prepare a label.

Search for '~' in iLabel, and copy text without '~' into oLabel. Former underline position is stored into oUnderlinePos. This is used by labels, menuitems, static components etc.

Referenced by csButton::SetText().

virtual csComponent* csComponent::PrevChild csComponent start = 0,
bool  disabled = false
[virtual]
 

Return previous visible selectable child window before 'start'.

virtual csComponent* csComponent::PrevControl csComponent start = 0  )  [virtual]
 

Return previous control before 'start', looping through groups.

virtual csComponent* csComponent::PrevGroup csComponent start = 0  )  [virtual]
 

Return control in previous group before 'start'.

void csComponent::Rect3D int  xmin,
int  ymin,
int  xmax,
int  ymax,
int  darkindx,
int  lightindx
 

Draw a 3D-looking thin rectangle.

void csComponent::Redraw  ) 
 

Redraw the component if it has a dirty area.

void csComponent::ResetPalette  ) 
 

Reset the palette of the component to the palette it had at startup.

virtual bool csComponent::Restore  )  [virtual]
 

Restore window if it is maximized and if DragStyle has CS_DRAG_SIZEABLE.

Reimplemented in csWindow.

bool csComponent::Select  ) 
 

Select (focus) this component and return true if successful.

void* csComponent::SendBroadcast int  CommandCode,
void *  Info = 0
 

Send a broadcast to this window and returns the Info field of iEvent object.

void* csComponent::SendCommand int  CommandCode,
void *  Info = 0
 

Send a command to this window and returns the Info field of iEvent object.

Referenced by csTreeItem::ResetButton().

void csComponent::SetApp csApp newapp  ) 
 

Set the application for this object and all its children.

void csComponent::SetClipRect  )  [inline]
 

Disable clipping.

Definition at line 768 of file cscomp.h.

References clip, and csRect::MakeEmpty().

void csComponent::SetClipRect int  xmin,
int  ymin,
int  xmax,
int  ymax
[inline]
 

Set clipping rectangle.

All following drawing will be clipped against given rectangle. Setting w=0 or h=0 will disable clipping (although it will be anyway performed relative to component bound).

Definition at line 764 of file cscomp.h.

References clip, and csRect::Set().

void csComponent::SetColor int  Index,
int  Color
 

Set a color value in palette (makes a copy of *palette if not already).

bool csComponent::SetDragRect int  xmin,
int  ymin,
int  xmax,
int  ymax
 

Calls SetRect after calling FixPosition and FixSize (used when dragging).

void csComponent::SetDragStyle int  iDragStyle  )  [inline]
 

Set drag style flags.

Definition at line 639 of file cscomp.h.

References DragStyle.

virtual bool csComponent::SetFocused csComponent comp  )  [virtual]
 

Focus a child component.

Reimplemented in csListBox, and csTreeItem.

void csComponent::SetFont iFont iNewFont  ) 
 

Set font for this component.

void csComponent::SetMouse csMouseCursorID  Cursor  ) 
 

Set mouse cursor pointer.

void csComponent::SetPalette int  iPaletteID  )  [inline]
 

Same, but accepts the index into cswsPalette[] array.

Definition at line 506 of file cscomp.h.

References cswsPalette, and SetPalette().

void csComponent::SetPalette int *  iPalette,
int  iPaletteSize
 

Set component logical palette.

Each component has its own logical palette. A logical palette component is a index into a global table which resides in csApp object. The table in csApp maps a color (such as cs_Color_White) to a real index into the physical palette.

It is highly desirable for components to contain in their 1st element their background color. This is sometimes used (for example by irregularily-shaped buttons).

Referenced by SetPalette().

void csComponent::SetPos int  x,
int  y
[inline]
 

Set component position to given X and Y.

Definition at line 592 of file cscomp.h.

References bound, SetRect(), csRect::xmax, csRect::xmin, csRect::ymax, and csRect::ymin.

bool csComponent::SetRect csRect rect  )  [inline]
 

Same, but with csRect argument.

Definition at line 585 of file cscomp.h.

References SetRect(), csRect::xmax, csRect::xmin, csRect::ymax, and csRect::ymin.

virtual bool csComponent::SetRect int  xmin,
int  ymin,
int  xmax,
int  ymax
[virtual]
 

Set component rectangle to given. Return false if not changed.

Reimplemented in csDialog, csGridView, csGrid, csLayout, csListBox, csMenuItem, csMenu, csNotebook, csScrollBar, csSplitter, csTreeBox, csWindow, and csWindowList.

Referenced by csTreeItem::ResetButton(), SetPos(), SetRect(), and SetSize().

void csComponent::SetResizeMode int  iResizeMode  )  [inline]
 

Set resize mode flags.

Definition at line 647 of file cscomp.h.

References ResizeMode.

void csComponent::SetSize int  w,
int  h
[inline]
 

Set component size to given Width and Height.

Definition at line 596 of file cscomp.h.

References bound, SetRect(), csRect::xmin, and csRect::ymin.

void csComponent::SetSizingCursor int  dragtype  ) 
 

Set mouse cursor to one of sizing cursors depending on drag mode flags (dragtype should be any combination of CS_DRAG_XXX bits).

virtual void csComponent::SetState int  mask,
bool  enable
[virtual]
 

Set/clear given component state flags.

Reimplemented in csButton, csInputLine, csListBoxItem, csListBox, csMenu, csScrollBar, csTreeItem, csTreeBox, csWindow, and csWindowList.

virtual void csComponent::SetSuggestedSize int  dw,
int  dh
[virtual]
 

Set the size of component to minimal possible plus delta.

virtual void csComponent::SetText const char *  iText  )  [virtual]
 

Most components have a text string field.

For example, titlebars, buttons, input lines, static components etc etc etc. The following routines are used to access this field in a component-independent manner.

Reimplemented in csButton, csHint, csInputLine, csMenuItem, csSpinBox, csStatic, and csWindow.

bool csComponent::SetZorder csComponent comp,
csComponent below
 

Change Z-order of a child component above 'below' (can be 0 for lowest Z-order) neightbour.

virtual void csComponent::Show bool  focused = false  )  [virtual]
 

Show the component (and activate it if focused == true).

virtual void csComponent::SuggestSize int &  w,
int &  h
[virtual]
 

Return the recommended minimal size of component.

Reimplemented in csAbsoluteLayout, csGridBagLayout, csBorderLayout, csBoxLayout, csButton, csDialog, csFlowLayout, csGridLayout, csGridView, csGrid, csInputLine, csLayout, csListBoxItem, csListBox, csMenuItem, csMenu, csStatic, and csTreeItem.

void csComponent::Text int  x,
int  y,
int  fgindx,
int  bgindx,
const char *  s
 

Draw a text string: if bg < 0 background is not drawn.

void csComponent::Texture iTextureHandle tex,
int  x,
int  y,
int  w,
int  h,
int  orgx,
int  orgy,
uint8  Alpha = 0
 

Draw a (possibly tiled) texture, possibly semi-transparent.

size_t csComponent::WordLeft const char *  iText,
size_t  StartPos
[static, protected]
 

Utility functions: return position one word left from StartPos.

size_t csComponent::WordRight const char *  iText,
size_t  StartPos
[static, protected]
 

Return position one word right from StartPos.


Member Data Documentation

csApp* csComponent::app
 

Top-level application object.

Definition at line 418 of file cscomp.h.

csRect csComponent::bound
 

Component size/position rectangle.

Definition at line 426 of file cscomp.h.

Referenced by Clear(), ClearZbuffer(), SetPos(), and SetSize().

csRect csComponent::clip [protected]
 

Clipping rectangle (if not empty).

Definition at line 359 of file cscomp.h.

Referenced by SetClipRect().

csArray<csComponent*> csComponent::clipchildren [protected]
 

An array of 'clip children', i.e. components which are clipped inside our bounds.

Definition at line 385 of file cscomp.h.

csComponent* csComponent::clipparent [protected]
 

Component against which this component is clipped

.

Definition at line 377 of file cscomp.h.

csRect csComponent::dirty [protected]
 

Rectangle that should be redrawn.

Definition at line 357 of file cscomp.h.

csRect* csComponent::dragBound [static, protected]
 

The component bound before drag started.

Definition at line 375 of file cscomp.h.

char csComponent::DragStyle [protected]
 

Window drag style (see CS_DRAG_XXX above).

Definition at line 367 of file cscomp.h.

Referenced by SetDragStyle().

int csComponent::dragX [static, protected]
 

Used on drag operations.

Definition at line 371 of file cscomp.h.

csComponent* csComponent::focused
 

The focused child window.

Definition at line 410 of file cscomp.h.

iFont* csComponent::Font [protected]
 

Current font (or 0 if should use parent font).

Definition at line 381 of file cscomp.h.

int csComponent::FontSize [protected]
 

Current font size.

Definition at line 383 of file cscomp.h.

ID csComponent::id
 

Component ID, unique within its parrent's child ring.

Definition at line 424 of file cscomp.h.

csComponent* csComponent::next
 

Next and previous neightbours.

Definition at line 414 of file cscomp.h.

csRect csComponent::OrgBound [protected]
 

Original bound when window is maximized.

Definition at line 365 of file cscomp.h.

int* csComponent::originalpalette [protected]
 

Original component palette.

Definition at line 363 of file cscomp.h.

int* csComponent::palette [protected]
 

Component palette and palette length.

Definition at line 361 of file cscomp.h.

Referenced by GetColor().

int csComponent::palettesize [protected]
 

Component palette and palette length.

Definition at line 361 of file cscomp.h.

csComponent* csComponent::parent
 

Parent component or 0.

Definition at line 416 of file cscomp.h.

csComponent * csComponent::prev
 

Next and previous neightbours.

Definition at line 414 of file cscomp.h.

char csComponent::ResizeMode [protected]
 

What to do when parent size changes (see CS_LOCK_XXX flags).

Definition at line 369 of file cscomp.h.

Referenced by SetResizeMode().

void** csComponent::skindata
 

Abstract pointer for internal use by skin slice.

Definition at line 422 of file cscomp.h.

csSkinSlice* csComponent::skinslice
 

Component skin slice.

Definition at line 420 of file cscomp.h.

int csComponent::state [protected]
 

Object state flags (see CSS_XXX flags).

Definition at line 355 of file cscomp.h.

Referenced by GetState().

char* csComponent::text [protected]
 

Most components contain a text string. Unify the interface.

Definition at line 379 of file cscomp.h.

csComponent* csComponent::top
 

The top-Z child window.

Definition at line 412 of file cscomp.h.

cswsRectVector* csComponent::visregion [static, protected]
 

This field is used to cache current clipping region during every Redraw().

Definition at line 387 of file cscomp.h.


The documentation for this class was generated from the following file:
Generated for Crystal Space by doxygen 1.3.9.1