summaryrefslogtreecommitdiffstats
path: root/qtruby/rubylib/examples/passivepopup/passivepopup.rb
blob: ae3e1374e24bc7656faca978df345f1453c2cf3d (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
#!/usr/bin/env ruby

require 'Qt'
 
class PassiveWindow < TQt::Frame
	MARGIN = 20
	
    def initialize(message)
        super(nil, "passivedlg",
            TQt::WStyle_Customize | TQt::WX11BypassWM | TQt::WStyle_StaysOnTop |
			TQt::WStyle_Tool | TQt::WStyle_NoBorder)

        setFrameStyle(TQt::Frame::Box| TQt::Frame::Plain)
        setLineWidth(2)

        setMinimumWidth(100)
        layout=TQt::VBoxLayout.new(self, 6, 11)
        layout.setAutoAdd(true)
        TQt::Label.new(message, self)

        quit=TQt::PushButton.new(tr("Close"), self)
        connect(quit, TQ_SIGNAL("clicked()"), TQ_SLOT("close()"))
	end

    def show
        super
        move(TQt::Application.desktop().width() - width() - MARGIN,
            TQt::Application.desktop().height() - height() - MARGIN)
	end
end
  	
if (Process.fork != nil)
	exit
end
app = TQt::Application.new(ARGV)
win = PassiveWindow.new(ARGV[0])
app.mainWidget = win
win.show
app.exec