1
2 #include "dialog_test.hxx"
3
4 #include "../avtk/theme.hxx"
5
6 #include <stdio.h>
7 #include <sstream>
8
9 #define WIDTH 460
10 #define HEIGHT 260
11
DialogUI(PuglNativeWindow parent)12 DialogUI::DialogUI(PuglNativeWindow parent) :
13 Avtk::UI( WIDTH, HEIGHT, parent, "AVTK : Dialog" )
14 {
15 themes.push_back( new Avtk::Theme( this, "default.avtk" ) );
16 Widget::theme_ = themes.front();
17
18 show = new Avtk::Button( this, 0, 0, WIDTH, HEIGHT, "Show Dialog");
19
20 /// junk to check overlay
21 Avtk::List* listH = new Avtk::List( this, 60, 10, 0, 25, "List" );
22 listH->mode( Group::HEIGHT_EQUAL );
23 listH->resizeMode( Group::RESIZE_FIT_TO_CHILDREN );
24
25 Avtk::Widget* w = 0;
26 for(int i = 0; i < 5; i++ ) {
27 listH->addItem( "Test" );
28 }
29 listH->end();
30
31 dialog = new Avtk::Dialog( this, 60, 60, 320, 100, "Dialog" );
32 }
33
widgetValueCB(Avtk::Widget * widget)34 void DialogUI::widgetValueCB( Avtk::Widget* widget)
35 {
36 //printf("DialogUI widgetValueCB: %s\n", widget->label() );
37 //dialog->visible( !dialog->visible() );
38 //printf("visible %i\n", dialog->visible() );
39
40 if( widget == show ) {
41 show->value( false );
42
43 int mx = widget->mouseX();
44 int my = widget->mouseY();
45
46 dialog->run( "Header", "This is dialog text", Avtk::Dialog::OK_CANCEL, mx, my );
47 } else if (widget == dialog ) {
48 float tmp = widget->value();
49 int ret = int(tmp);
50 printf("dialog returned %f : aka, %s", tmp, ret ? "OK" : "Cancel" );
51 }
52
53 }
54
55