From 03eafd2259ba4ba639e7c0407dd6e9adf04c65bf Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Dancs=C3=B3=20R=C3=B3bert?= <dancso.robert@d-rendszer.hu>
Date: Sat, 5 Jan 2013 08:27:48 +0100
Subject: [PATCH] Added "Hide status", "Hide navigation" and "Hide menu" to
the "View" menu.
---
src/apps/webpositive/BrowserWindow.cpp | 39 ++++++++++++++++++++++++++++----
src/apps/webpositive/BrowserWindow.h | 12 ++++++++++
2 files changed, 46 insertions(+), 5 deletions(-)
diff --git a/src/apps/webpositive/BrowserWindow.cpp b/src/apps/webpositive/BrowserWindow.cpp
index 9f5e3e7..ade70b8 100644
a
|
b
|
enum {
|
115 | 115 | FIND_TEXT_CHANGED = 'ftxt', |
116 | 116 | |
117 | 117 | SELECT_TAB = 'sltb', |
| 118 | |
| 119 | HIDE_STATUSBAR = 'hstb', |
| 120 | HIDE_NAVIGATIONBAR = 'bbtb', |
| 121 | HIDE_MENUBAR = 'mntb', |
118 | 122 | }; |
119 | 123 | |
120 | 124 | |
… |
… |
BrowserWindow::BrowserWindow(BRect frame, SettingsMessage* appSettings,
|
283 | 287 | |
284 | 288 | // Menu |
285 | 289 | #if INTEGRATE_MENU_INTO_TAB_BAR |
286 | | BMenu* mainMenu = fTabManager->Menu(); |
| 290 | mainMenu = fTabManager->Menu(); |
287 | 291 | #else |
288 | | BMenu* mainMenu = new BMenuBar("Main menu"); |
| 292 | mainMenu = new BMenuBar("Main menu"); |
289 | 293 | #endif |
290 | 294 | BMenu* menu = new BMenu(B_TRANSLATE("Window")); |
291 | 295 | BMessage* newWindowMessage = new BMessage(NEW_WINDOW); |
… |
… |
BrowserWindow::BrowserWindow(BRect frame, SettingsMessage* appSettings,
|
361 | 365 | menu->AddItem(fFullscreenItem); |
362 | 366 | menu->AddItem(new BMenuItem(B_TRANSLATE("Page source"), |
363 | 367 | new BMessage(SHOW_PAGE_SOURCE), 'U')); |
| 368 | |
| 369 | menu->AddSeparatorItem(); |
| 370 | menu->AddItem(fHideStatusMenuItem = new BMenuItem(B_TRANSLATE("Hide status"), |
| 371 | new BMessage(HIDE_STATUSBAR), 'S', B_SHIFT_KEY)); |
| 372 | menu->AddItem(fHideNavigationMenuItem = new BMenuItem(B_TRANSLATE("Hide navigation"), |
| 373 | new BMessage(HIDE_NAVIGATIONBAR), 'N', B_SHIFT_KEY)); |
| 374 | menu->AddItem(fHideMenuMenuItem = new BMenuItem(B_TRANSLATE("Hide menu"), |
| 375 | new BMessage(HIDE_MENUBAR), 'M', B_SHIFT_KEY)); |
| 376 | |
364 | 377 | mainMenu->AddItem(menu); |
365 | 378 | |
366 | 379 | fHistoryMenu = new BMenu(B_TRANSLATE("History")); |
… |
… |
BrowserWindow::BrowserWindow(BRect frame, SettingsMessage* appSettings,
|
449 | 462 | ; |
450 | 463 | |
451 | 464 | // Navigation group |
452 | | BGroupLayout* navigationGroup = BLayoutBuilder::Group<>(B_VERTICAL, 0.0) |
| 465 | navigationGroup = BLayoutBuilder::Group<>(B_VERTICAL, 0.0) |
453 | 466 | .Add(BLayoutBuilder::Group<>(B_HORIZONTAL, kElementSpacing) |
454 | 467 | .Add(fBackButton) |
455 | 468 | .Add(fForwardButton) |
… |
… |
BrowserWindow::BrowserWindow(BRect frame, SettingsMessage* appSettings,
|
463 | 476 | ; |
464 | 477 | |
465 | 478 | // Status bar group |
466 | | BGroupLayout* statusGroup = BLayoutBuilder::Group<>(B_VERTICAL, 0.0) |
| 479 | statusGroup = BLayoutBuilder::Group<>(B_VERTICAL, 0.0) |
467 | 480 | .Add(new BSeparatorView(B_HORIZONTAL, B_PLAIN_BORDER)) |
468 | 481 | .Add(BLayoutBuilder::Group<>(B_HORIZONTAL, kElementSpacing) |
469 | 482 | .Add(fStatusText) |
… |
… |
BrowserWindow::BrowserWindow(BRect frame, SettingsMessage* appSettings,
|
478 | 491 | new BMessage(TOGGLE_FULLSCREEN)); |
479 | 492 | toggleFullscreenButton->SetBackgroundMode(BitmapButton::MENUBAR_BACKGROUND); |
480 | 493 | |
481 | | BGroupLayout* menuBarGroup = BLayoutBuilder::Group<>(B_HORIZONTAL, 0.0) |
| 494 | menuBarGroup = BLayoutBuilder::Group<>(B_HORIZONTAL, 0.0) |
482 | 495 | .Add(mainMenu) |
483 | 496 | .Add(toggleFullscreenButton, 0.0f) |
484 | 497 | ; |
… |
… |
BrowserWindow::MessageReceived(BMessage* message)
|
803 | 816 | case B_PAGE_SOURCE_RESULT: |
804 | 817 | _HandlePageSourceResult(message); |
805 | 818 | break; |
| 819 | |
| 820 | case HIDE_STATUSBAR: |
| 821 | statusGroup->SetVisible(!statusGroup->IsVisible()); |
| 822 | if (statusGroup->IsVisible()) fHideStatusMenuItem->SetLabel(B_TRANSLATE("Hide status")); |
| 823 | else fHideStatusMenuItem->SetLabel(B_TRANSLATE("Show status")); |
| 824 | break; |
| 825 | case HIDE_NAVIGATIONBAR: |
| 826 | navigationGroup->SetVisible(!navigationGroup->IsVisible()); |
| 827 | if (navigationGroup->IsVisible()) fHideNavigationMenuItem->SetLabel(B_TRANSLATE("Hide navigation")); |
| 828 | else fHideNavigationMenuItem->SetLabel(B_TRANSLATE("Show navigation")); |
| 829 | break; |
| 830 | case HIDE_MENUBAR: |
| 831 | menuBarGroup->SetVisible(!menuBarGroup->IsVisible()); |
| 832 | if (menuBarGroup->IsVisible()) fHideMenuMenuItem->SetLabel(B_TRANSLATE("Hide menu")); |
| 833 | else fHideMenuMenuItem->SetLabel(B_TRANSLATE("Show menu")); |
| 834 | break; |
806 | 835 | |
807 | 836 | case EDIT_FIND_NEXT: |
808 | 837 | CurrentWebView()->FindString(fFindTextControl->Text(), true, |
diff --git a/src/apps/webpositive/BrowserWindow.h b/src/apps/webpositive/BrowserWindow.h
index bf80d75..1f34246 100644
a
|
b
|
|
31 | 31 | |
32 | 32 | |
33 | 33 | #include "WebWindow.h" |
| 34 | #include <GridLayoutBuilder.h> |
| 35 | #include <GroupLayout.h> |
| 36 | #include <GroupLayoutBuilder.h> |
| 37 | #include <LayoutBuilder.h> |
34 | 38 | #include <Messenger.h> |
35 | 39 | #include <String.h> |
36 | 40 | |
… |
… |
private:
|
201 | 205 | const BMessage* message); |
202 | 206 | |
203 | 207 | private: |
| 208 | BMenu* mainMenu; |
204 | 209 | BMenu* fHistoryMenu; |
205 | 210 | int32 fHistoryMenuFixedItemCount; |
206 | 211 | |
… |
… |
private:
|
213 | 218 | BMenuItem* fFullscreenItem; |
214 | 219 | BMenuItem* fBackMenuItem; |
215 | 220 | BMenuItem* fForwardMenuItem; |
| 221 | BMenuItem* fHideStatusMenuItem; |
| 222 | BMenuItem* fHideNavigationMenuItem; |
| 223 | BMenuItem* fHideMenuMenuItem; |
| 224 | |
| 225 | BGroupLayout* statusGroup; |
| 226 | BGroupLayout* navigationGroup; |
| 227 | BGroupLayout* menuBarGroup; |
216 | 228 | |
217 | 229 | IconButton* fBackButton; |
218 | 230 | IconButton* fForwardButton; |