1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634
|
V Quick Reference
*****************************> CommandObject <****************************
// CommandObject: "#include <v/v_defs.h>"
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 <v/vapp.h>"
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 <v/vbrush.h>"
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 <v/vcanvas.h>"
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 <v/vcmdwin.h>"
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 <v/vcolor.h>"
// 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 <v/vdebug.h>"
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<list>] 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 <v/vdialog.h>"
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 <v/vfilesel.h>"
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 <v/vfont.h>"
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 <v/vfontsel.h>"
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 <*********************************
// <v/vicon.h>
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 <v/v_menu.h>"
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 <v/vmodald.h>"
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 <v/vnotice.h>"
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 <v/vpen.h>"
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 <v/vreply.h>"
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 <v/v_defs.h>}
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 <v/vtextcnv.h>"
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 <v/vtimer.h>"
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 <v/vutil.h>"
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 <v/vwindow.h>"
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 <v/vynreply.h>"
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);
};
|