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
|
#include <vdk/vdk.h>
#include "kill.xpm"
class MyForm: public VDKForm
{
VDKCustomButton* helloButton;
VDKCustomButton* closeButton;
VDKLabel* label;
public:
MyForm(VDKApplication* app, gchar* title):
VDKForm(app,title) {}
~MyForm() {}
void Setup()
{
VDKBox* box = new VDKBox(this);
box->Add(helloButton = new VDKCustomButton(this,"Hello"));
helloButton->SetTip("Says \"hello\"");
box->Add(closeButton = new VDKCustomButton(this,(const char*) kill_xpm ,"DISMISS"));
closeButton->SetTip("Closes hello application");
box->Add(label = new VDKLabel(this," "));
Add(box);
SetSize(200,100);
}
bool SayHello(VDKObject*)
{
label->Caption="Hello world !"; return true;
}
bool Quit(VDKObject*) { Close(); return true; }
DECLARE_SIGNAL_MAP(MyForm);
};
DEFINE_SIGNAL_MAP(MyForm,VDKForm)
ON_SIGNAL(helloButton,clicked_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");
MainForm->Setup();
MainForm->Show();
}
};
int main (int argc, char *argv[])
{
MyApp app(&argc, argv);
app.Run();
return 0;
}
|