Class: VimMate::MainWindow
- Inherits:
-
Object
- Object
- VimMate::MainWindow
- Defined in:
- lib/vimmatelib/main_window.rb
Overview
Represents the main window of the application
Instance Attribute Summary collapse
-
#files_window ⇒ Object
Returns the value of attribute files_window.
-
#terminals_window ⇒ Object
Returns the value of attribute terminals_window.
-
#vim_window ⇒ Object
Returns the value of attribute vim_window.
Instance Method Summary collapse
-
#gtk_window ⇒ Object
The “window” for this object.
-
#initialize ⇒ MainWindow
constructor
Create the MainWindow.
-
#start(start_window) ⇒ Object
Show the window and start the main loop.
Constructor Details
#initialize ⇒ MainWindow
Create the MainWindow
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 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 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 |
# File 'lib/vimmatelib/main_window.rb', line 36 def initialize @gtk_main_window = Gtk::Window.new(Gtk::Window::TOPLEVEL) gtk_window.signal_connect("delete_event") do Gtk.main_quit end gtk_window.title = Config[:window_title] gtk_window.set_default_size(Config[:window_width], Config[:window_height]) gtk_window.set_icon_list(Icons.window_icons) # Add an event handler for keys events gtk_window.signal_connect("key-press-event") do |window, event| if event.state & Gdk::Window::ModifierType::CONTROL_MASK != 0 if event.state & Gdk::Window::ModifierType::SHIFT_MASK != 0 case event.keyval # CTRL+SHIFT+S: Set focus to terminal (shell) when Gdk::Keyval::GDK_S terminals_window.focus_terminal if terminals_window next true # CTRL+SHIFT+T: New terminal when Gdk::Keyval::GDK_T terminals_window.add_new_terminal if terminals_window next true # CTRL+SHIFT+W: Close terminal when Gdk::Keyval::GDK_W terminals_window.delete_current_terminal if terminals_window next true # CTRL+SHIFT+L: Set focus to file filter when Gdk::Keyval::GDK_L files_window.focus_file_filter if files_window next true # CTRL+SHIFT+F: Set focus to file list when Gdk::Keyval::GDK_F files_window.focus_file_list if files_window next true # CTRL+SHIFT+S: Set focus to search file list when Gdk::Keyval::GDK_E files_window.focus_file_search if files_window next true # CTRL+SHIFT+V: Set focus to Vim when Gdk::Keyval::GDK_V vim_window.focus_vim if vim_window next true else next nil end else case event.keyval # CTRL+PAGEDOWN: Next terminal when Gdk::Keyval::GDK_Page_Down terminals_window.next_terminal if terminals_window next true # CTRL+PAGEDOWN: Previous terminal when Gdk::Keyval::GDK_Page_Up terminals_window.prev_terminal if terminals_window next true else next nil end end end nil end end |
Instance Attribute Details
#files_window ⇒ Object
Returns the value of attribute files_window.
33 34 35 |
# File 'lib/vimmatelib/main_window.rb', line 33 def files_window @files_window end |
#terminals_window ⇒ Object
Returns the value of attribute terminals_window.
33 34 35 |
# File 'lib/vimmatelib/main_window.rb', line 33 def terminals_window @terminals_window end |
#vim_window ⇒ Object
Returns the value of attribute vim_window.
33 34 35 |
# File 'lib/vimmatelib/main_window.rb', line 33 def vim_window @vim_window end |
Instance Method Details
#gtk_window ⇒ Object
The “window” for this object
101 102 103 |
# File 'lib/vimmatelib/main_window.rb', line 101 def gtk_window @gtk_main_window end |
#start(start_window) ⇒ Object
Show the window and start the main loop. Also starts the window given in parameters. (Used for VimWindow)
107 108 109 110 111 |
# File 'lib/vimmatelib/main_window.rb', line 107 def start(start_window) gtk_window.show_all start_window.start Gtk.main end |