Skip to content
This repository
Newer
Older
100755 63 lines (49 sloc) 1.75 kb
45cf7d8c »
2009-02-02 initial checkin of r2610 from trunk
1 #!/usr/bin/env ruby
2
3 require 'fox16'
4
5 include Fox
6
7 class DirListWindow < FXMainWindow
8
9 def initialize(app)
10 # Invoke the base class initialize first
11 super(app, "Directory List", :opts => DECOR_ALL, :width => 800, :height => 600)
12
13 # Make menu bar
14 menubar = FXMenuBar.new(self, LAYOUT_FILL_X)
15 filemenu = FXMenuPane.new(self)
16 FXMenuCommand.new(filemenu, "&Quit\tCtl-Q", nil, getApp(), FXApp::ID_QUIT)
17 FXMenuTitle.new(menubar, "&File", nil, filemenu)
18 helpmenu = FXMenuPane.new(self)
19 FXMenuCommand.new(helpmenu, "&About FOX...").connect(SEL_COMMAND) {
20 FXMessageBox.information(self, MBOX_OK, "About FOX",
21 "FOX is a really, really cool C++ library...\n" +
22 "and FXRuby is an even cooler GUI for Ruby!")
23 }
24 FXMenuTitle.new(menubar, "&Help", nil, helpmenu, LAYOUT_RIGHT)
25
26 # Text field at bottom
27 text = FXTextField.new(self, 10,
28 :opts => LAYOUT_SIDE_BOTTOM|LAYOUT_FILL_X|FRAME_SUNKEN|FRAME_THICK)
29
30 # Make contents
31 dirlist = FXDirList.new(self, :opts => (HSCROLLING_OFF|
32 TREELIST_SHOWS_LINES|TREELIST_SHOWS_BOXES|FRAME_SUNKEN|FRAME_THICK|
33 LAYOUT_FILL_X|LAYOUT_FILL_Y))
34
35 # Now make the directory list widget (dirlist) the message target
36 # for the text field. If you type a new directory name in the text
37 # field the directory list should navigate to that directory.
38 text.target = dirlist
39 text.selector = FXWindow::ID_SETVALUE
40 end
41
42 # Create and show the main window
43 def create
44 super
45 show(PLACEMENT_SCREEN)
46 end
47 end
48
49 def run
50 # Make application
51 application = FXApp.new("DirList", "FoxTest")
52
53 # Make window
54 DirListWindow.new(application)
55
56 # Create app
57 application.create
58
59 # Run
60 application.run
61 end
62
63 run
Something went wrong with that request. Please try again.