File: hello3.cc

package info (click to toggle)
vdk2 2.4.0-5
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 4,520 kB
  • ctags: 4,975
  • sloc: cpp: 26,947; sh: 10,677; ansic: 9,220; makefile: 601; perl: 113
file content (72 lines) | stat: -rw-r--r-- 1,363 bytes parent folder | download | duplicates (10)
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
               
#include <vdk/vdk.h>
#include "kill.xpm"

class MyForm: public VDKForm
{ 
  VDKPixmapToggleButton* helloButton;
  VDKLabelButton* closeButton;
  VDKLabel* label;
public:
  MyForm(VDKApplication* app, gchar* title):
    VDKForm(app,title) {}
  ~MyForm() {}
void Setup()
{
  VDKBox* box = new VDKBox(this);
  box->Add(helloButton = new VDKPixmapToggleButton(this, kill_xpm, "Test Me", "haloah", GTK_POS_LEFT, 10));
  box->Add(closeButton = new VDKLabelButton(this, "Closes hello application"));
  box->Add(label = new VDKLabel(this,"Test 3"));
  Add(box);
  SetSize(200,100);
}   
  
bool SayHello(VDKObject*)
{
  if (helloButton->Checked)
    label->Caption="Hello world !";
  else
    label->Caption="Not Hello world!"; 
  return true;
}  

bool Quit(VDKObject*) { Close(); return true; }
  
DECLARE_SIGNAL_MAP(MyForm);  
};  
   

DEFINE_SIGNAL_MAP(MyForm,VDKForm)
  ON_SIGNAL(helloButton,toggled_signal,SayHello),
  ON_SIGNAL(closeButton,clicked_signal,Quit) 
END_SIGNAL_MAP       

   
 
class MyApp: public VDKApplication
{
  
public:
  MyApp(int* argc, char** argv): VDKApplication(argc,argv) {}
  ~MyApp() {}
  void Setup()
  {
    MainForm = new MyForm(this,"Hello world 3");
    MainForm->Setup();
    MainForm->Show(); 
  }
}; 
 

int main (int argc, char *argv[])   
{
  MyApp app(&argc, argv); 
  app.Run();      
  return 0;  
}