Public Methods |
| csComponent (csComponent *iParent) |
| Create a component and insert it into parent's child list if parent != NULL.
|
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'.
|
csComponent* | GetClipParent () |
| Return the 'clip parent' component.
|
virtual bool | SetFocused (csComponent *comp) |
| Focus a child component.
|
csComponent* | GetFocused () |
| Get the focused child window.
|
bool | Select () |
| Select (focus) this component and return true if successful.
|
virtual csComponent* | NextChild (csComponent *start=NULL, bool disabled=false) |
| Return next visible selectable child window after 'start'.
|
virtual csComponent* | PrevChild (csComponent *start=NULL, bool disabled=false) |
| Return previous visible selectable child window before 'start'.
|
virtual csComponent* | NextControl (csComponent *start=NULL) |
| Return next control after 'start', looping through groups.
|
virtual csComponent* | PrevControl (csComponent *start=NULL) |
| Return previous control before 'start', looping through groups.
|
virtual csComponent* | NextGroup (csComponent *start=NULL) |
| Return control in next group after 'start'.
|
virtual csComponent* | PrevGroup (csComponent *start=NULL) |
| 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 NULL for lowest Z-order) neightbour.
|
csComponent* | GetTop () |
| Get the top Z-order child window.
|
void | SetPalette (int *iPalette, int iPaletteSize) |
| Set component logical palette.<. More...
|
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. More...
|
virtual void | GetText (char *oText, int iTextSize) const |
| Query component text.
|
virtual const char* | GetText () const |
| Same, but you cannot change returned value.
|
csComponent* | ForEach (bool(*func)(csComponent *child, void *param), void *param=NULL, 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* | GetChild (int 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. More...
|
virtual bool | PostHandleEvent (iEvent &Event) |
| Handle a event if nobody eaten it.
|
void* | SendCommand (int CommandCode, void *Info=NULL) |
| Send a command to this window and returns the Info field of iEvent object.
|
void* | SendBroadcast (int CommandCode, void *Info=NULL) |
| Send a broadcast to this window and returns the Info field of iEvent object.
|
csComponent* | GetDefault () |
| 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=NULL) |
| Invalidate a area of component (force a redraw of this area). More...
|
void | Invalidate (int xmin, int ymin, int xmax, int ymax, bool IncludeChildren=false, csComponent *below=NULL) |
| Same, but with coordinates instead of rectangle.
|
void | Invalidate (bool IncludeChildren=false, csComponent *below=NULL) |
| 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. More...
|
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<. More...
|
csComponent* | GetChildAt (int x, int y, bool(*func)(csComponent *, void *)=NULL, void *data=NULL) |
| Get the (possibly child) component that is topmost at given x,y location. More...
|
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. More...
|
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 NULL).
|
virtual csSkin* | GetSkin () |
| Get the closest in window hierarchy skin object.
|
void | SetClipRect (int xmin, int ymin, int xmax, int ymax) |
| Set clipping rectangle. More...
|
void | SetClipRect () |
| Disable clipping.
|
void | SetFont (iFont *iNewFont, int iSize=-1) |
| Set font for this component and the size (-1 - leave as-is, 0 - from parent).
|
virtual void | GetFont (iFont *&oFont, int &oFontSize) |
| Query current text font and his size 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=NULL) |
| 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 | Polygon3D (G3DPolygonDPFX &poly, uint mode) |
| Draw a 3D polygon.
|
void | DrawUnderline (int iX, int iY, const char *iText, int iUnderlinePos, int iColor) |
| -------------------------------------- Utility drawing functions ---------- Draw a underline under iText drawn at iX,iY with iColor.
|
Public Attributes |
csComponent* | focused |
| The focused child window.
|
csComponent* | top |
| The top-Z child window.
|
csComponent* | next |
| Next and previous neightbours.
|
csComponent * | prev |
| Next and previous neightbours.
|
csComponent* | parent |
| Parent component or NULL.
|
csApp* | app |
| Top-level application object.
|
csSkinSlice* | skinslice |
| Component skin slice.
|
csSome* | skindata |
| Abstract pointer for internal use by skin slice.
|
unsigned int | id |
| Component ID, unique within its parrent's child ring.
|
csRect | bound |
| Component size/position rectangle.
|
Protected Methods |
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. More...
|
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(). More...
|
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. More...
|
void | CheckDirtyBU (csRect &ioR) |
| Same as CheckDirtyTD but the check is performed in the inverse direction - from bottom up (`BU'). More...
|
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).
|
csComponent* | clipparent |
| Component against which this component is clipped
.
|
char* | text |
| Most components contain a text string. Unify the interface.
|
iFont* | Font |
| Current font (or NULL if should use parent font).
|
int | FontSize |
| Current font size.
|
csVector | clipchildren |
| An array of 'clip children', i.e. components which are clipped inside our bounds.
|
Static Protected Methods |
void | PrepareLabel (const char *iLabel, char *&oLabel, int &oUnderlinePos) |
| Prepare a label. More...
|
int | WordLeft (const char *iText, int StartPos) |
| Utility functions: return position one word left from StartPos.
|
int | WordRight (const char *iText, int StartPos) |
| Return position one word right from StartPos.
|
Static Protected Attributes |
int | dragX |
| Used on drag operations.
|
int | dragY |
| Used on drag operations.
|
int | dragMode |
| Used on drag operations.
|
csRect* | dragBound |
| The component bound before drag started.
|
cswsRectVector* | visregion |
| This field is used to cache current clipping region during every Redraw().
|
p> 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 NULL 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.