Got the menubar working for the main window, started working on the GridPropertiesWidget.

This commit is contained in:
2014-05-06 22:06:05 -07:00
parent 142a8b2cd2
commit 781512176e
3 changed files with 80 additions and 26 deletions

View File

@@ -1,36 +1,12 @@
require 'wx'
require 'tailor/GUI/MainWindow'
module Tailor
module GUI
class Application < Wx::App
def on_init
MainWindow.new
end
end
class MainWindow < Wx::Frame
def initialize()
super(nil, -1, 'Tailor')
@mainpanel = Wx::Panel.new(self)
@close_button = Wx::Button.new(@mainpanel, -1, 'Quit')
evt_button(@close_button.get_id()) { |event| close_button_clicked(event) }
@mainpanel_sizer = Wx::BoxSizer.new(Wx::VERTICAL)
@mainpanel.set_sizer(@mainpanel_sizer)
@mainpanel_sizer.add(@close_button, 0, Wx::GROW|Wx::ALL, 2)
@button1 = Wx::Button.new(@mainpanel, -1, 'Button 1')
@button2 = Wx::Button.new(@mainpanel, -1, 'Button 2')
@button3 = Wx::Button.new(@mainpanel, -1, 'Button 3')
@mainpanel_sizer.add(@button1, -1, Wx::GROW|Wx::ALL, 2)
@mainpanel_sizer.add(@button2, -1, Wx::GROW|Wx::ALL, 2)
@mainpanel_sizer.add(@button3, -1, Wx::GROW|Wx::ALL, 2)
show()
end
def close_button_clicked(event)
puts "I don't do anything, but good on you for using a mouse"
end
Tailor::GUI::MainWindow.new
end
end
end
end

View File

@@ -0,0 +1,11 @@
require 'wx'
module Tailor
module GUI
class GridPropertiesWidget < Wx::Frame
def initialize()
super(nil, -1)
end
end
end
end

View File

@@ -0,0 +1,67 @@
require 'wx'
require 'Tailor/version'
module Tailor
module GUI
class MainWindow < Wx::Frame
def initialize()
super(nil, -1, 'Tailor')
@mainPanel = Wx::Panel.new(self)
@menuBar = Wx::MenuBar.new
menuFile = Wx::Menu.new
menuFileNew = menuFile.append(Wx::ID_ANY, "&New\tAlt-N", "New Compilation")
menuFileOpen = menuFile.append(Wx::ID_ANY, "&Open\tAlt-O", "Open Compilation")
menuFileSave = menuFile.append(Wx::ID_ANY, "&Save\tAlt-S", "Save Compilation")
menuFileExport = menuFile.append(Wx::ID_ANY, "&Export\tAlt-E", "Export Compilation")
menuFile.append_separator
menuFileClose = menuFile.append(Wx::ID_ANY, "&Close\tAlt-W", "Close Compilation")
menuFile.append_separator
menuFileExit = menuFile.append(Wx::ID_EXIT, "E&xit\tAlt-X", "Exit Tailor")
@menuBar.append(menuFile, "&File")
menuHelp = Wx::Menu.new
menuHelpAbout = menuHelp.append(Wx::ID_ABOUT, "&About...\tF1", "About Tailor")
@menuBar.append(menuHelp, "&Help")
self.menu_bar = @menuBar
evt_menu(menuFileNew, :on_file_new)
evt_menu(menuFileOpen, :on_file_open)
evt_menu(menuFileSave, :on_file_save)
evt_menu(menuFileExport, :on_file_export)
evt_menu(menuFileClose, :on_file_close)
evt_menu(Wx::ID_EXIT, :on_file_exit)
evt_menu(Wx::ID_ABOUT, :on_help_about)
show()
end
def on_file_new
end
def on_file_open
end
def on_file_save
end
def on_file_export
end
def on_file_close
end
def on_help_about
Wx::about_box( :name => self.title,
:version => Tailor::VERSION,
:description => (
"Tailor : A program for stitching tilesets\n" +
"Please file bugs at https://github.com/akesterson/tailor"
)
)
end
def on_file_exit
close
end
end
end
end