HPGCC3 Documentation 3.0 R003

gui.h

Go to the documentation of this file.
00001 //& *** (c) 2006-2011 The HPGCC3 Team ***
00002 //& Claudio Lapilli
00003 //& Ingo Blank
00004 //&
00005 //& This file is licensed under the terms and conditions of the
00006 //& HPGCC3 license that is included with the source distribution.
00007 //& *** (c) 2006-2011 The HPGCC3 Team ***
00008 
00009 
00010 #ifndef GUI_H_
00011 #define GUI_H_
00012 
00013 #ifndef GGL_H_
00014 #include <ggl.h>
00015 #endif
00016 
00017 #ifndef GSTRING_H_
00018 #include <gstring.h>
00019 #endif
00020 #ifndef RESOURCES_H_
00021 #include <resources.h>
00022 #endif
00023 
00024 
00317 // PHYSICAL SCREEN SIZE
00318 #define SCREEN_W 160
00319 #define SCREEN_H 80
00320 // LOGICAL (VISIBLE) SCREEN SIZE
00321 #define USERSCREEN_W 131
00322 #define USERSCREEN_H 80
00323 
00324 // STYLE DEFINITION CONSTANTS
00325 #define CAPTIONHEIGHT 7
00326 #define SOFTMENUHEIGHT 6
00327 #define SCROLLBARWIDTH 3
00328 #define BORDERWIDTH 1 
00329 
00330 #define CURSORBLINKSPEED 40000
00331 
00332 
00333 class gForm;
00334 class gSoftMenu;
00335 class gApplication;
00336 class gControl;
00337 
00338 // CLASS DEFINITIONS
00339 
00340 struct gUpdate {
00341         int clipx,clipy,clipx2,clipy2; // CLIPPING RECTANGLE WITHIN THAT SURFACE
00342 };
00343 
00344 
00345 struct gEvent {
00346         unsigned int Type;      // MESSAGE
00347         unsigned int Arg;       // OPTIONAL ARGUMENT
00348         unsigned int Data;      // OPTIONAL DATA POINTER/INTEGER/ETC.
00349         
00350 };
00351 
00352 typedef BOOL (*gEvHandler)(gEvent *e,gControl *_This);
00353 
00354 
00355 struct gEvHandlerList {
00356         unsigned int Type;
00357         unsigned int Value;
00358         unsigned int Mask;
00359         gEvHandler Action;
00360         gEvHandlerList *Next;
00361 };
00362 
00363 
00364 
00365 
00366 enum gGraphicCommands {
00367         GCMD_END=0,
00368         GCMD_SETCLIP,
00369         GCMD_DRAWICON,
00370         GCMD_VLINE,
00371         GCMD_HLINE,
00372         GCMD_RECT
00373 };
00374 
00375 enum gColors {
00376         GWHITE=0,
00377         GGRAY1=0x11111111,
00378         GGRAY2=0x22222222,
00379         GGRAY3=0x33333333,
00380         GGRAY4=0x44444444,
00381         GGRAY5=0x55555555,
00382         GGRAY6=0x66666666,
00383         GGRAY7=0x77777777,
00384         GGRAY8=0x88888888,
00385         GGRAY9=0x99999999,
00386         GGRAY10=0xaaaaaaaa,
00387         GGRAY11=0xbbbbbbbb,
00388         GGRAY12=0xcccccccc,
00389         GGRAY13=0xdddddddd,
00390         GGRAY14=0xeeeeeeee,
00391         GBLACK=0xffffffff,
00392 };
00393 
00394 enum gAppFlags {
00395         GAPP_EXIT=1,
00396         GAPP_NEXTFORM,
00397         GAPP_PREVFORM
00398 };
00399 
00400 enum gEvTypes {
00401         GEVENT_NONE=0,
00402         GEVENT_KEYB=1,
00403         GEVENT_IDLE,
00404         GEVENT_GUI,
00405         GEVENT_TMR,
00406         GEVENT_SD,
00407         GEVENT_SERIAL
00408 };
00409 
00410 enum gEvGui {
00411         GEVGUI_GETFOCUS=1,
00412         GEVGUI_LOSEFOCUS,
00413         GEVGUI_FORMCREATE,
00414         GEVGUI_FORMOPEN,
00415         GEVGUI_FORMCLOSE,
00416         GEVGUI_FORMEXIT,
00417         GEVGUI_NEWFORM,
00418         GEVGUI_CHANGEFORM,
00419         GEVGUI_QUERYCLOSE,
00420         GEVGUI_BEFORECHANGE,
00421         GEVGUI_AFTERCHANGE,
00422         GEVGUI_BEFORECOLLAPSE,
00423         GEVGUI_AFTERCOLLAPSE,
00424         GEVGUI_BEFOREEXPAND,
00425         GEVGUI_AFTEREXPAND,
00426         GEVGUI_BEFORECHECK,
00427         GEVGUI_AFTERCHECK,
00428         GEVGUI_ENTER
00429 };
00430 
00431 enum gSystemFonts {
00432         FONT_MINI=-6,
00433         FONT_TINY=5,
00434         FONT_SYSTEM6=6,
00435         FONT_SYSTEM7=7,
00436         FONT_SYSTEM8=8
00437 };
00438 
00439 struct gFontData {
00440         unsigned int Signature;
00441         unsigned int BitmapWidth;
00442         unsigned int BitmapHeight;
00443         unsigned int BitmapSize;
00444         unsigned int WidthMap[256];
00445         unsigned int Bitmap[1]; 
00446 };
00447 
00448 class gFont {
00449 public:
00450         gFontData *FontData;
00451         int MaxWidth;
00452         int TextWidth(char *Text);
00453         inline int CharWidth(char T) {  return ((int)(FontData->WidthMap[(int)T]))>>16; }
00454         inline int TextHeight() { return FontData->BitmapHeight; };
00455         gFont() {};
00456         gFont(int height);
00457         gFont(gFontData *data);
00458 };
00459 
00460 
00461 
00462 // GENERIC GUI CONTROL
00463 class gControl {
00464 
00465         virtual void vTable();
00466         
00467 public:
00468         gglsurface drawsurf;
00469         int posx,posy;                  // POSITION OF THE CONTROL IN PARENT COORDINATES
00470         int sizex,sizey;                // SIZE OF THE CONTROL (AND THE DRAWING SURFACE)
00471         int clipx,clipy,clipx2,clipy2;  // CURRENT CLIPPING AREA
00472         int ncx,ncy,ncwidth,ncheight;   // NON-CLIENT AREA VIEW POSITION
00473         int viewx,viewy;                                        // SCROLL POSITION OF CLIENT AREA VIEW
00474         int vieww,viewh;
00475         BOOL scrollh,scrollv;
00476         
00477         gEvHandler *RedrawBk;   // REDRAW BACKGROUND, CAN BE OVERRIDEN WITHOUT DECLARING NEW CLASS
00478         unsigned int *CtlData;  // ARBITRARY DATA - CONTROL-DEPENDENT
00479         gControl *FirstChild,*LastChild;
00480         gControl *Next,*Prev;
00481         gControl *Parent,*UpdateFirst;
00482         gEvHandlerList *Events;
00483         
00484         // PURE VIRTUAL MEMBERS
00485         virtual void Update(gUpdate *);
00486         virtual BOOL AcceptFocus() { return FALSE; }
00487         
00488         // IMPURE VIRTUAL MEMBERS, PASS EVENTS TO HANDLERS & PROPAGATE TO CHILDS
00489         virtual BOOL DefaultEvent(gEvent *);
00490         virtual BOOL DoEvent(gEvent *);
00491         virtual BOOL DoEventExclusive(gEvent *);
00492         
00493         
00494         // MANAGEMENT MEMBERS
00495         void AddChild(gControl&);
00496         void RemoveChild(gControl&);
00497         void AddHandler(unsigned int Type,unsigned int Mask,unsigned int Arg,gEvHandler Function);
00498         void RemoveHandler(unsigned int Type,unsigned int Mask=0,unsigned int Arg=0);
00499         gEvHandler GetHandler(unsigned int Type,unsigned int Mask=0,unsigned int Arg=0);
00500         void InsufMemoryError();
00501         gApplication *GetApplication();
00502         
00503         
00504         
00505         // GRAPHIC ROUTINES TO DRAW IN THE CLIENT AREA WITH CLIPPING
00506         
00507         // CLIENT AREA MANAGEMENT
00508         virtual void DrawVScrollBar();                  // REDRAW SCROLL BAR
00509         virtual void DrawHScrollBar();                  // REDRAW SCROLL BAR
00510         virtual void SetViewPos(int x,int y) {};        // SCROLL VIEWPORT TO GIVEN POSITION
00511         virtual void SetViewX(int x);                   // SCROLL ONLY HORIZONTALLY
00512         virtual void SetViewY(int y);                   // SCROLL ONLY VERTICALLY
00513         virtual void EnsureVisible(int x1,int y1,int x2,int y2) {};
00514         
00515         
00516         
00517         
00518         // GRAPHIC MANAGEMENT
00519         virtual void SetVisible(BOOL visible) {};
00520         virtual BOOL IsVisible() {return TRUE; }
00521         virtual BOOL Resize(int width,int height);
00522         virtual void Move(int x,int y);
00523         virtual void ParentToClient(int &x,int &y);
00524         virtual void ClientToParent(int &x,int &y);
00525         virtual void ClipToView(gUpdate *u);
00526         virtual void Invalidate(gUpdate *u,gControl *Sender=NULL);
00527         virtual void Invalidate(gControl *Sender=NULL);
00528         
00529         inline static unsigned int SolidColor(int c) { return ggl_mkcolor(c); }
00530 
00531         // CUSTOM DRAW BACKGROUND
00532         virtual void RedrawBackground(gUpdate *);
00533 
00534         // FLAT COLOR ROUTINES
00535         virtual void HLine(int y,int x1,int x2,int pattern);
00536         virtual void VLine(int x,int y1,int y2,int pattern);
00537         virtual void Line(int x,int y,int x2,int y2,int pattern);
00538         virtual void Rect(int x1,int y1,int x2,int y2,int pattern);
00539         virtual void RectP(int x1,int y1,int x2,int y2,int *Pattern);
00540         virtual void Plot(int x1,int y1,int color);
00541         virtual int GetPixel(int x1,int y1);
00542         
00543         // TEXT OUTPUT ROUTINES
00544         virtual void DrawText(int x,int y,char *Text,gFont *Font,int color);
00545         virtual void DrawTextBk(int x,int y,char *Text,gFont *Font,int color,int BkColor);
00546         
00547         // BITMAPS AND ICON ROUTINES
00548         virtual void DrawIcon(int x,int y,unsigned int *IconData,int width,int height);
00549         virtual void DrawIconPartial(int x,int y,unsigned int *IconData,int iconwidth,int iconx,int icony,int width,int height);
00550 
00551         // CLIPPING ROUTINES
00552         virtual void SetClipRegion(int x1,int y1,int x2,int y2);
00553         virtual void ClearClipRegion();
00554         
00555         // CONSTRUCTORS/DESTRUCTORS
00556         gControl();
00557         gControl(gControl& _Parent);
00558         virtual ~gControl();
00559 };
00560 
00561 
00562 // INTERNAL DATA STRUCTURE FOR OPEN LOOPS
00563 struct gLoopData {
00564         int BackupFlags;
00565         int BackupResult;
00566         gControl *Idleptr;
00567 };
00568 
00569 
00570 // IMPLEMENT THE HARDWARE LAYER AND MAIN EVENT PUMP
00571 
00572 
00573 class gApplication: public gControl {
00574         virtual void vTable();
00575 public:
00576         unsigned int *screenbuffer;
00577         int contrastlevel;
00578         int invx,invy,invx2,invy2;              // INVALID AREA
00579         volatile unsigned int RunLoopFlags;
00580         int RunResult;
00581         gControl *CurrentForm;
00582         gString Clipboard;
00583         
00584         int Run(gForm *Main=NULL);
00585         int RunInternalLoop();
00586         gLoopData *StartOpenLoop(gForm *main=NULL);
00587         BOOL RunOpenLoopOnce(gLoopData *v);
00588         int EndOpenLoop(gLoopData *v);
00589         void CloseAllAndExit();
00590         void Terminate(int result);
00591         BOOL QueryTerminate();
00592         void Update(gUpdate *u);
00593         void Update();
00594         virtual void Invalidate(gControl *Sender=NULL);
00595         virtual void Invalidate(gUpdate *u,gControl *Sender=NULL);
00596         void OpenNewForm(gControl *ptr);
00597         void CloseForm(gControl *ptr);
00598         void SetCurrentForm(gControl *ptr);
00599         gApplication();
00600         virtual ~gApplication();
00601         
00602 };
00603 
00604 
00605 enum gFormStyles {
00606         
00607         S_TOPCAPTION = 1,
00608         S_BOTTOMCAPTION = 2,
00609         S_SINGLESTATUSLINE = 4,
00610         S_DOUBLESTATUSLINE = 8,
00611         S_TOPSTATUS = 16,
00612         S_FORCEVSCROLL = 32,
00613         S_FORCEHSCROLL = 64,
00614         S_FORMBORDER = 128,
00615         S_SHADE = 256,
00616         // 512 NOT USED FOR COMPATIBILITY W/OTHER CONTROLS STYLES
00617         S_SINGLESOFTMENU = 1024,
00618         S_EXSOFTMENU = 2048,
00619         S_FULLSCREEN = 4096
00620         
00621 };
00622 
00623 enum gStateFlags {
00624         STAT_VISIBLE=1,
00625         STAT_FOCUS=2
00626 };
00627 
00628 class gForm : public gControl {
00629         virtual void vTable();
00630 
00631 public: 
00632         int StateFlags;
00633         gSoftMenu *SoftMenu;
00634         char *Caption;
00635         gFormStyles StyleFlags;
00636         gControl *Focus;
00637 
00638         virtual void Update(gUpdate *u);
00639         virtual void Initialize(unsigned int *Data);
00640         virtual void Destroy(unsigned int *Data);
00641 
00642         virtual void RedrawBackground(gUpdate *u);
00643         virtual void RedrawNonClient();
00644         virtual BOOL DoEvent(gEvent *);
00645         virtual BOOL DefaultEvent(gEvent *);
00646         
00647         void AddSoftMenu(gSoftMenu *menu);
00648         void HideSoftMenu();
00649         void ShowSoftMenu();
00650         
00651         gForm(gControl& Parent,const char *_Caption,gFormStyles _Style);                 // FULL SCREEN FORM
00652         gForm(gControl& Parent,const char *_Caption,gFormStyles _Style,int clientwidth,int clientheight);       // FULL SCREEN FORM W/ARBITRARY CLIENT AREA SIZE
00653         gForm(gControl& Parent,const char *_Caption,gFormStyles _Style,int x,int y,int width,int height); // WINDOWED FORM
00654         gForm(gControl& Parent,const char *_Caption,gFormStyles _Style,int x,int y,int width,int height,int clientwidth,int clientheight); // WINDOWED FORM
00655         virtual ~gForm();
00656 };
00657 
00658 struct gSoftMenuItem {
00659         int State;
00660         char Name[8];           // MAX 7 CHARS + NULL TERMINATOR
00661         gEvHandler Action;
00662 };
00663 
00664 class gSoftMenu : public gControl {
00665         virtual void vTable();
00666 public:
00667         int Style;
00668         int Visible;
00669         int Numitems,ShowItem;
00670         gSoftMenuItem *Items;
00671         
00672         virtual void SetVisible(BOOL _Visible);
00673         virtual BOOL IsVisible();
00674         virtual void DrawMenuLabel(gControl *P,int x,int y,int item);
00675         virtual void Update(gUpdate *u);
00676         virtual BOOL DefaultEvent(gEvent *);
00677         virtual void Invalidate(gControl *Sender=NULL);
00678         
00679         void ClearItems();
00680         void AddItem(const char *Name,gEvHandler Function);
00681         void AddItemList(struct gSoftMenuItem *List, int numitems);
00682         void ChangeItem(int number,const char *Name,gEvHandler Function);
00683         
00684         virtual void NextPage();
00685         virtual void PrevPage();
00686         
00687         
00688         gSoftMenu(gControl& Parent,int Style);
00689         gSoftMenu(gControl& Parent,int Style,struct gSoftMenuItem *List, int numitems);
00690         
00691         virtual ~gSoftMenu();
00692 };
00693 
00694 
00695 class gStaticText : public gControl {
00696         virtual void vTable();
00697 
00698 public:
00699         char *Text;
00700         gFont Font;
00701         int Color;
00702 
00703         virtual void Update(gUpdate *u);
00704         void SetText(const char *text);
00705         const char *GetText();
00706         gStaticText(gControl& Parent,int x, int y,const char *Text,gFont *f,int color);
00707         virtual ~gStaticText();
00708 };
00709 
00710 class gStaticTextWrap : public gStaticText 
00711 {
00712         virtual void vTable();
00713 public:
00714         int maxwidth;
00715         
00716         virtual void Update(gUpdate *);
00717         virtual void SetText(const char *);
00718         void RecalcSize();
00719         static void CalcSize(const char *_text,gFont *font,int maxwidth,int *width,int *height);
00720         gStaticTextWrap(gControl& _Parent,int x,int y, int width, const char *_Text,gFont *f,int color);
00721         
00722         virtual ~gStaticTextWrap();
00723 };
00724 
00725 
00726 
00727 
00728 enum gStyles {
00729         S_UNCHECKED=0,
00730         S_CHECK = 1,
00731         S_DOT,
00732         S_PLUS,
00733         S_MINUS,
00734         S_UNKNOWN,
00735         S_SELECTED=8,
00736         S_MULTILINE=16, // CONTROL CAN CONTAIN MORE THAN ONE LINE OF TEXT
00737         S_HSCROLLBAR=32, // CONTROL WILL DISPLAY A HORIZONTAL SCROLL BAR
00738         S_VSCROLLBAR=64, // CONTROL WILL DISPLAY A VERTICAL SCROLL BAR
00739         S_HASBORDER=128,  // CONTROL HAS A BORDER AROUND IT
00740         S_FOCUSED=512
00741 
00742 };
00743 
00744 
00745 class gCheckBox : public gControl {
00746         virtual void vTable();
00747 
00748 public:
00749         int TypeFlags;
00750         int State;
00751         
00752         virtual BOOL AcceptFocus() { return TRUE; }
00753         virtual void Update(gUpdate *u);
00754         void SetState(int state);
00755         int GetState();
00756         virtual void DrawCheck(int state);
00757         virtual BOOL DefaultEvent(gEvent *);
00758         
00759         gCheckBox(gControl& Parent,int x, int y, gStyles Type=S_CHECK);         // STANDARD CHECKBOX
00760         virtual ~gCheckBox();
00761 };
00762 
00763 
00764 
00765 
00766 enum gEditStates {
00767         ES_SHOWCURSOR =1,
00768         ES_CURSORBLINK=2,
00769         ES_RDONLY=4,
00770         ES_SINGLELINE=8,
00771         ES_LIMITEDIT=16,
00772         ES_OVERWRITE=32
00773 };
00774 
00775 
00776 #define TRIM_BEGIN      0
00777 #define TRIM_END        1
00778 
00779 
00780 
00781 class gEditBox : public gControl {
00782         virtual void vTable();
00783 
00784 public:
00785         gString Text;
00786         int CursorPos,CursorLine;
00787         int SelStart,SelEnd;
00788         gFont Font;
00789         int Color,BkColor,SelColor;
00790         int DispLines;
00791         int TotalLines;
00792         int ViewLine;
00793         int EditMin,EditMax;
00794         unsigned int State;
00795         int Cursorx,Cursory,Targetx;
00796         gglsurface cursorbk;
00797         tmr_t lastblink;
00798         int InputMode;
00799         int StyleFlags;
00800 
00801         virtual BOOL AcceptFocus() { return TRUE; }
00802         virtual void Update(gUpdate *u);
00803         virtual BOOL DefaultEvent(gEvent *);
00804         
00805         // DRAWING FUNCTIONS
00806         void RedrawFrame();
00807         void DrawVScrollBar();
00808         void InvalidateVScrollBar();
00809         void DrawLine(int LineOffset,int x, int y);
00810         void ScrollDown1Line(int ytop);
00811         void ScrollUp1Line(int ybot);
00812         void ScrollRight(int shift);
00813         void ScrollLeft(int shift);
00814         
00815 
00816         void DrawAllLines();
00817         void ClrEOL(int x,int y);
00818         void CursorOff();
00819         void CursorOn();
00820         void HideCursor();
00821         void UnhideCursor();
00822         void StartCursorBlink();
00823         void StopCursorBlink();
00824         
00825         // INPUT RELATED FUNCTIONS
00826         void CursorUp();
00827         void CursorDown();
00828         void CursorRight();
00829         void CursorLeft();
00830         void ViewUp();
00831         void ViewDown();
00832         void ViewRight();
00833         void ViewLeft();
00834         void ViewPageUp();
00835         void ViewPageDown();
00836         void ViewHome();
00837         void ViewEnd();
00838         void ViewEndOfText();
00839         void ViewStartOfText();
00840 
00841         void PageUp();
00842         void PageDown();
00843         void Home();
00844         void End();
00845         void MoveCursor(int Offset);
00846         void EndOfText();
00847         void StartOfText();
00848         void InsertChar(int character);
00849         void DelChar(int backspace);
00850         void RemoveText(int StartPos,int EndPos);
00851         void InsertText(int StartPos,int Length,gString& s);
00852         void InsertText(int StartPos,int Length,char *string);
00853         void BeginSelection();
00854         void EndSelection();
00855         void Copy();
00856         void Cut();
00857         void Paste();
00858         void BackSpace();
00859         void Delete();
00860 
00861         void SetEditLimits(int StartPos,int EndPos);
00862         void ClearEditLimits();
00863         void GetEditLimits(int *StartPos,int *EndPos);
00864         BOOL IsReadOnly();
00865         void SetReadOnly(BOOL rdonly);
00866         void SetOverwriteMode(BOOL ovrwrite);
00867         // LOAD/SAVE
00868         void SetText(const char *text);
00869         int GetText(char *data,int maxbytes);
00870         int GetText(char *data,int maxbytes,int StartPos,int EndPos);
00871         
00872         void LimitTextSize(int limit,int trimwhere);
00873         
00874         inline int Strlen() { return Text.Strlen(); } 
00875         gEditBox(gControl& Parent,int x, int y,int width,int height,gStyles Style, gFont *f);
00876         virtual ~gEditBox();
00877 };
00878 
00879 // LIST BOXES / TREES
00880 
00881 #define ITEM_GROUP 16   // ALLOCATE GROUPS OF 16 ITEMS, NO LESS TO AVOID HEAP TRASHING
00882 #define CHECKHEIGHT 6   // HEIGHT OF CHECKBOX MARK = minimum height of item
00883 #define LEVELWIDTH 8    // DEFINE HOW MUCH TO THE RIGHT ON EACH SUBLEVEL
00884 #define CHECKWIDTH 8
00885 #define CHECKBMPWIDTH 48
00886 
00887 enum gListStates {
00888         LS_HASCHECK =1,
00889         LS_CHECKED = 2,
00890         LS_UNKNOWN = 4,
00891         LS_HIDDEN = 8,
00892         LS_SELECTED = 16,
00893         LS_EXPANDABLE = 32,
00894         LS_EXPANDED = 64
00895 };
00896 
00897 struct gListItem {
00898         int TreeLevel;
00899         int StateFlags;
00900         char *Text;
00901         int Data;
00902 };
00903 
00904 
00905 class gListBox : public gControl {
00906         virtual void vTable();
00907         
00908 public:
00909         gListItem *Items;
00910         int NumItems,MaxItems,DispItems;
00911         int ViewItem,SelectedItem;
00912         int ItemHeight,MaxWidth;
00913         int Color,BkColor,SelColor;
00914         int StyleFlags;
00915         gFont Font;
00916         
00917         void SetItemList(gListItem *List,int NumItems);
00918         void InsertItem(int Index,char *Text, int TreeLevel,int StateFlags,int Data);
00919         void RemoveItem(int Index);
00920         void AddItem(char *Text, int TreeLevel,int StateFlags,int Data);
00921         gListItem *GetItem(int Index);  
00922         
00923         void SetSelection(int Index);
00924         int NextItem(int Index);
00925         int NextVisibleItem(int Index);
00926         int PrevVisibleItem(int Index);
00927         int PrevItem(int Index);
00928         int ChildItem(int Index);
00929         int ParentItem(int Index);
00930         char *FullPath(int BaseIndex,int Index,const char *Separator);
00931         
00932         void Select(int Index);
00933         void Unselect(int Index);
00934         void Hide(int Index);
00935         void Unhide(int Index);
00936         void Expand(int Index);
00937         void Collapse(int Index);
00938         void ExpandAll(int Index);
00939         void CollapseAll(int Index);
00940         BOOL HasChildren(int Index);
00941         BOOL IsExpanded(int Index);
00942         void SetCheck(int Index,BOOL value);
00943         BOOL IsChecked(int Index);
00944 
00945         
00946         
00947         BOOL ReallocList(int _NumItems);
00948         void ListChanged();
00949         void RedrawAll();
00950         void RedrawSingleItem(int Index);
00951 
00952         BOOL MoveSelectionUp(int nlines);
00953         BOOL MoveSelectionDown(int nlines);
00954         void EnsureVisible(int Index);
00955         virtual int CalcItemWidth(int Index);
00956         virtual BOOL DrawItem(int Index,int y);
00957         
00958         virtual BOOL AcceptFocus() { return TRUE; }
00959         virtual void Update(gUpdate *u);
00960         void RedrawFrame();
00961         void DrawVScrollBar();
00962         void DrawHScrollBar();
00963         void InvalidateVScrollBar();
00964         virtual BOOL DefaultEvent(gEvent *e);
00965 
00966         
00967         gListBox(gControl& Parent,int x,int y,int w,int h,int Style,gFont *Font);
00968         ~gListBox();
00969 };
00970 
00971 // MESSAGE BOXES
00972 
00973 enum gMsgBoxStyle {
00974         S_OKCANCEL=0,
00975         S_YESNO,
00976         S_RETRYCANCEL,
00977         S_OKONLY
00978 };
00979 enum gMsgBoxResult {
00980         S_OK = 0,
00981         S_YES = 0,
00982         S_RETRY = 0,
00983         S_NO = -1,
00984         S_CANCEL = -1
00985 };
00986 
00987 gMsgBoxResult gDoMessageBox(gApplication *app,const char *Title,const char *Message,gMsgBoxStyle Flags);
00988 
00989 
00990 
00991 // STANDARD EVENT HANDLERS
00992 BOOL gOKEvent(gEvent *e,gControl *This);
00993 BOOL gCancelEvent(gEvent *e,gControl *This);
00994 BOOL gDoNothingEvent(gEvent *e,gControl *This);
00995 
00996 
00997 
00998 #endif /*GUI_H_*/