Sha256: 7392b49d007aada442f1135812fadc3e36f08cf60da07bf3370586fb0c175447
Contents?: true
Size: 2 KB
Versions: 3
Compression:
Stored size: 2 KB
Contents
module Gtk3App class Program using Rafini::Array attr_reader :window, :app_menu, :mini, :mini_menu, :fs, :slot def initialize(app) Widget::MainWindow.set_icon Such::Thing::PARAMETERS[:Logo] @window = Widget::MainWindow.new(:window!, 'delete-event'){quit!} @app_menu = Widget::AppMenu.new(@window, :app_menu!) do |w,*_,s| self.method(w.key).call if s=='activate' end @mini = @mini_menu = nil if @app_menu.children.which{|item| item.key==:minime!} @mini = Widget::MainWindow.new(:mini, 'delete-event'){quit!} @mini_menu = Widget::AppMenu.new(@mini, :mini_menu!) do |w,*_,s| self.method(w.key).call if s=='activate' minime! if s=='button_press_event' end end @fs = false @slot = nil app.run(self) end def fs! @fs ? @window.unfullscreen : @window.fullscreen @fs = !@fs end def about! about = Such::AboutDialog.new :about_dialog about.set_logo Widget::MainWindow.icon about.run about.destroy end def help! system "#{CONFIG[:Open]} '#{Such::Thing::PARAMETERS[:HelpFile]}'" end def minime! if @window.visible? @slot = Slot.get if @slot s = CONFIG[:SlotsScale] x, y = CONFIG[:SLOTS_OFFSET] w, h = Gdk.screen_width, Gdk.screen_height case CONFIG[:SlotsOrientation] when :horizontal @mini.move(w-@slot*s+x, h-s+y) when :vertical @mini.move(w-s+x, h-@slot*s+y) else if @slot%2==0 @mini.move(w-((@slot+2)/2)*s+x, h-s+y) else @mini.move(w-s+x, h-((@slot+1)/2)*s+y) end end @mini.keep_above=true @window.hide @mini.show end else Slot.release(@slot) if @slot @mini.hide @window.show end end def quit! Slot.release(@slot) if @slot Gtk.main_quit end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
gtk3app-1.4.0 | lib/gtk3app/program.rb |
gtk3app-1.3.1 | lib/gtk3app/program.rb |
gtk3app-1.3.0 | lib/gtk3app/program.rb |