File: mymodal.cpp

package info (click to toggle)
v1 1.20-2
  • links: PTS
  • area: main
  • in suites: slink
  • size: 6,240 kB
  • ctags: 9,439
  • sloc: cpp: 48,033; ansic: 8,939; makefile: 1,369; sh: 30
file content (104 lines) | stat: -rw-r--r-- 3,723 bytes parent folder | download | duplicates (4)
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
//=======================================================================
//  mymodal.cxx - Source file for myModalDialog class
//  Copyright (C) 1995  Bruce E. Wampler
//
//  This program is part of the V C++ GUI Framework example programs.
//
//  This program is free software; you can redistribute it and/or modify
//  it under the terms of the GNU General Public License as published by
//  the Free Software Foundation; either version 2 of the License, or
//  (at your option) any later version.
//
//  This program is distributed in the hope that it will be useful,
//  but WITHOUT ANY WARRANTY; without even the implied warranty of
//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//  GNU General Public License for more details.
//
//  You should have received a copy of the GNU General Public License
//  (see COPYING) along with this program; if not, write to the Free
//  Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
//=======================================================================

#include "mymodal.h"
#include <v/vnotice.h>

//	The following would be automatically generated by Vigr.  There
//	should be some regular algroithm for generating the #defines -
//	e.g., 2 letters from class name (md), something from the Cmd type (CB),
//	and a value to distinguish each label from aother.  The user should
//	also be able to override the default generated name.  There can be
//	some standard names such as xxBtnOK, etc.  The idea is to get some
//	good compromise for uniqueness, ease of generation, and readability.
//	Each module should have labels starting at the next 100, with the
//	top level window starting with 100.

const ItemVal mmLbl1 = 300;
const ItemVal mmBtn1 = 301;
const ItemVal mmBtn2 = 302;
const ItemVal mmBtnCncl = 303;
const ItemVal mmBtnOK = 304;

// This would also be automatically generated by Vigr. One of the functions
// of Vigr is to allow the user to specify types and positions of Cmds in the
// dialogs.
//
    static DialogCmd DefaultCmds[] =
      {

	{C_Label, mmLbl1, 0,"X",NoList,CA_MainMsg,isSens,NoFrame, 0, 0},
	
	{C_Button, mmBtn1, mmBtn1," Test 1 ",NoList,CA_None,isSens,NoFrame, 0, mmLbl1},
	{C_Button, mmBtn2, mmBtn2," Test 2 ", NoList,CA_None,isSens,NoFrame,
		mmBtn1,mmLbl1},

	{C_Button, M_Cancel, M_Cancel," Cancel ",NoList,CA_None,isSens,NoFrame,
		0, mmBtn1},
	{C_Button, M_OK, M_OK, "   OK   ", NoList, CA_DefaultButton, 
		isSens, NoFrame, M_Cancel, mmBtn1},

	{C_EndOfList,0,0,0,0,CA_None,0,0,0}
      };


//======================>>> myModalDialog::myModalDialog <<<==================
  myModalDialog::myModalDialog(vBaseWindow* bw) :
    vModalDialog(bw)
  {
    UserDebug(Constructor,"myModalDialog::myModalDialog()\n")
    AddDialogCmds(DefaultCmds);		// add the predefined commands
  }

//===================>>> myModalDialog::~myModalDialog <<<====================
  myModalDialog::~myModalDialog()
  {
    UserDebug(Destructor,"myModalDialog::~myModalDialog() destructor\n")
  }

//====================>>> myModalDialog::DialogCommand <<<====================
  void myModalDialog::DialogCommand(ItemVal id, ItemVal retval, CmdType ctype)
  {
    // After the user has selected a command from the dialog,
    // this routine is called with the value.  This code would be generated
    // by Vigr.

    vNoticeDialog note(this);

    UserDebug2(CmdEvents,"myModalDialog::DialogCommand(id:%d, val:%d)\n",id, retval)

    switch (id)		// We will do some things depending on value
      {
	case mmBtn1:		// Button
	  {
	    note.Notice(" Test 1 ");
	    break;
	  }

	case mmBtn2:		// Button
	  {
	    note.Notice(" Test 2 ");
	    break;
	  }
      }

    vModalDialog::DialogCommand(id,retval,ctype);
  }