home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 10 Tools
/
10-Tools.zip
/
vos2-121.zip
/
v
/
vopengl
/
bounce
/
bnccmdw.cpp
< prev
next >
Wrap
C/C++ Source or Header
|
1998-06-22
|
5KB
|
211 lines
//=======================================================================
//@V@:Note: This file generated by vgen V1.04 (10:58:59 22 Jun 1998).
// bnccmdw.cpp: Source for bncCmdWindow class
//=======================================================================
#include <v/vnotice.h> // for vNoticeDialog
#include <v/vkeys.h> // to map keys
#include "bnccmdw.h" // our header
// Start defines for the main window with 100
//@V@:BeginIDs
enum {
m_FirstCmd = 100, // Dummy Command
cmdAuxTimer, // AuxTimer
blkLast // Last item
};
//@V@:EndIDs
//@V@:BeginPulldownMenu FileMenu
static vMenu FileMenu[] =
{
{"&New", M_New, isSens, notChk, noKeyLbl, noKey, noSub},
{"&Open...", M_Open, isSens, notChk, noKeyLbl, noKey, noSub},
{"&Save", M_Save, isSens, notChk, noKeyLbl, noKey, noSub},
{"Save &as...", M_SaveAs, isSens, notChk, noKeyLbl, noKey, noSub},
{"&Close...", M_CloseFile, isSens, notChk, noKeyLbl, noKey, noSub},
{"-", M_Line, notSens, notChk, noKeyLbl, noKey, noSub},
{"E&xit", M_Exit, isSens, notChk, noKeyLbl, noKey, noSub},
{NULL}
};
//@V@:EndPulldownMenu
//@V@:BeginPulldownMenu EditMenu
static vMenu EditMenu[] =
{
{"Cut ", M_Cut, isSens, notChk, "Ctrl-X", 'X'-'@', noSub},
{"Copy ", M_Copy, isSens, notChk, "Ctrl-C", 'C'-'@', noSub},
{"Paste", M_Paste, isSens, notChk, "Ctrl-V", 'V'-'@', noSub},
{NULL}
};
//@V@:EndPulldownMenu
//@V@:BeginMenu StandardMenu
static vMenu StandardMenu[] =
{
{"&File", M_File, isSens, notUsed, notUsed, noKey, &FileMenu[0]},
{"&Edit", M_Edit, isSens, notUsed, notUsed, noKey, &EditMenu[0]},
{NULL}
};
//@V@:EndMenu
//@V@:BeginCmdPane ToolBar
static CommandObject ToolBar[] =
{
{C_Button,M_Exit,0,"Exit",NoList,CA_None,isSens,NoFrame,0,0},
{C_EndOfList,0,0,0,0,CA_None,0,0,0}
};
//@V@:EndCmdPane
//====================>>> bncAuxTimer::TimerTick <<<====================
void bncAuxTimer::TimerTick()
{
cmdw->WindowCommand(cmdAuxTimer, cmdAuxTimer, C_Button); // update clock
}
//====================>>> bncCmdWindow::bncCmdWindow <<<====================
bncCmdWindow::bncCmdWindow(char* name, int width, int height) :
vCmdWindow(name, width, height)
{
UserDebug1(Constructor,"bncCmdWindow::bncCmdWindow(%s) Constructor\n",name)
// The Menu Bar
bncMenu = new vMenuPane(StandardMenu);
AddPane(bncMenu);
// The Command Pane
bncCmdPane = new vCommandPane(ToolBar);
AddPane(bncCmdPane);
// The Canvas
bncCanvas = new bncOGLCanvasPane(vGL_Indexed | vGL_DoubleBuffer);
AddPane(bncCanvas);
_auxTimer = new bncAuxTimer(this); // create aux timer
_auxTimer->TimerSet(50); // 1/2 second intervals
// Associated dialogs
// Show Window
ShowWindow();
WindowCommand(cmdAuxTimer,cmdAuxTimer,C_Button); // update clock
}
//====================>>> bncCmdWindow::~bncCmdWindow <<<====================
bncCmdWindow::~bncCmdWindow()
{
UserDebug(Destructor,"bncCmdWindow::~bncCmdWindow() destructor\n")
// Now put a delete for each new in the constructor.
delete bncMenu;
delete bncCanvas;
delete bncCmdPane;
_auxTimer->TimerStop(); // end it
delete _auxTimer; // free it
}
//====================>>> bncCmdWindow::KeyIn <<<====================
void bncCmdWindow::KeyIn(vKey keysym, unsigned int shift)
{
vCmdWindow::KeyIn(keysym, shift);
}
//====================>>> bncCmdWindow::WindowCommand <<<====================
void bncCmdWindow::WindowCommand(ItemVal id, ItemVal val, CmdType cType)
{
// Default: route menu and toolbar commands here
UserDebug1(CmdEvents,"bncCmdWindow:WindowCommand(%d)\n",id)
switch (id)
{
//@V@:Case M_New
case M_New:
{
vNoticeDialog note(this);
note.Notice("New");
break;
} //@V@:EndCase
//@V@:Case M_Open
case M_Open:
{
vNoticeDialog note(this);
note.Notice("Open");
break;
} //@V@:EndCase
//@V@:Case M_Save
case M_Save:
{
vNoticeDialog note(this);
note.Notice("Save");
break;
} //@V@:EndCase
//@V@:Case M_SaveAs
case M_SaveAs:
{
vNoticeDialog note(this);
note.Notice("Save As");
break;
} //@V@:EndCase
//@V@:Case M_CloseFile
case M_CloseFile:
{
vNoticeDialog note(this);
note.Notice("Close File");
break;
} //@V@:EndCase
//@V@:Case M_Exit
case M_Exit:
{
theApp->Exit();
break;
} //@V@:EndCase
//@V@:Case M_Cut
case M_Cut:
{
vNoticeDialog note(this);
note.Notice("Cut");
break;
} //@V@:EndCase
//@V@:Case M_Copy
case M_Copy:
{
vNoticeDialog note(this);
note.Notice("Copy");
break;
} //@V@:EndCase
//@V@:Case M_Paste
case M_Paste:
{
vNoticeDialog note(this);
note.Notice("Paste");
break;
} //@V@:EndCase
//@V@:Case auxTimer
case cmdAuxTimer: // Event from aux timer
{
bncCanvas->TimerAnimate();
break;
} //@V@:EndCase
default: // route unhandled commands up
{
vCmdWindow::WindowCommand(id, val, cType);
break;
}
}
}