Class: Smagacor::SmagacorWindow
- Defined in:
- lib/smagacor/smagacor-ui.rb
Overview
Main window for Smagacor.
Constant Summary collapse
- DESCRIPTION =
Small description of Smagacor, for the about view.
"\n\nSmagacor #{::Smagacor::VERSION.join('.')} Smagacor is a collection of some small games. It provides an easy interface for adding new games and has a pleasing :-) appearance. Select a game from the menu on the left side! And have fun with Smagacor!!! smagacor.rubyforge.org"
Class Method Summary collapse
-
.load_image(app, file) ⇒ Object
Used to load *.png images into FXPNGIcon objects.
Instance Method Summary collapse
- #create ⇒ Object
-
#initialize(app, controller) ⇒ SmagacorWindow
constructor
Create the main window, using
app[FXApplication] andcontroller[Controller]. - #onUndo(sender, sel, event) ⇒ Object
Constructor Details
#initialize(app, controller) ⇒ SmagacorWindow
Create the main window, using app [FXApplication] and controller [Controller].
172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 |
# File 'lib/smagacor/smagacor-ui.rb', line 172 def initialize( app, controller ) super( app, "Smagacor Game Collection", nil, nil, DECOR_ALL, 100, 100, 800, 600 ) @controller = controller @logwindow = LogWindow.new( app ) logger.set_log_dev( @logwindow ) = FXMenubar.new( self, LAYOUT_SIDE_TOP|LAYOUT_FILL_X ) = FXMenuPane.new( self ) FXMenuCommand.new( , "Quit\tCtl-Q", nil, getApp(), FXApp::ID_QUIT ) FXMenuTitle.new( , "&File", nil, ) = FXMenuPane.new( self ) FXMenuCommand.new( , "Undo\tCtl-Z" ).connect( SEL_COMMAND, method( :onUndo ) ) FXMenuTitle.new( , "&Edit", nil, ) = FXMenuPane.new( self ) FXMenuCommand.new( , "Log Window...\tCtl-L" ).connect( SEL_COMMAND ) { @logwindow.show } FXMenuCommand.new( , "About Smagacor\tCtl-A" ).connect( SEL_COMMAND ) { @switcher.current = 0 } FXMenuTitle.new( , "&Help", nil, ) status = FXStatusbar.new( self, LAYOUT_SIDE_BOTTOM|LAYOUT_FILL_X|STATUSBAR_WITH_DRAGCORNER ) splitter = FXSplitter.new( self, LAYOUT_SIDE_TOP|LAYOUT_FILL_X|LAYOUT_FILL_Y|SPLITTER_TRACKING ) @shutter = GameMenuShutter.new( splitter ) @switcher = GameSwitcher.new( splitter ) @shutter.init_game_list( @switcher, controller ) FXLabel.new( @switcher, DESCRIPTION, SmagacorWindow.load_image( getApp(), controller.get_file( 'smagacor.png' ) ), ICON_ABOVE_TEXT ) end |
Class Method Details
.load_image(app, file) ⇒ Object
Used to load *.png images into FXPNGIcon objects.
164 165 166 167 168 169 |
# File 'lib/smagacor/smagacor-ui.rb', line 164 def self.load_image( app, file ) img = FXPNGIcon.new( app, nil, IMAGE_KEEP|IMAGE_SHMI|IMAGE_SHMP ) FXFileStream.open( file, FXStreamLoad ) {|str| img.loadPixels(str) } img.create img end |