Class: Okayu::AppFrame
- Inherits:
-
Wx::Frame
- Object
- Wx::Frame
- Okayu::AppFrame
- Defined in:
- lib/views/app_frame.rb
Instance Method Summary collapse
-
#initialize(title, left = nil, top = nil, width = nil, height = nil) ⇒ AppFrame
constructor
A new instance of AppFrame.
- #on_close_tab ⇒ Object
- #on_connect ⇒ Object
- #on_move(event) ⇒ Object
- #on_new_tab ⇒ Object
- #on_new_url ⇒ Object
- #on_quit(event) ⇒ Object
- #on_size(event) ⇒ Object
Constructor Details
#initialize(title, left = nil, top = nil, width = nil, height = nil) ⇒ AppFrame
Returns a new instance of AppFrame.
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 |
# File 'lib/views/app_frame.rb', line 10 def initialize(title, left=nil, top=nil, width=nil, height=nil) if UserInfo.left left = UserInfo.left unless left top = UserInfo.top unless top width = UserInfo.width unless width height = UserInfo.height unless height else left = 100 unless left top = 100 unless top width = 500 unless width height = 430 unless height end super(nil, -1, title, Wx::Point.new(left, top), Wx::Size.new(width, height)) = Wx::Menu.new .append(NEW_TAB, "新しいタブ(&T)\tCtrl+T", "新しいタブを開きます") .append(NEW_URL, "新しいURLを開く(&L)\tCtrl+L", "新しいURLを開きます") .append(CLOSE_TAB, "タブを閉じる(&C)\tCtrl+W", "現在のタブを閉じます") .append(Wx::ID_EXIT, "終了(&X)", "おかゆを終了します") = Wx::Menu.new .append(LOGIN, "ログイン(&L)", "ログインします") = Wx::MenuBar.new .append(, "ファイル(&F)") .append(, "接続(&C)") () @status_bar = Wx::StatusBar.new(self, Wx::ID_ANY) (@status_bar) rect = get_client_rect @panel = MainPanel.new(self, rect.x, rect.y, rect.width, rect.height) (NEW_TAB){on_new_tab} (NEW_URL){on_new_url} (CLOSE_TAB){on_close_tab} (LOGIN){on_connect} (Wx::ID_EXIT){|event| on_quit(event)} evt_move{|event| on_move(event)} evt_size{|event| on_size(event)} end |
Instance Method Details
#on_close_tab ⇒ Object
59 60 61 |
# File 'lib/views/app_frame.rb', line 59 def on_close_tab @panel.close_tab end |
#on_connect ⇒ Object
67 68 69 70 71 72 73 |
# File 'lib/views/app_frame.rb', line 67 def on_connect login_dialog = LoginDialog.new(self) login_dialog.show_modal if Client.connected? @status_bar.set_status_text '接続してるかも' end end |
#on_move(event) ⇒ Object
75 76 77 78 79 |
# File 'lib/views/app_frame.rb', line 75 def on_move event position = get_position UserInfo.left = position.x UserInfo.top = position.y end |
#on_new_tab ⇒ Object
55 56 57 |
# File 'lib/views/app_frame.rb', line 55 def on_new_tab @panel.create_tab end |
#on_new_url ⇒ Object
63 64 65 |
# File 'lib/views/app_frame.rb', line 63 def on_new_url @panel.get_current_page.on_new_url end |
#on_quit(event) ⇒ Object
89 90 91 |
# File 'lib/views/app_frame.rb', line 89 def on_quit event close(TRUE) end |