Class: Gtk3App::Program
- Inherits:
-
Object
- Object
- Gtk3App::Program
- Defined in:
- lib/gtk3app/program.rb
Instance Attribute Summary collapse
-
#app_menu ⇒ Object
readonly
Returns the value of attribute app_menu.
-
#fs ⇒ Object
readonly
Returns the value of attribute fs.
-
#mini ⇒ Object
readonly
Returns the value of attribute mini.
-
#mini_menu ⇒ Object
readonly
Returns the value of attribute mini_menu.
-
#slot ⇒ Object
readonly
Returns the value of attribute slot.
-
#window ⇒ Object
readonly
Returns the value of attribute window.
Instance Method Summary collapse
- #about! ⇒ Object
- #fs! ⇒ Object
- #help! ⇒ Object
-
#initialize(app) ⇒ Program
constructor
A new instance of Program.
- #minime! ⇒ Object
- #quit! ⇒ Object
- #release ⇒ Object
Constructor Details
#initialize(app) ⇒ Program
Returns a new instance of Program.
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/gtk3app/program.rb', line 6 def initialize(app) Widget::MainWindow.set_icon Such::Thing::PARAMETERS[:Logo] @window = Widget::MainWindow.new(:window!, 'delete-event'){quit!} = Widget::AppMenu.new(@window, :app_menu!) do |w,*_,s| self.method(w.key).call if s=='activate' end @mini = = nil if .children.which{|item| item.key==:minime!} @mini = Widget::MainWindow.new(:mini, 'delete-event'){quit!} = 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 |
Instance Attribute Details
#app_menu ⇒ Object (readonly)
Returns the value of attribute app_menu.
5 6 7 |
# File 'lib/gtk3app/program.rb', line 5 def end |
#fs ⇒ Object (readonly)
Returns the value of attribute fs.
5 6 7 |
# File 'lib/gtk3app/program.rb', line 5 def fs @fs end |
#mini ⇒ Object (readonly)
Returns the value of attribute mini.
5 6 7 |
# File 'lib/gtk3app/program.rb', line 5 def mini @mini end |
#mini_menu ⇒ Object (readonly)
Returns the value of attribute mini_menu.
5 6 7 |
# File 'lib/gtk3app/program.rb', line 5 def end |
#slot ⇒ Object (readonly)
Returns the value of attribute slot.
5 6 7 |
# File 'lib/gtk3app/program.rb', line 5 def slot @slot end |
#window ⇒ Object (readonly)
Returns the value of attribute window.
5 6 7 |
# File 'lib/gtk3app/program.rb', line 5 def window @window end |
Instance Method Details
#about! ⇒ Object
34 35 36 37 38 39 40 |
# File 'lib/gtk3app/program.rb', line 34 def about! about = Such::AboutDialog.new :about_dialog about.transient_for = @window about.set_logo Widget::MainWindow.icon about.run about.destroy end |
#fs! ⇒ Object
29 30 31 32 |
# File 'lib/gtk3app/program.rb', line 29 def fs! @fs ? @window.unfullscreen : @window.fullscreen @fs = !@fs end |
#help! ⇒ Object
42 43 44 |
# File 'lib/gtk3app/program.rb', line 42 def help! system "#{CONFIG[:Open]} '#{Such::Thing::PARAMETERS[:HelpFile]}'" end |
#minime! ⇒ Object
53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 |
# File 'lib/gtk3app/program.rb', line 53 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 release @mini.hide @window.show end end |
#quit! ⇒ Object
83 84 85 86 |
# File 'lib/gtk3app/program.rb', line 83 def quit! release Gtk.main_quit end |
#release ⇒ Object
46 47 48 49 50 51 |
# File 'lib/gtk3app/program.rb', line 46 def release if @slot Slot.release(@slot) @slot = nil end end |