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
|
//=======================================================================
//@V@:Note: This file generated by vappgen V 1.00.
// vgdlmdlg.cpp: Source for vgdlgModalDialog class
//=======================================================================
#include "vgdlmdlg.h"
#include <v/vnotice.h>
#include <v/vfilesel.h>
//@V@:BeginIDs
enum {
lblMainMsg = 1000,
frmNames,
lblAppName, // App name
txiAppName,
lblFileName, // file base name
txiFileName,
lblTitle, // app title
txiTitle,
frmOther, // frame for other options
lblOther,
blkOther,
rdbModeless, // Modeless
rdbModal, // Text Canvas
btnSetPath,
blkLast
};
//@V@:EndIds
//@V@:BeginDialogCmd DefaultCmds
static DialogCmd DefaultCmds[] =
{
{C_Label, lblMainMsg, 0,"X",NoList,CA_MainMsg,isSens,NoFrame, 0, 0},
{C_Frame, frmNames, 0, "",NoList,CA_NoBorder,isSens,NoFrame, 0,lblMainMsg},
{C_Label, lblAppName, 0,"Dialog Class Base Name:",
NoList, CA_None, isSens,frmNames,0, 0},
{C_TextIn, txiAppName, 0,"x",
NoList, CA_None, isSens,frmNames,lblAppName, 0},
{C_Label, lblFileName, 0," Dialog File Base Name:",
NoList, CA_None, isSens,frmNames,0, txiAppName},
{C_TextIn, txiFileName, 0,"x",
NoList, CA_None, isSens,frmNames,lblFileName, txiAppName},
{C_Label, lblTitle, 0, " Dialog Title:",
NoList, CA_None, isSens,frmNames,0, txiFileName},
{C_TextIn, txiTitle, 0,"x",
NoList, CA_None, isSens,frmNames,lblTitle, txiFileName},
{C_Frame, frmOther, 0, "",NoList,CA_NoBorder,isSens,NoFrame, 0,frmNames},
{C_Label, lblOther, 0, "Dialog type",
NoList, CA_None, isSens,frmOther,0, 0},
{C_Blank, blkOther, 0, " ",
NoList, CA_None, isSens,frmOther,0, lblOther},
{C_RadioButton, rdbModeless, 1, "Modeless ",
NoList, CA_None, isSens,frmOther,blkOther,lblOther},
{C_RadioButton, rdbModal, 0, "Modal ",
NoList, CA_None, isSens,frmOther,rdbModeless, lblOther},
{C_Button, btnSetPath, 0, " Set Save Path ",NoList,CA_None,
isSens,NoFrame,0, frmOther},
{C_Blank, blkLast, 0, " ",
NoList,CA_None, isSens,NoFrame,btnSetPath, frmOther},
{C_Button, M_Cancel, 0, " Cancel ",NoList,CA_None,
isSens,NoFrame,blkLast, frmOther},
{C_Button, M_OK, 0, " Generate ", NoList, CA_DefaultButton,
isSens, NoFrame, M_Cancel, frmOther},
{C_EndOfList,0,0,0,0,CA_None,0,0,0}
};
//@V@:EndDialogCmd
extern void SetCmdObjTitle(CommandObject* cList, ItemVal id, char* newtitle);
//======================>>> vgdlgModalDialog::vgdlgModalDialog <<<==================
vgdlgModalDialog::vgdlgModalDialog(vBaseWindow* bw, char* title) :
vModalDialog(bw,title)
{
UserDebug(Constructor,"vgdlgModalDialog::vgdlgModalDialog()\n")
}
//===================>>> vgdlgModalDialog::~vgdlgModalDialog <<<====================
vgdlgModalDialog::~vgdlgModalDialog()
{
UserDebug(Destructor,"vgdlgModalDialog::~vgdlgModalDialog() destructor\n")
}
//====================>>> vgdlgModalDialog::vgdlgAction <<<====================
int vgdlgModalDialog::vgdlgAction(char* msg, vgOptions& op)
{
ItemVal ans,rval;
SetCmdObjTitle(DefaultCmds,txiAppName,op.appName);
SetCmdObjTitle(DefaultCmds,txiFileName,op.fileName);
SetCmdObjTitle(DefaultCmds,txiTitle,op.title);
AddDialogCmds(DefaultCmds); // add the predefined commands
ans = ShowModalDialog(msg,rval);
if (ans == M_Cancel)
return 0;
(void) GetTextIn(txiAppName,op.appName,99);
(void) GetTextIn(txiFileName,op.fileName,99);
(void) GetTextIn(txiTitle,op.title,99);
op.addDialog = GetValue(rdbModeless);
op.addModal = GetValue(rdbModal);
return ans == M_OK;
}
//====================>>> vgdlgModalDialog::DialogCommand <<<====================
void vgdlgModalDialog::DialogCommand(ItemVal id, ItemVal retval, CmdType ctype)
{
UserDebug2(CmdEvents,"vgdlgModalDialog::DialogCommand(id:%d, val:%d)\n",id, retval)
switch (id) // We will do some things depending on value
{
case btnSetPath: // set path to save in
{
char path[100];
int tmp = 0;
(void) GetTextIn(txiFileName,path,99);
strcat(path,"app.cpp"); // use xxapp.cpp as default name
vFileSelect fsel(this);
int oans = fsel.FileSelectSave("Save code in directory",
path,99,NULL,tmp);
break;
}
}
vModalDialog::DialogCommand(id,retval,ctype);
}
|