summaryrefslogtreecommitdiffstats
path: root/examples/toplevel/options.ui.h
blob: 210c25150c714c9ea0373d01ebde9e192c68223b (plain)
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
void OptionsDialog::apply()
{
    TQStringList flagList;
    bool wstyle = false;
    WFlags f = WDestructiveClose | WType_TopLevel | WStyle_Customize;

    if ( bgBorder->isChecked() ) {
	if ( rbBorderNormal->isChecked() ) {
	    f |= WStyle_NormalBorder;
	    flagList += "WStyle_NormalBorder";
	    wstyle = true;
	}
	else if ( rbBorderDialog->isChecked() ) {
	    f |= WStyle_DialogBorder;
	    flagList += "WStyle_DialogBorder";
	    wstyle = true;
	}

	if ( bgTitle->isChecked() ) {
	    f |= WStyle_Title;
	    flagList += "WStyle_Title";
	    wstyle = true;
	    if ( cbTitleSystem->isChecked() ) {
		f |= WStyle_SysMenu;
		flagList += "WStyle_SysMenu";
	    }
	    if ( cbTitleMinimize->isChecked() ) {
		f |= WStyle_Minimize;
		flagList += "WStyle_Minimize";
	    }
	    if ( cbTitleMaximize->isChecked() ) {
		f |= WStyle_Maximize;
		flagList += "WStyle_Maximize";
	    }
	    if ( cbTitleContext->isChecked() ) {
		f |= WStyle_ContextHelp;
		flagList += "WStyle_ContextHelp";
	    }
	}
    } else {
	f |= WStyle_NoBorder;
	flagList += "WStyle_NoBorder";
	wstyle = true;
    }

    TQWidget *parent = this;
    if ( cbBehaviorTaskbar->isChecked() ) {
	parent = 0;
	f |= WGroupLeader;
	flagList += "WGroupLeader";
    }
    if ( cbBehaviorStays->isChecked() ) {
	f |= WStyle_StaysOnTop /*| WX11BypassWM*/;
	flagList += "WStyle_StaysOnTop";
	wstyle = true;
    }
    if ( cbBehaviorPopup->isChecked() ) {
	f |= WType_Popup;
	flagList += "WType_Popup";
    }
    if ( cbBehaviorModal->isChecked() ) {
	f |= WShowModal;
	flagList += "WShowModal";
    }
    if ( cbBehaviorTool->isChecked() ) {
	f |= WStyle_Tool;
	flagList += "WStyle_Tool";
	wstyle = true;
    }

    if (wstyle)
	flagList.push_front("WStyle_Customize");

    if ( !widget ) {
	widget = new TQVBox( parent, 0, f );
	widget->setMargin( 20 );
	TQLabel *label = new TQLabel(flagList.join(" | "), widget);
	label->setTextFormat(RichText);
	label->setAlignment(WordBreak);
	TQPushButton *okButton = new TQPushButton( "Close", widget );
	connect( okButton, SIGNAL(clicked()), widget, SLOT(close()) );
	widget->move( pos() );
    } else {
	widget->reparent( parent, f, widget->geometry().topLeft(), FALSE);
    }

    widget->setCaption( leCaption->text() );
    widget->setIcon( leIcon->text() );
    widget->setWindowOpacity(double(slTransparency->maxValue() - slTransparency->value()) / 100);

    widget->show();
}

void OptionsDialog::pickIcon()
{
    TQString filename = TQFileDialog::getOpenFileName( TQString::null, TQString::null, this );
    leIcon->setText( filename );
}