Main Page   Class Hierarchy   Compound List   File List   Compound Members  

csApp Class Reference

This class is a top-level CrystalSpace Windowing Toolkit object. More...

#include <csapp.h>

Inheritance diagram for csApp:

csComponent List of all members.

Public Methods

 csApp (iObjectRegistry *object_reg, csSkin &Skin)
 Initialize windowing system by giving a system driver and a skin.

virtual ~csApp ()
 Deinitialize windowing system.

virtual bool Initialize ()
 Set up application layout (read configs, create windows, menus etc).

void SetSkin (csSkin *Skin, bool DeleteOld=true)
 Set the skin of the application.

virtual void StartFrame ()
 This is called once per frame by HandleEvent ().

virtual void FinishFrame ()
 This is called at the end of every frame.

void FlushEvents ()
 Process all events in the queue and refresh the screen.

iEventCreateEvent ()
 Create a new event object: NEVER create event objects with `new'.

void Post (iEvent *Event)
 Add a previously created event to event queue.

void ShutDown ()
 Shut down the program.

virtual void Idle ()
 The windowing system is idle: do some lazy work.

virtual void Draw ()
 Draw the application background.

virtual void GetFont (iFont *&oFont, int &oFontSize)
 Return default font and font size.

void SetBackgroundStyle (csAppBackgroundStyle iBackgroundStyle)
 Set application background style.

void Printf (int mode, char const *format,...)
 Display a string on the console using almost usual printf() syntax.

void PrintfV (int mode, char const *format, va_list)
 Display a string on the console using almost usual printf() syntax.

bool LoadTexture (const char *iTexName, const char *iTexParams, int iFlags)
 Add a single texture to application's texture list.

virtual void PrepareTextures ()
 Prepare textures for usage (register them with the graphics driver).

csWSTexVectorGetTextures ()
 Return application's texture list.

iTextureHandleGetTexture (const char *Name)
 Find a texture by name.

csMouseGetMouse ()
 Return application's global mouse object.

void SetMouseCursor (csMouseCursorID ID)
 Set mouse cursor pointer.

csMouseCursorID GetMouseCursor ()
 Query mouse cursor pointer.

csComponentCaptureMouse (csComponent *who)
 Capture all mouse events (or disable capture if NULL).

csComponentCaptureKeyboard (csComponent *who)
 Capture all keyboard events (or disable capture if NULL).

csComponentCaptureFocus (csComponent *who)
 Capture all focused events (or disable capture if NULL).

bool GetKeyState (int iKey)
 Query the current state of a key.

csTicks GetCurrentTime ()
 Query current time.

void WindowList ()
 Show window list.

void SetWindowListSize (int iWidth, int iHeight)
 Set window list size.

virtual void Insert (csComponent *comp)
 Insert a child component.

virtual void Delete (csComponent *comp)
 Delete a child component.

bool StartModal (csComponent *comp, iBase *userdata)
 Set modality state on a component. More...

void StopModal (int iCode=cscmdCancel)
 Stop top-level modality state.

csComponentGetTopModalComponent ()
 Get the top component which is currently modal. More...

iBaseGetTopModalUserdata ()
 Get the userdata for the top modal component. More...

void Dismiss (int iCode=cscmdCancel)
 Dismiss a dialog box with given return code.

virtual bool PreHandleEvent (iEvent &Event)
 Handle a event before all others.

virtual bool HandleEvent (iEvent &Event)
 Send event to all childs and return processed status.

virtual bool PostHandleEvent (iEvent &Event)
 Handle a event if nobody eaten it.

virtual void NotifyDelete (csComponent *iComp)
 Every time a component is deleted, this routine is called.

virtual csSkinGetSkin ()
 Get the closest in window hierarchy skin object.

void HintAdd (const char *iText, csComponent *iComp)
 Associate a hint with given component.

void HintRemove (csComponent *iComp)
 Remove the hint associated with given component.

csHintManagerGetHintManager ()
 Get the hint manager object.

iFontLoadFont (const char *iFontName)
 Load a font and return its handle or NULL.

int FindColor (int r, int g, int b)
 Return a color identifier given R,G,B (each 0..255).

int pplColor (int color)
 Convert a logical color into physical.

void pplBox (int x, int y, int w, int h, int color)
 Draw a box.

void pplLine (float x1, float y1, float x2, float y2, int color)
 Draw a line.

void pplPixel (int x, int y, int color)
 Draw a pixel.

void pplText (int x, int y, int fg, int bg, iFont *Font, int FontSize, const char *s)
 Draw a text string: if bg < 0 background is not drawn.

void pplPixmap (csPixmap *s2d, int x, int y, int w, int h, uint8 Alpha)
 Draw a (scaled) pixmap.

void pplTiledPixmap (csPixmap *s2d, int x, int y, int w, int h, int orgx, int orgy, uint8 Alpha)
 Draw a (unscaled but tiled) pixmap.

void pplTexture (iTextureHandle *hTex, int sx, int sy, int sw, int sh, int tx, int ty, int tw, int th, uint8 Alpha=0)
 Draw a (part) of texture (possibly scaled) in given screen rectangle.

void pplSaveArea (csImageArea *&Area, int x, int y, int w, int h)
 Save a part of screen.

void pplRestoreArea (csImageArea *Area, bool Free=false)
 Restore a part of screen.

void pplFreeArea (csImageArea *Area)
 Free buffer used to keep an area of screen.

void pplClear (int color)
 Clear page with specified color.

void pplSetClipRect (int xmin, int ymin, int xmax, int ymax)
 Set clipping rectangle: SHOULD CALL pplRestoreClipRect() AFTER DRAWING!

void pplSetClipRect (csRect &clip)
 Same, but with csRect argument.

void pplRestoreClipRect ()
 Restore clipping rectangle to (0, 0, ScreenW, ScreenH);.

bool ClipLine (float &x1, float &y1, float &x2, float &y2, int ClipX1, int ClipY1, int ClipX2, int ClipY2)
 Clip a line against a rectangle and return true if its clipped out.

bool SwitchMouseCursor (csMouseCursorID Shape)
 Change system mouse cursor and return success status.

void GetPixel (int x, int y, uint8 &oR, uint8 &oG, uint8 &oB)
 Get R,G,B at given screen location.

void pplPolygon3D (G3DPolygonDPFX &poly, uint mode)
 Draw a 3D polygon.

void pplClearZbuffer (int x1, int y1, int x2, int y2)
 Clear the Z-buffer in the given area.

void pplClearZbuffer ()
 Clear the entire Z-buffer (takes effect before next 3D draw operation).

void SetZbufferMode (unsigned mode)
 Set the respective Z-buffer mode (one of CS_ZBUF_XXX constants).

void pplBeginDraw (unsigned mode)
 Begin drawing: users of CSWS should NEVER invoke G2D/G3D->BeginDraw!

void pplInvalidate (csRect &rect)
 Force blitting of the respective rectangle at the end of frame.

void pplDontCacheFrame ()
 Tell the graphics pipeline that you are going to update the entire screen during NEXT frame. More...

iGraphics2DGetG2D ()
 Get the pointer to 2D graphics driver for direct manipulations. More...

iGraphics3DGetG3D ()
 Get the pointer to 2D graphics driver for direct manipulations. More...

Public Attributes

 The object registry.

 The virtual clock.

 The event queue.

 The plugin manager.

 The virtual file system.

csConfigAccess config
 The system configuration.

 The font server.

iImageIO* ImageLoader
 The image loader.

 Keyboard driver.

 Mouse driver.

int Pal [cs_Color_Last]
 Application's adaptive palette.

 The component that captured the mouse.

 The component that captured the keyboard.

 The component that captured all focused events (mouse & keyboard).

 The component that the mouse was last over.

 The global skin repository.

bool WindowListChanged
 This is set to TRUE each time top-level window list changes.

bool InsertMode
 Global "Insert" key state.

int ScreenWidth
 Screen width and height (application can be actually smaller).

int ScreenHeight
 Screen width and height (application can be actually smaller).

 Default font.

int DefaultFontSize
 Default font size.

Protected Methods

void InitializeSkin ()
 Initialize all skin slices with textures and colors etc.

void SetupPalette ()
 setup palette.

Protected Attributes

csGraphicsPipeline GfxPpl
 The graphics pipeline.

 The mouse pointer.

csWSTexVector Textures
 The list of windowing system textures.

 The hints manager.

int WindowListWidth
 Window list width and height.

int WindowListHeight
 Window list width and height.

csMouseCursorID MouseCursorID
 Current & old mouse pointer ID.

csMouseCursorID OldMouseCursorID
 Current & old mouse pointer ID.

int DismissCode
 The code that dialog passed to Dismiss ().

int PhysColorShift
 This is equal to 8 if any of physical r,g,b masks is 0xff000000.

csTicks CurrentTime
 The time at the start of current frame.

 The system event outlet.

csAppBackgroundStyle BackgroundStyle
 Application background style.

bool InFrame
 Are we inbetween StartFrame() and FinishFrame()?

 The iComponent interface.

csVector ModalInfo
 This is a stack of csModalInfo instances to keep track of modality.


class  csMouse
class  csAppPlugin

Detailed Description

This class is a top-level CrystalSpace Windowing Toolkit object.

Generally there should be only one object of this class. Usually it is the root of entire window hierarchy. This class also owns the application-global mouse object, event queue object, graphics pipeline and some others.

The Crystal Space application is a regular plugin from the system driver's point of view.

Member Function Documentation

iGraphics2D * csApp::GetG2D ( ) [inline]

Get the pointer to 2D graphics driver for direct manipulations.

WARNING! Don't abuse of this function!

iGraphics3D * csApp::GetG3D ( ) [inline]

Get the pointer to 2D graphics driver for direct manipulations.

WARNING! Don't abuse of this function!

csComponent * csApp::GetTopModalComponent ( )

Get the top component which is currently modal.

Or NULL if not in modality.

iBase * csApp::GetTopModalUserdata ( )

Get the userdata for the top modal component.

Or NULL if not in modality.

bool csApp::StartModal ( csComponent * comp,
iBase * userdata )

Set modality state on a component.

When the component is dismissed StopModal() will be called automatically. This function returns immediatelly. StartModal() can fail if the component is already modal.

void csApp::pplDontCacheFrame ( ) [inline]

Tell the graphics pipeline that you are going to update the entire screen during NEXT frame.

This will force graphics pipeline to NOT cache the image of the current frame so that it can be propagated to next frame (if during next frame you are going to repaint just a part of screen, propagating image changes through multiple video pages is a MUST, otherwise you will get flickering images).

The documentation for this class was generated from the following file:
Generated for Crystal Space by doxygen 1.2.5 written by Dimitri van Heesch, ©1997-2000