V Quick Reference *****************************> CommandObject <**************************** // CommandObject: "#include " typedef struct CommandObject { CmdType cmdType; // what kind of item is this ItemVal cmdId; // unique id for the item ItemVal retVal; // value returned when picked char* title; // string void* itemList; // used when cmd needs a list CmdAttribute attrs; // list of attributes int Sensitive; // if item is sensitive or not ItemVal cFrame; // Frame used for an item ItemVal cRightOf; // Item placed left of this id ItemVal cBelow; // Item placed below this one int size; // Used for size information } CommandObject; ---- CmdType ---- C_EndOfList: Used to denote end of command list C_Blank: filler to help RightOfs, Belows work C_BoxedLabel: a label with a box C_Button: Button C_CheckBox: Checked Item C_ColorButton: Colored button C_ComboBox: Popup combo list C_Frame: General purpose frame C_Icon: a display only Icon C_IconButton: a command button Icon C_Label: Regular text label C_List: List of items (scrollable) C_ProgressBar: Bar to show progress C_RadioButton: Radio button C_Slider: Slider to enter value C_Spinner: Spinner value entry C_TextIn: Text input field C_Text: wrapping text out ---- CmdAttribute ---- CA_DefaultButton: Special Default Button CA_Hidden: Starts out hidden CA_Horizontal: Horizontal orentation CA_Large: Command larger than normal CA_MainMsg: Gets replacement message CA_NoBorder: No border (frames, status bar) CA_NoNotify: Don't notify on all events CA_NoSpace: No space between widgets CA_None: No special attributes CA_Small: Command smaller than normal CA_Text: A Text value box CA_Vertical: Vertical orentation ---- Useful symbolic values ---- NoList: No list used NoFrame: Not a member of a frame isSens: Is sensitive notSens: Not sensitive isChk: Is checked notChk: Not checked notUsed: Not used noIcon: No icon *********************************> vApp <********************************* // vApp: "#include " class vApp : public vBaseItem { public: //---------------------------------------- public vApp(char* appName); virtual ~vApp(); // Methods to override virtual void AppCommand(vWindow* win, ItemVal id, ItemVal retval, CmdType ctype); virtual void CloseAppWin(vWindow* win); virtual void Exit(void); virtual void KeyIn(vWindow* win, vKey key, unsigned int shift); virtual vWindow* NewAppWin(vWindow* win, char* name, int h, int w, vAppWinInfo* winInfo = 0); // Utlity methods int DefaultHeight(); int DefaultWidth(); int IsRunning(); void SendWindowCommandAll(ItemVal id, int val, CmdType ctype); void SetValueAll(ItemVal id, int val, ItemSetType setType); void SetStringAll(ItemVal id, char* str); const char* name(); vAppWinInfo *getAppWinInfo(vWindow* Win); // platform dependent Display* display(); // To get the X display XtAppContext appContext(); // To get the context }; extern vApp *theApp; // Pointer to single global instance extern int AppMain(int, char**); // Pseudo main program ********************************> vBrush <******************************** // vBrush: "#include " class vBrush { public: //-------------------------------- public vBrush(unsigned int r = 0, unsigned int g = 0, unsigned int b = 0, int style = vSolid, int fillMode = vAlternate); ~vBrush(); int operator ==(vBrush b2); int operator !=(vBrush b2); vColor GetColor(); int GetFillMode(); int GetStyle(); void SetColor(vColor c); void SetColor(unsigned int r, unsigned int g, unsigned int b); void SetFillMode(int fillMode); void SetStyle(int style); }; ******************************> vCanvasPane <***************************** // vCanvasPane: "#include " class vCanvasPane { public: //---------------------------------------- public vCanvasPane(PaneType pt = P_Canvas); virtual ~vCanvasPane(); virtual void ShowPane(int OnOrOff); // Cursor void SetCursor(VCursor id); VCursor GetCursor(); void UnSetCursor(void); // Scrolling virtual void HPage(int Shown, int Top); virtual void VPage(int Shown, int Top); virtual void HScroll(int step); virtual void VScroll(int step); virtual void SetHScroll(int Shown, int Top); virtual void SetVScroll(int Shown, int Top); virtual void ShowHScroll(int OnOff); virtual void ShowVScroll(int OnOff); // Change messages virtual void FontChanged(vFont vf); // Events virtual void MouseDown(int x, int y, int button); virtual void MouseUp(int x, int y, int button); virtual void MouseMove(int x, int y, int button); virtual void EnterFocus(); virtual void LeaveFocus(); // Expose/redraw events virtual void Redraw(int x, int y, int height , int width); virtual void Resize(int newH, int newW); // Information virtual int GetWidth(); virtual int GetHeight(); // Drawing void Clear(void); virtual void ClearRect(int left, int top, int width, int height); virtual void DrawAttrText(int x, int y, char* text, ChrAttr attr); virtual void DrawText(int x, int y, char* text); virtual void DrawEllipse(int x, int y, int width, int height); virtual void DrawIcon(int x, int y, vIcon& icon); virtual void DrawLine(int x, int y, int xend , int yend); virtual void DrawPoint(int x, int y); virtual void DrawPolygon(int n, vPoint points[], int fillStyle = vAlternate); virtual void DrawRectangle(int x, int y, int width, int height); virtual void DrawRoundedRectangle(int x, int y, int width, int height, int radius); virtual void DrawRubberLine(int x, int y, int xend, int yend); virtual void DrawRubberEllipse(int x, int y, int width, int height); virtual void DrawRubberRectangle(int x, int y, int width, int height); virtual vBrush GetBrush(void); virtual void SetBrush(vBrush brush); virtual vFont GetFont(void); virtual void SetFont(vFont fnt); virtual int TextWidth(char* str); virtual int TextHeight(int& ascent, int& descent); vDC* GetDC(); // Appearance virtual void SetScale(int mult, int div); virtual void GetScale(int& mult, int& div); virtual void SetBackground(vColor color); virtual void SetPen(vPen pen); vPen GetPen(); void SetTranslate(int x, int y); void SetTransX(int x); void SetTransY(int y); void GetTranslate(int& x, int& y); int GetTransX(); int GetTransY(); // Platform dependent Widget DrawingWindow(); }; ******************************> vCmdWindow <****************************** // vCmdWindow: "#include " class vCmdWindow : public vWindow { public: //----------------------------------- public vCmdWindow(char* name = "+", int height = 0, int width = 0); virtual ~vCmdWindow(); // Destructor virtual void CloseWin(void); // callback for close button }; ********************************> vColor <******************************** // vColor: "#include " // Message constants for use in Color buttons (for color buttons, etc.) M_Black, M_Red, M_DimRed, M_Green, M_DimGreen, M_Blue, M_DimBlue, M_Yellow, M_DimYellow, M_Magenta, M_DimMagenta, M_Cyan, M_DimCyan, M_DarkGray, M_MedGray, M_White, M_ColorFrame // Index constants into V "standard" color arrays: vStdColors, vColorNames. vC_Black, vC_Red, vC_DimRed, vC_Green, vC_DimGreen, vC_Blue, vC_DimBlue, vC_Yellow, vC_DimYellow, vC_Magenta, vC_DimMagenta, vC_Cyan, vC_DimCyan, vC_DarkGray, vC_MedGray, vC_White class vColor { public: //---------------------------------------- public vColor(unsigned int rd=0, unsigned int gr=0, unsigned int bl=0); ~vColor(); int operator ==(vColor c2); int operator !=(vColor c2); Set(unsigned int rd=0, unsigned int gr=0, unsigned int bl=0); Set(vColor& c); void SetR(unsigned int rd = 0); void SetG(unsigned int gr = 0); void SetB(unsigned int bl = 0); unsigned int r(); unsigned int g(); unsigned int b(); }; extern vColor vStdColors[16]; // 16 "standard" colors extern char* vColorNames[16]; // and their names *****************************> vDebugDialog <***************************** // vDebugDialog: "#include " class vDebugDialog : public vModalDialog { public: //---------------------------------------- public vDebugDialog(vBaseWindow* bw,char* title = "Debugging Options"); vDebugDialog(vApp* aw,char* title = "Debugging Options"); ~vDebugDialog(); void SetDebug(); }; ---- Command Line Switches ---- [-vDebug SU] Turn on System or User (or both) debug messages in list. [c] Command events (menu, dialog commands). [m] Mouse events. [w] Window events (resize, redraw). [b] Build events. [o] Other misc. events. [v] Bad values. [C] Constructors. [D] Destructors. [123] User items 1, 2, or 3. *******************************> vDialog <******************************** // vDialog: "#include " class vDialog { public: //------------------------------------ public vDialog(vBaseWindow* creator, int modal = 0, char* title = ""); vDialog(vApp* creator, int modal = 0, char* title = ""); ~vDialog(); WindowType wType(); virtual void AddDialogCmds(CommandObject* cList); virtual void CancelDialog(void); virtual void CloseDialog(void); virtual void SetDialogTitle(char * title); virtual void DialogCommand(ItemVal id, ItemVal retval, CmdType ctype); virtual int GetTextIn(ItemVal id, char* strout, int maxlen); virtual int GetValue(ItemVal id); virtual void SetValue(ItemVal id, ItemVal val, ItemSetType setType); virtual void SetString(ItemVal id, char* str); int IsDisplayed(void); virtual void ShowDialog(const char* msg); }; ******************************> vFileSelect <***************************** // vFileSelect: "#include " class vFileSelect : protected vModalDialog { public: //---------------------------------------- public vFileSelect(vBaseWindow* bw, char* title = "File Select"); vFileSelect(vApp* aw, char* title = "File Select"); ~vFileSelect(); int FileSelect(const char* msg, char* filename, const int maxlen, char** filter); int FileSelectSave(const char* msg, char* filename, const int maxlen, char** filter); }; ********************************> vFont <********************************* // vFont: "#include " enum vFontID // various font related ids { vfDefaultSystem, // the default system font vfDefaultFixed, // the system default fixed font vfDefaultVariable, // the system default variable font vfSerif, // serifed font - TimesRoman vfSansSerif, // SansSerif - Swiss or Helvetica vfFixed, // fixed font - Courier vfDecorative, // decorative - dingbat vfOtherFont, // for all other fonts vfNormal, // normal style, weight vfBold, // boldface vfItalic, // italic style vfEndOfList }; class vFont // make the font stuff a class to make it portable { public: //---------------------------------------- public vFont(vFontID fam = vfDefaultFixed, int size = 10, vFontID sty = vfNormal, vFontID wt = vfNormal, int und = 0); ~vFont(); vFontID GetFamily() { return _family; } int GetPointSize() { return _pointSize; } vFontID GetStyle() { return _style; } vFontID GetWeight() { return _weight; } int GetUnderlined() { return _underlined; } void SetFontValues(vFontID fam = vfDefaultFixed, int size = 10, vFontID sty = vfNormal, vFontID wt = vfNormal, int und = 0); }; ******************************> vFontSelect <***************************** // vFontSelect: "#include " class vFontSelect : protected vModalDialog { public: //---------------------------------------- public vFontSelect(vBaseWindow* bw, char* title = "Select Font"); vFontSelect(vApp* aw, char* title = "Select Font"); ~vFontSelect(); int FontSelect(vFont& font, const char* msg = "Select Font" ); }; ********************************> vIcon <********************************* // class vIcon // an icon { public: //---------------------------------------- public vIcon(unsigned char* ic, int h, int w, int d = 1); ~vIcon(); int height; // height in pixels int width; // width in pixels int depth; // bits per pixel unsigned char* icon; // ptr to icon array protected: //--------------------------------------- protected private: //--------------------------------------- private }; ********************************> vMenu <********************************* // vMenu: "#include " typedef struct vMenu { char* label; // The label on the menu ItemVal menuId; // A User assigned unique id unsigned sensitive : 1, // If item is sensitive or not checked : 1; // If item is checked or not char* keyLabel; // Label for an accelerator key vKey accel; // Value of accelerator key vMenu* SubMenu; // Ptr to a submenu } MenuItem; ---- Useful symbolic values ---- isSens: Is sensitive notSens: Not sensitive noSub: No submenu isChk: Is checked notChk: Not checked noKey: No accelerator specified noKeyLbl: No accelerator label ****************************> vModalDialog <****************************** // vModalDialog: "#include " class vModalDialog : public vDialog { public: //---------------------------------------- public vModalDialog(vBaseWindow* creator, char* title = ""); vModalDialog(vApp* creator, char* title = ""); virtual ~vModalDialog(); virtual ItemVal ShowModalDialog(const char* msg, ItemVal& retval); // rest are inherited from vDialog }; *****************************> vNoticeDialog <**************************** // vNoticeDialog: "#include " class vNoticeDialog : protected vModalDialog { public: //---------------------------------------- public vNoticeDialog(vBaseWindow* bw, char* title = "Notice"); vNoticeDialog(vApp* aw, char* title = "Notice"); ~vNoticeDialog(); void Notice(char* msg); }; *********************************> vPen <********************************* // vPen: "#include " class vPen { public: //---------------------------------------- public vPen(unsigned int r = 0, unsigned int g = 0, unsigned int b = 0, int width = 1, int style = vSolid); ~vPen(); int operator ==(vPen p2); int operator !=(vPen p2); void SetStyle(int style); int GetStyle(void); void SetWidth(int width); int GetWidth(); void SetColor(vColor c); void SetColor(unsigned int r, unsigned int g, unsigned int b); vColor GetColor(); }; *****************************> vReplyDialog <***************************** // vReplyDialog: "#include " class vReplyDialog : protected vModalDialog { public: //---------------------------------------- public vReplyDialog(vBaseWindow* bw, char* title = "Reply"); vReplyDialog(vApp *aw, char* title = "Reply"); int Reply(const char* msg, char* reply, const int maxlen); }; *******************************> vStatus <******************************** // vStatus: "#include } typedef struct vStatus // for status bars { char* label; // text label ItemVal statId; // id CmdAttribute attrs; // attributes - CA_NoBorder, CA_None unsigned sensitive : 1; // if button is sensitive or not int width; // to specify width (0 for default) } vButton; ---- Useful symbolic values ---- CA_NoBorder: No border (frames, status bar) CA_None: No special attributes isSens: Is sensitive notSens: Not sensitive noIcon: No icon ****************************> vTextCanvasPane <*************************** // vTextCanvasPane: "#include " class vTextCanvasPane : public vCanvasPane { public: //---------------------------------------- public vTextCanvasPane(); virtual ~vTextCanvasPane(); // Window management/drawing virtual void Clear(void); virtual void ClearRow(const int r, const int c); virtual void ClearToEnd(const int r, const int c); int GetCols(); int GetRows(); void GetRC(int& r, int& c); void GotoRC(const int r, const int c); virtual void DrawAttrText(const char* text, const ChrAttr attr); virtual void DrawChar(const char chr, const ChrAttr attr); virtual void DrawText(const char* text); void HideTextCursor(void); void ShowTextCursor(void); // Scrolling void ScrollText(const int lineCount); // Events virtual void ResizeText(const int rows, const int cols); virtual void TextMouseDown(int row, int col, int button); virtual void TextMouseUp(int row, int col, int button); virtual void TextMouseMove(int row, int col, int button); }; ********************************> vTimer <******************************** // vTimer: "#include " class vTimer { public: //---------------------------------------- public vTimer(); virtual ~vTimer(); virtual int TimerSet(long interval); virtual void TimerStop(void); virtual void TimerTick(void); }; *****************************> V Utilities <****************************** // V Utilities: "#include " extern void LongToStr(long intg, char* str); extern void IntToStr(int intg, char* str); extern void vGetLocalTime(char* tm); extern void vGetLocalDate(char* tm); *******************************> vWindow <******************************** // vWindow: "#include " enum WindowType { WINDOW, CMDWINDOW, DIALOG }; // Types of windows class vWindow { public: //-------------------------------- public vWindow(char *name = "+", int height = 0, int width = 0, WindowType wintype = WINDOW); // Constructor virtual ~vWindow(); // Destructor // Methods to Override virtual void KeyIn(vKey keysym, unsigned int shift); virtual void MenuCommand(ItemVal id); virtual void WindowCommand(ItemVal id, ItemVal retv, CmdType ctype); // Utility Methods const Widget vHandle(); // X only - native handle const char* name(); // the name set virtual void ShowWindow(void); WindowType wType(); // what kind of window we are virtual void AddPane(vPane* add_pane); virtual void CloseWin(void); virtual int GetValue(ItemVal id); virtual void RaiseWindow(void); virtual void SetString(ItemVal id, char* str); virtual void SetStringAll(ItemVal id, char* str); virtual void SetTitle(char* title); virtual void SetValue(ItemVal id, int val, ItemSetType setType); virtual void SetValueAll(ItemVal id, int val, ItemSetType setType); void ShowPane(vPane* wpane, int OnOrOff); }; *****************************> vYNReplyDialog <*************************** // vYNReplyDialog: "#include " class vYNReplyDialog : protected vModalDialog { public: //---------------------------------------- public vYNReplyDialog(vBaseWindow* bw, char* title = "Yes or No"); vYNReplyDialog(vApp* aw, char* title = "Yes or No"); ~vYNReplyDialog(); int AskYN(const char* msg); };