#include <csapp.h>
Inheritance diagram for csApp:
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. | |
iEvent* | CreateEvent () |
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). | |
csWSTexVector* | GetTextures () |
Return application's texture list. | |
iTextureHandle* | GetTexture (const char *Name) |
Find a texture by name. | |
csMouse& | GetMouse () |
Return application's global mouse object. | |
void | SetMouseCursor (csMouseCursorID ID) |
Set mouse cursor pointer. | |
csMouseCursorID | GetMouseCursor () |
Query mouse cursor pointer. | |
csComponent* | CaptureMouse (csComponent *who) |
Capture all mouse events (or disable capture if NULL). | |
csComponent* | CaptureKeyboard (csComponent *who) |
Capture all keyboard events (or disable capture if NULL). | |
csComponent* | CaptureFocus (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. | |
csComponent* | GetTopModalComponent () |
Get the top component which is currently modal. More... | |
iBase* | GetTopModalUserdata () |
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 csSkin* | GetSkin () |
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. | |
csHintManager& | GetHintManager () |
Get the hint manager object. | |
iFont* | LoadFont (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, UByte &oR, UByte &oG, UByte &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... | |
iGraphics2D* | GetG2D () |
Get the pointer to 2D graphics driver for direct manipulations. More... | |
iGraphics3D* | GetG3D () |
Get the pointer to 2D graphics driver for direct manipulations. More... | |
Public Attributes | |
iObjectRegistry* | object_reg |
The object registry. | |
iVirtualClock* | vc |
The virtual clock. | |
iEventQueue* | event_queue |
The event queue. | |
iPluginManager* | plugin_mgr |
The plugin manager. | |
iVFS* | VFS |
The virtual file system. | |
csConfigAccess | config |
The system configuration. | |
iFontServer* | FontServer |
The font server. | |
iImageIO* | ImageLoader |
The image loader. | |
iKeyboardDriver* | KeyboardDriver |
Keyboard driver. | |
iMouseDriver* | MouseDriver |
Mouse driver. | |
int | Pal [cs_Color_Last] |
Application's adaptive palette. | |
csComponent* | MouseOwner |
The component that captured the mouse. | |
csComponent* | KeyboardOwner |
The component that captured the keyboard. | |
csComponent* | FocusOwner |
The component that captured all focused events (mouse & keyboard). | |
csComponent* | LastMouseContainer |
The component that the mouse was last over. | |
csSkin* | skin |
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). | |
iFont* | DefaultFont |
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. | |
csMouse* | Mouse |
The mouse pointer. | |
csWSTexVector | Textures |
The list of windowing system textures. | |
csHintManager* | hints |
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. | |
iEventOutlet* | EventOutlet |
The system event outlet. | |
csAppBackgroundStyle | BackgroundStyle |
Application background style. | |
bool | InFrame |
Are we inbetween StartFrame() and FinishFrame()? | |
csApp::csAppPlugin * | scfiPlugin |
The iComponent interface. | |
csVector | ModalInfo |
This is a stack of csModalInfo instances to keep track of modality. | |
Friends | |
class | csMouse |
class | csAppPlugin |
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.
|
Get the pointer to 2D graphics driver for direct manipulations. WARNING! Don't abuse of this function! |
|
Get the pointer to 2D graphics driver for direct manipulations. WARNING! Don't abuse of this function! |
|
Get the top component which is currently modal. Or NULL if not in modality. |
|
Get the userdata for the top modal component. Or NULL if not in modality. |
|
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. |
|
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). |