diff options
author | erg@google.com <erg@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-03-04 23:15:53 +0000 |
---|---|---|
committer | erg@google.com <erg@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-03-04 23:15:53 +0000 |
commit | 164606478faaa606df0c3d2637c4c0a476a59414 (patch) | |
tree | 2fd9491713efb56e15883848237f83c119c68a69 /views | |
parent | 039c7b0b28a2501bf4f305ec9e21dbb7518e52cc (diff) | |
download | chromium_src-164606478faaa606df0c3d2637c4c0a476a59414.zip chromium_src-164606478faaa606df0c3d2637c4c0a476a59414.tar.gz chromium_src-164606478faaa606df0c3d2637c4c0a476a59414.tar.bz2 |
Do all OOLing in the views code. linux_views now builds clean with the clang plugin.
BUG=carnitas
TEST=compiles
Review URL: http://codereview.chromium.org/6622002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@76992 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'views')
42 files changed, 502 insertions, 216 deletions
diff --git a/views/controls/label.cc b/views/controls/label.cc index 1b105f0..810769a 100644 --- a/views/controls/label.cc +++ b/views/controls/label.cc @@ -77,6 +77,10 @@ void Label::OnBoundsChanged() { text_size_valid_ &= !is_multi_line_; } +std::string Label::GetClassName() const { + return kViewClassName; +} + void Label::OnPaint(gfx::Canvas* canvas) { OnPaintBackground(canvas); @@ -128,6 +132,14 @@ const GURL Label::GetURL() const { return url_set_ ? url_ : GURL(UTF16ToUTF8(text_)); } +void Label::SetColor(const SkColor& color) { + color_ = color; +} + +SkColor Label::GetColor() const { + return color_; +} + void Label::SetHorizontalAlignment(Alignment alignment) { // If the View's UI layout is right-to-left and rtl_alignment_mode_ is // USE_UI_ALIGNMENT, we need to flip the alignment so that the alignment diff --git a/views/controls/label.h b/views/controls/label.h index d916659..1bb2b59 100644 --- a/views/controls/label.h +++ b/views/controls/label.h @@ -69,7 +69,7 @@ class Label : public View { virtual void OnBoundsChanged(); // Returns views/Label. - virtual std::string GetClassName() const { return kViewClassName; } + virtual std::string GetClassName() const; // Overridden to paint virtual void OnPaint(gfx::Canvas* canvas); @@ -97,10 +97,10 @@ class Label : public View { const GURL GetURL() const; // Set the color - virtual void SetColor(const SkColor& color) { color_ = color; } + virtual void SetColor(const SkColor& color); // Return a reference to the currently used color. - virtual SkColor GetColor() const { return color_; } + virtual SkColor GetColor() const; // Set horizontal alignment. If the locale is RTL, and the RTL alignment // setting is set as USE_UI_ALIGNMENT, the alignment is flipped around. diff --git a/views/controls/menu/menu_2.cc b/views/controls/menu/menu_2.cc index f64f275..4fa5851 100644 --- a/views/controls/menu/menu_2.cc +++ b/views/controls/menu/menu_2.cc @@ -16,6 +16,8 @@ Menu2::Menu2(ui::MenuModel* model) Rebuild(); } +Menu2::~Menu2() {} + gfx::NativeMenu Menu2::GetNativeMenu() const { return wrapper_->GetNativeMenu(); } diff --git a/views/controls/menu/menu_2.h b/views/controls/menu/menu_2.h index 8916b7c..7204120 100644 --- a/views/controls/menu/menu_2.h +++ b/views/controls/menu/menu_2.h @@ -33,7 +33,7 @@ class Menu2 { // MyClass : menu_(this) {} // is likely to have problems. explicit Menu2(ui::MenuModel* model); - virtual ~Menu2() {} + virtual ~Menu2(); // How the menu is aligned relative to the point it is shown at. // The alignment is reversed by menu if text direction is right to left. diff --git a/views/controls/menu/menu_config.cc b/views/controls/menu/menu_config.cc index cfdebea..d3c510d 100644 --- a/views/controls/menu/menu_config.cc +++ b/views/controls/menu/menu_config.cc @@ -10,6 +10,33 @@ namespace views { static MenuConfig* config_instance = NULL; +MenuConfig::MenuConfig() + : text_color(SK_ColorBLACK), + item_top_margin(3), + item_bottom_margin(4), + item_no_icon_top_margin(1), + item_no_icon_bottom_margin(3), + item_left_margin(4), + label_to_arrow_padding(10), + arrow_to_edge_padding(5), + icon_to_label_padding(8), + gutter_to_label(5), + check_width(16), + check_height(16), + radio_width(16), + radio_height(16), + arrow_height(9), + arrow_width(9), + gutter_width(0), + separator_height(6), + render_gutter(false), + show_mnemonics(false), + scroll_arrow_height(3), + label_to_accelerator_padding(10) { +} + +MenuConfig::~MenuConfig() {} + void MenuConfig::Reset() { delete config_instance; config_instance = NULL; diff --git a/views/controls/menu/menu_config.h b/views/controls/menu/menu_config.h index ae5446d..06a31f1 100644 --- a/views/controls/menu/menu_config.h +++ b/views/controls/menu/menu_config.h @@ -14,30 +14,8 @@ namespace views { // Layout type information for menu items. Use the instance() method to obtain // the MenuConfig for the current platform. struct MenuConfig { - MenuConfig() - : text_color(SK_ColorBLACK), - item_top_margin(3), - item_bottom_margin(4), - item_no_icon_top_margin(1), - item_no_icon_bottom_margin(3), - item_left_margin(4), - label_to_arrow_padding(10), - arrow_to_edge_padding(5), - icon_to_label_padding(8), - gutter_to_label(5), - check_width(16), - check_height(16), - radio_width(16), - radio_height(16), - arrow_height(9), - arrow_width(9), - gutter_width(0), - separator_height(6), - render_gutter(false), - show_mnemonics(false), - scroll_arrow_height(3), - label_to_accelerator_padding(10) { - } + MenuConfig(); + ~MenuConfig(); // Resets the single shared MenuConfig instance. The next time instance() is // invoked a new MenuConfig is created and configured. diff --git a/views/controls/menu/menu_controller.cc b/views/controls/menu/menu_controller.cc index 906bd40..6551687 100644 --- a/views/controls/menu/menu_controller.cc +++ b/views/controls/menu/menu_controller.cc @@ -243,6 +243,12 @@ struct MenuController::SelectByCharDetails { int next_match; }; +// MenuController:State ------------------------------------------------------ + +MenuController::State::State() : item(NULL), submenu_open(false) {} + +MenuController::State::~State() {} + // MenuController ------------------------------------------------------------ // static diff --git a/views/controls/menu/menu_controller.h b/views/controls/menu/menu_controller.h index 2da3a4b..dfd68b4 100644 --- a/views/controls/menu/menu_controller.h +++ b/views/controls/menu/menu_controller.h @@ -131,7 +131,8 @@ class MenuController : public MessageLoopForUI::Dispatcher { // Tracks selection information. struct State { - State() : item(NULL), submenu_open(false) {} + State(); + ~State(); // The selected menu item. MenuItemView* item; diff --git a/views/controls/menu/menu_delegate.cc b/views/controls/menu/menu_delegate.cc new file mode 100644 index 0000000..e70fb17 --- /dev/null +++ b/views/controls/menu/menu_delegate.cc @@ -0,0 +1,113 @@ +// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "views/controls/menu/menu_delegate.h" + +namespace views { + +bool MenuDelegate::IsItemChecked(int id) const { + return false; +} + +std::wstring MenuDelegate::GetLabel(int id) const { + return std::wstring(); +} + +std::wstring MenuDelegate::GetTooltipText(int id, + const gfx::Point& screen_loc) { + return std::wstring(); +} + +bool MenuDelegate::GetAccelerator(int id, Accelerator* accelerator) { + return false; +} + +bool MenuDelegate::ShowContextMenu(MenuItemView* source, + int id, + const gfx::Point& p, + bool is_mouse_gesture) { + return false; +} + +bool MenuDelegate::SupportsCommand(int id) const { + return true; +} + +bool MenuDelegate::IsCommandEnabled(int id) const { + return true; +} + +bool MenuDelegate::GetContextualLabel(int id, std::wstring* out) const { + return false; +} + +bool MenuDelegate::ShouldCloseAllMenusOnExecute(int id) { + return true; +} + +void MenuDelegate::ExecuteCommand(int id, int mouse_event_flags) { + ExecuteCommand(id); +} + +bool MenuDelegate::IsTriggerableEvent(const MouseEvent& e) { + return e.IsLeftMouseButton() || e.IsRightMouseButton(); +} + +bool MenuDelegate::CanDrop(MenuItemView* menu, const OSExchangeData& data) { + return false; +} + +bool MenuDelegate::GetDropFormats( + MenuItemView* menu, + int* formats, + std::set<OSExchangeData::CustomFormat>* custom_formats) { + return false; +} + +bool MenuDelegate::AreDropTypesRequired(MenuItemView* menu) { + return false; +} + +int MenuDelegate::GetDropOperation(MenuItemView* item, + const DropTargetEvent& event, + DropPosition* position) { + NOTREACHED() << "If you override CanDrop, you need to override this too"; + return ui::DragDropTypes::DRAG_NONE; +} + +int MenuDelegate::OnPerformDrop(MenuItemView* menu, + DropPosition position, + const DropTargetEvent& event) { + NOTREACHED() << "If you override CanDrop, you need to override this too"; + return ui::DragDropTypes::DRAG_NONE; +} + +bool MenuDelegate::CanDrag(MenuItemView* menu) { + return false; +} + +void MenuDelegate::WriteDragData(MenuItemView* sender, OSExchangeData* data) { + NOTREACHED() << "If you override CanDrag, you must override this too."; +} + +int MenuDelegate::GetDragOperations(MenuItemView* sender) { + NOTREACHED() << "If you override CanDrag, you must override this too."; + return 0; +} + +MenuItemView* MenuDelegate::GetSiblingMenu(MenuItemView* menu, + const gfx::Point& screen_point, + MenuItemView::AnchorPosition* anchor, + bool* has_mnemonics, + MenuButton** button) { + return NULL; +} + +int MenuDelegate::GetMaxWidthForMenu() { + // NOTE: this needs to be large enough to accommodate the wrench menu with + // big fonts. + return 800; +} + +} // namespace views diff --git a/views/controls/menu/menu_delegate.h b/views/controls/menu/menu_delegate.h index f30d095..6a5cc5b 100644 --- a/views/controls/menu/menu_delegate.h +++ b/views/controls/menu/menu_delegate.h @@ -47,27 +47,19 @@ class MenuDelegate { // Whether or not an item should be shown as checked. This is invoked for // radio buttons and check buttons. - virtual bool IsItemChecked(int id) const { - return false; - } + virtual bool IsItemChecked(int id) const; // The string shown for the menu item. This is only invoked when an item is // added with an empty label. - virtual std::wstring GetLabel(int id) const { - return std::wstring(); - } + virtual std::wstring GetLabel(int id) const; // The tooltip shown for the menu item. This is invoked when the user // hovers over the item, and no tooltip text has been set for that item. - virtual std::wstring GetTooltipText(int id, const gfx::Point& screen_loc) { - return std::wstring(); - } + virtual std::wstring GetTooltipText(int id, const gfx::Point& screen_loc); // If there is an accelerator for the menu item with id |id| it is set in // |accelerator| and true is returned. - virtual bool GetAccelerator(int id, Accelerator* accelerator) { - return false; - } + virtual bool GetAccelerator(int id, Accelerator* accelerator); // Shows the context menu with the specified id. This is invoked when the // user does the appropriate gesture to show a context menu. The id @@ -80,20 +72,12 @@ class MenuDelegate { virtual bool ShowContextMenu(MenuItemView* source, int id, const gfx::Point& p, - bool is_mouse_gesture) { - return false; - } + bool is_mouse_gesture); // Controller - virtual bool SupportsCommand(int id) const { - return true; - } - virtual bool IsCommandEnabled(int id) const { - return true; - } - virtual bool GetContextualLabel(int id, std::wstring* out) const { - return false; - } + virtual bool SupportsCommand(int id) const; + virtual bool IsCommandEnabled(int id) const; + virtual bool GetContextualLabel(int id, std::wstring* out) const; virtual void ExecuteCommand(int id) { } @@ -102,23 +86,17 @@ class MenuDelegate { // the user selects the menu with the command |id|. This returns true to // indicate that all menus should be closed. Return false if only the // context menu should be closed. - virtual bool ShouldCloseAllMenusOnExecute(int id) { - return true; - } + virtual bool ShouldCloseAllMenusOnExecute(int id); // Executes the specified command. mouse_event_flags give the flags of the // mouse event that triggered this to be invoked (views::MouseEvent // flags). mouse_event_flags is 0 if this is triggered by a user gesture // other than a mouse event. - virtual void ExecuteCommand(int id, int mouse_event_flags) { - ExecuteCommand(id); - } + virtual void ExecuteCommand(int id, int mouse_event_flags); // Returns true if the specified mouse event is one the user can use // to trigger, or accept, the mouse. Defaults to left or right mouse buttons. - virtual bool IsTriggerableEvent(const MouseEvent& e) { - return e.IsLeftMouseButton() || e.IsRightMouseButton(); - } + virtual bool IsTriggerableEvent(const MouseEvent& e); // Invoked to determine if drops can be accepted for a submenu. This is // ONLY invoked for menus that have submenus and indicates whether or not @@ -134,22 +112,16 @@ class MenuDelegate { // // To restrict which children can be dropped on override GetDropOperation. - virtual bool CanDrop(MenuItemView* menu, const OSExchangeData& data) { - return false; - } + virtual bool CanDrop(MenuItemView* menu, const OSExchangeData& data); // See view for a description of this method. virtual bool GetDropFormats( MenuItemView* menu, int* formats, - std::set<OSExchangeData::CustomFormat>* custom_formats) { - return false; - } + std::set<OSExchangeData::CustomFormat>* custom_formats); // See view for a description of this method. - virtual bool AreDropTypesRequired(MenuItemView* menu) { - return false; - } + virtual bool AreDropTypesRequired(MenuItemView* menu); // Returns the drop operation for the specified target menu item. This is // only invoked if CanDrop returned true for the parent menu. position @@ -159,10 +131,7 @@ class MenuDelegate { // If a drop should not be allowed, returned ui::DragDropTypes::DRAG_NONE. virtual int GetDropOperation(MenuItemView* item, const DropTargetEvent& event, - DropPosition* position) { - NOTREACHED() << "If you override CanDrop, you need to override this too"; - return ui::DragDropTypes::DRAG_NONE; - } + DropPosition* position); // Invoked to perform the drop operation. This is ONLY invoked if // canDrop returned true for the parent menu item, and GetDropOperation @@ -171,29 +140,19 @@ class MenuDelegate { // menu indicates the menu the drop occurred on. virtual int OnPerformDrop(MenuItemView* menu, DropPosition position, - const DropTargetEvent& event) { - NOTREACHED() << "If you override CanDrop, you need to override this too"; - return ui::DragDropTypes::DRAG_NONE; - } + const DropTargetEvent& event); // Invoked to determine if it is possible for the user to drag the specified // menu item. - virtual bool CanDrag(MenuItemView* menu) { - return false; - } + virtual bool CanDrag(MenuItemView* menu); // Invoked to write the data for a drag operation to data. sender is the // MenuItemView being dragged. - virtual void WriteDragData(MenuItemView* sender, OSExchangeData* data) { - NOTREACHED() << "If you override CanDrag, you must override this too."; - } + virtual void WriteDragData(MenuItemView* sender, OSExchangeData* data); // Invoked to determine the drag operations for a drag session of sender. // See DragDropTypes for possible values. - virtual int GetDragOperations(MenuItemView* sender) { - NOTREACHED() << "If you override CanDrag, you must override this too."; - return 0; - } + virtual int GetDragOperations(MenuItemView* sender); // Notification the menu has closed. This is only sent when running the // menu for a drop. @@ -213,16 +172,10 @@ class MenuDelegate { const gfx::Point& screen_point, MenuItemView::AnchorPosition* anchor, bool* has_mnemonics, - MenuButton** button) { - return NULL; - } + MenuButton** button); // Returns the max width menus can grow to be. - virtual int GetMaxWidthForMenu() { - // NOTE: this needs to be large enough to accommodate the wrench menu with - // big fonts. - return 800; - } + virtual int GetMaxWidthForMenu(); }; } // namespace views diff --git a/views/controls/menu/menu_host_gtk.h b/views/controls/menu/menu_host_gtk.h index 9f2f007..2d4884f 100644 --- a/views/controls/menu/menu_host_gtk.h +++ b/views/controls/menu/menu_host_gtk.h @@ -21,10 +21,10 @@ class MenuHostGtk : public WidgetGtk, public MenuHost { virtual ~MenuHostGtk(); // MenuHost overrides. - void InitMenuHost(gfx::NativeWindow parent, - const gfx::Rect& bounds, - View* contents_view, - bool do_capture); + virtual void InitMenuHost(gfx::NativeWindow parent, + const gfx::Rect& bounds, + View* contents_view, + bool do_capture); virtual bool IsMenuHostVisible(); virtual void ShowMenuHost(bool do_capture); virtual void HideMenuHost(); diff --git a/views/controls/menu/menu_item_view.cc b/views/controls/menu/menu_item_view.cc index ed44c3a..60bc7cd 100644 --- a/views/controls/menu/menu_item_view.cc +++ b/views/controls/menu/menu_item_view.cc @@ -318,6 +318,14 @@ SubmenuView* MenuItemView::CreateSubmenu() { return submenu_; } +bool MenuItemView::HasSubmenu() const { + return (submenu_ != NULL); +} + +SubmenuView* MenuItemView::GetSubmenu() const { + return submenu_; +} + void MenuItemView::SetTitle(const std::wstring& title) { title_ = WideToUTF16Hack(title); SetAccessibleName(GetAccessibleNameForMenuItem(title_, GetAcceleratorText())); diff --git a/views/controls/menu/menu_item_view.h b/views/controls/menu/menu_item_view.h index 5b5e09c..c028346 100644 --- a/views/controls/menu/menu_item_view.h +++ b/views/controls/menu/menu_item_view.h @@ -199,10 +199,10 @@ class MenuItemView : public View { virtual SubmenuView* CreateSubmenu(); // Returns true if this menu item has a submenu. - virtual bool HasSubmenu() const { return (submenu_ != NULL); } + virtual bool HasSubmenu() const; // Returns the view containing child menu items. - virtual SubmenuView* GetSubmenu() const { return submenu_; } + virtual SubmenuView* GetSubmenu() const; // Returns the parent menu item. MenuItemView* GetParentMenuItem() const { return parent_menu_item_; } diff --git a/views/controls/menu/menu_separator.h b/views/controls/menu/menu_separator.h index 393b3b2..7260e16 100644 --- a/views/controls/menu/menu_separator.h +++ b/views/controls/menu/menu_separator.h @@ -16,8 +16,8 @@ class MenuSeparator : public View { MenuSeparator() {} // View overrides. - void OnPaint(gfx::Canvas* canvas); - gfx::Size GetPreferredSize(); + virtual void OnPaint(gfx::Canvas* canvas); + virtual gfx::Size GetPreferredSize(); private: DISALLOW_COPY_AND_ASSIGN(MenuSeparator); diff --git a/views/controls/menu/submenu_view.h b/views/controls/menu/submenu_view.h index cbe2674..792189f 100644 --- a/views/controls/menu/submenu_view.h +++ b/views/controls/menu/submenu_view.h @@ -61,7 +61,7 @@ class SubmenuView : public View { virtual AccessibilityTypes::Role GetAccessibleRole(); // Painting. - void PaintChildren(gfx::Canvas* canvas); + virtual void PaintChildren(gfx::Canvas* canvas); // Drag and drop methods. These are forwarded to the MenuController. virtual bool GetDropFormats( diff --git a/views/controls/message_box_view.cc b/views/controls/message_box_view.cc index 3df7b6b..d1a7864 100644 --- a/views/controls/message_box_view.cc +++ b/views/controls/message_box_view.cc @@ -46,6 +46,8 @@ MessageBoxView::MessageBoxView(int dialog_flags, Init(dialog_flags, default_prompt); } +MessageBoxView::~MessageBoxView() {} + std::wstring MessageBoxView::GetInputText() { if (prompt_field_) return UTF16ToWideHack(prompt_field_->text()); diff --git a/views/controls/message_box_view.h b/views/controls/message_box_view.h index 7d1b5b0..811ad29 100644 --- a/views/controls/message_box_view.h +++ b/views/controls/message_box_view.h @@ -32,6 +32,8 @@ class MessageBoxView : public views::View { const std::wstring& message, const std::wstring& default_prompt); + virtual ~MessageBoxView(); + // Returns the text box. views::Textfield* text_box() { return prompt_field_; } diff --git a/views/controls/throbber.cc b/views/controls/throbber.cc index 19d42d2..e750f0b 100644 --- a/views/controls/throbber.cc +++ b/views/controls/throbber.cc @@ -104,6 +104,8 @@ SmoothedThrobber::SmoothedThrobber(int frame_time_ms) stop_delay_ms_(kStopDelay) { } +SmoothedThrobber::~SmoothedThrobber() {} + void SmoothedThrobber::Start() { stop_timer_.Stop(); diff --git a/views/controls/throbber.h b/views/controls/throbber.h index 692482d..afc2537 100644 --- a/views/controls/throbber.h +++ b/views/controls/throbber.h @@ -63,6 +63,7 @@ class SmoothedThrobber : public Throbber { public: SmoothedThrobber(int frame_delay_ms); SmoothedThrobber(int frame_delay_ms, SkBitmap* frames); + virtual ~SmoothedThrobber(); virtual void Start(); virtual void Stop(); diff --git a/views/focus/focus_manager.cc b/views/focus/focus_manager.cc index ae3e760..8e130c9 100644 --- a/views/focus/focus_manager.cc +++ b/views/focus/focus_manager.cc @@ -63,6 +63,10 @@ void FocusManager::WidgetFocusManager::OnWidgetFocusEvent( } } +FocusManager::WidgetFocusManager::WidgetFocusManager() : enabled_(true) {} + +FocusManager::WidgetFocusManager::~WidgetFocusManager() {} + // static FocusManager::WidgetFocusManager* FocusManager::WidgetFocusManager::GetInstance() { diff --git a/views/focus/focus_manager.h b/views/focus/focus_manager.h index 46a867e..250adb3 100644 --- a/views/focus/focus_manager.h +++ b/views/focus/focus_manager.h @@ -150,7 +150,8 @@ class FocusManager { void DisableNotifications() { enabled_ = false; } private: - WidgetFocusManager() : enabled_(true) {} + WidgetFocusManager(); + ~WidgetFocusManager(); typedef std::vector<WidgetFocusChangeListener*> WidgetFocusChangeListenerList; diff --git a/views/view.cc b/views/view.cc index 5643e80..895c678 100644 --- a/views/view.cc +++ b/views/view.cc @@ -48,6 +48,15 @@ char View::kViewClassName[] = "views/View"; void View::SetHotTracked(bool flag) { } +bool View::IsHotTracked() const { + return false; +} + +// FATE TBD -------------------------------------------------------------------- + +Widget* View::child_widget() { + return NULL; +} // Creation and lifetime ------------------------------------------------------- @@ -340,6 +349,10 @@ void View::SetVisible(bool flag) { } } +bool View::IsVisible() const { + return is_visible_; +} + bool View::IsVisibleInRootView() const { return IsVisible() && parent() ? parent()->IsVisibleInRootView() : false; } @@ -544,6 +557,10 @@ int View::GetGroup() const { return group_; } +bool View::IsGroupFocusTraversable() const { + return true; +} + void View::GetViewsWithGroup(int group_id, std::vector<View*>* out) { if (group_ == group_id) out->push_back(this); @@ -861,6 +878,10 @@ void View::ResetAccelerators() { UnregisterAccelerators(false); } +bool View::AcceleratorPressed(const Accelerator& accelerator) { + return false; +} + // Focus ----------------------------------------------------------------------- bool View::HasFocus() { @@ -900,6 +921,10 @@ bool View::IsAccessibilityFocusableInRootView() const { IsVisibleInRootView(); } +void View::set_accessibility_focusable(bool accessibility_focusable) { + accessibility_focusable_ = accessibility_focusable; +} + FocusManager* View::GetFocusManager() { Widget* widget = GetWidget(); return widget ? widget->GetFocusManager() : NULL; @@ -911,6 +936,18 @@ void View::RequestFocus() { focus_manager->SetFocusedView(this); } +bool View::SkipDefaultKeyEventProcessing(const KeyEvent& e) { + return false; +} + +FocusTraversable* View::GetFocusTraversable() { + return NULL; +} + +FocusTraversable* View::GetPaneFocusTraversable() { + return NULL; +} + // Tooltips -------------------------------------------------------------------- bool View::GetTooltipText(const gfx::Point& p, std::wstring* tooltip) { @@ -988,6 +1025,14 @@ void View::NotifyAccessibilityEvent(AccessibilityTypes::Event event_type) { NotifyAccessibilityEvent(event_type, true); } +string16 View::GetAccessibleDefaultAction() { + return string16(); +} + +string16 View::GetAccessibleKeyboardShortcut() { + return string16(); +} + bool View::GetAccessibleName(string16* name) { DCHECK(name); @@ -1001,6 +1046,14 @@ AccessibilityTypes::Role View::GetAccessibleRole() { return AccessibilityTypes::ROLE_CLIENT; } +AccessibilityTypes::State View::GetAccessibleState() { + return 0; +} + +string16 View::GetAccessibleValue() { + return string16(); +} + void View::SetAccessibleName(const string16& name) { accessible_name_ = name; } diff --git a/views/view.h b/views/view.h index 695fffb..3e62f99 100644 --- a/views/view.h +++ b/views/view.h @@ -154,13 +154,13 @@ class View : public AcceleratorTarget { // TODO(beng): delete // Returns whether the view is hot-tracked. - virtual bool IsHotTracked() const { return false; } + virtual bool IsHotTracked() const; // FATE TBD ------------------------------------------------------------------ // TODO(beng): Figure out what these methods are for and delete them. // TODO(beng): this one isn't even google3-style. wth. - virtual Widget* child_widget() { return NULL; } + virtual Widget* child_widget(); // Creation and lifetime ----------------------------------------------------- @@ -309,7 +309,7 @@ class View : public AcceleratorTarget { virtual void SetVisible(bool flag); // Return whether a view is visible - virtual bool IsVisible() const { return is_visible_; } + virtual bool IsVisible() const; // Return whether a view and its ancestors are visible. Returns true if the // path from this view to the root view is visible. @@ -459,7 +459,7 @@ class View : public AcceleratorTarget { // when moving focus with the Tab/Shift-Tab key. If this returns false, // only the selected view from the group (obtained with // GetSelectedViewForGroup()) is focused. - virtual bool IsGroupFocusTraversable() const { return true; } + virtual bool IsGroupFocusTraversable() const; // Fills the provided vector with all the available views which belong to the // provided group. @@ -693,9 +693,7 @@ class View : public AcceleratorTarget { // Called when a keyboard accelerator is pressed. // Derived classes should implement desired behavior and return true if they // handled the accelerator. - virtual bool AcceleratorPressed(const Accelerator& accelerator) { - return false; - } + virtual bool AcceleratorPressed(const Accelerator& accelerator); // Focus --------------------------------------------------------------------- @@ -732,9 +730,7 @@ class View : public AcceleratorTarget { // Set whether this view can be made focusable if the user requires // full keyboard access, even though it's not normally focusable. // Note that this is false by default. - virtual void set_accessibility_focusable(bool accessibility_focusable) { - accessibility_focusable_ = accessibility_focusable; - } + virtual void set_accessibility_focusable(bool accessibility_focusable); // Convenience method to retrieve the FocusManager associated with the // Widget that contains this view. This can return NULL if this view is not @@ -759,21 +755,19 @@ class View : public AcceleratorTarget { // have it processed as an accelerator (if any) or as a tab traversal (if the // key event is for the TAB key). In that case, OnKeyPressed will // subsequently be invoked for that event. - virtual bool SkipDefaultKeyEventProcessing(const KeyEvent& e) { - return false; - } + virtual bool SkipDefaultKeyEventProcessing(const KeyEvent& e); // Subclasses that contain traversable children that are not directly // accessible through the children hierarchy should return the associated // FocusTraversable for the focus traversal to work properly. - virtual FocusTraversable* GetFocusTraversable() { return NULL; } + virtual FocusTraversable* GetFocusTraversable(); // Subclasses that can act as a "pane" must implement their own // FocusTraversable to keep the focus trapped within the pane. // If this method returns an object, any view that's a direct or // indirect child of this view will always use this FocusTraversable // rather than the one from the widget. - virtual FocusTraversable* GetPaneFocusTraversable() { return NULL; } + virtual FocusTraversable* GetPaneFocusTraversable(); // Tooltips ------------------------------------------------------------------ @@ -893,13 +887,11 @@ class View : public AcceleratorTarget { // describes the default action that will occur when executing // IAccessible::DoDefaultAction. For instance, default action of a button is // 'Press'. - virtual string16 GetAccessibleDefaultAction() { return string16(); } + virtual string16 GetAccessibleDefaultAction(); // Returns a string containing the mnemonic, or the keyboard shortcut, for a // given control. - virtual string16 GetAccessibleKeyboardShortcut() { - return string16(); - } + virtual string16 GetAccessibleKeyboardShortcut(); // Returns a brief, identifying string, containing a unique, readable name of // a given control. Sets the input string appropriately, and returns true if @@ -912,12 +904,10 @@ class View : public AcceleratorTarget { virtual AccessibilityTypes::Role GetAccessibleRole(); // Returns the accessibility state of the current view. - virtual AccessibilityTypes::State GetAccessibleState() { - return 0; - } + virtual AccessibilityTypes::State GetAccessibleState(); // Returns the current value associated with a view. - virtual string16 GetAccessibleValue() { return string16(); } + virtual string16 GetAccessibleValue(); // Assigns a string name to the given control. Needed as a View does not know // which name will be associated with it until it is created to be a diff --git a/views/views.gyp b/views/views.gyp index f8b145c..5e0d0cc 100644 --- a/views/views.gyp +++ b/views/views.gyp @@ -135,6 +135,7 @@ 'controls/menu/menu_config_win.cc', 'controls/menu/menu_controller.cc', 'controls/menu/menu_controller.h', + 'controls/menu/menu_delegate.cc', 'controls/menu/menu_delegate.h', 'controls/menu/menu_gtk.cc', 'controls/menu/menu_gtk.h', diff --git a/views/widget/default_theme_provider.cc b/views/widget/default_theme_provider.cc index 8a03bab..7d2dfec 100644 --- a/views/widget/default_theme_provider.cc +++ b/views/widget/default_theme_provider.cc @@ -12,10 +12,25 @@ namespace views { +DefaultThemeProvider::DefaultThemeProvider() {} + +DefaultThemeProvider::~DefaultThemeProvider() {} + +void DefaultThemeProvider::Init(Profile* profile) {} + SkBitmap* DefaultThemeProvider::GetBitmapNamed(int id) const { return ResourceBundle::GetSharedInstance().GetBitmapNamed(id); } +SkColor DefaultThemeProvider::GetColor(int id) const { + // Return debugging-blue. + return 0xff0000ff; +} + +bool DefaultThemeProvider::GetDisplayProperty(int id, int* result) const { + return false; +} + bool DefaultThemeProvider::ShouldUseNativeFrame() const { #if defined(OS_WIN) return WidgetWin::IsAeroGlassEnabled(); @@ -24,4 +39,12 @@ bool DefaultThemeProvider::ShouldUseNativeFrame() const { #endif } +bool DefaultThemeProvider::HasCustomImage(int id) const { + return false; +} + +RefCountedMemory* DefaultThemeProvider::GetRawData(int id) const { + return NULL; +} + } // namespace views diff --git a/views/widget/default_theme_provider.h b/views/widget/default_theme_provider.h index c407f7d..9d0ec52 100644 --- a/views/widget/default_theme_provider.h +++ b/views/widget/default_theme_provider.h @@ -22,20 +22,17 @@ namespace views { class DefaultThemeProvider : public ui::ThemeProvider { public: - DefaultThemeProvider() { }; - virtual ~DefaultThemeProvider() { }; + DefaultThemeProvider(); + virtual ~DefaultThemeProvider(); // Overridden from ui::ThemeProvider. - virtual void Init(Profile* profile) { } + virtual void Init(Profile* profile); virtual SkBitmap* GetBitmapNamed(int id) const; - virtual SkColor GetColor(int id) const { - // Return debugging-blue. - return 0xff0000ff; - } - virtual bool GetDisplayProperty(int id, int* result) const { return false; } + virtual SkColor GetColor(int id) const; + virtual bool GetDisplayProperty(int id, int* result) const; virtual bool ShouldUseNativeFrame() const; - virtual bool HasCustomImage(int id) const { return false; } - virtual RefCountedMemory* GetRawData(int id) const { return NULL; } + virtual bool HasCustomImage(int id) const; + virtual RefCountedMemory* GetRawData(int id) const; private: DISALLOW_COPY_AND_ASSIGN(DefaultThemeProvider); diff --git a/views/widget/widget_gtk.cc b/views/widget/widget_gtk.cc index de79e73..66be067 100644 --- a/views/widget/widget_gtk.cc +++ b/views/widget/widget_gtk.cc @@ -1224,6 +1224,10 @@ void WidgetGtk::OnShow(GtkWidget* widget) { void WidgetGtk::OnHide(GtkWidget* widget) { } +bool WidgetGtk::ReleaseCaptureOnMouseReleased() { + return true; +} + void WidgetGtk::DoGrab() { has_capture_ = true; gtk_grab_add(window_contents_); diff --git a/views/widget/widget_gtk.h b/views/widget/widget_gtk.h index 3a5bafa..f9b557d 100644 --- a/views/widget/widget_gtk.h +++ b/views/widget/widget_gtk.h @@ -265,7 +265,7 @@ class WidgetGtk : public Widget, // Returns whether capture should be released on mouse release. The default // is true. - virtual bool ReleaseCaptureOnMouseReleased() { return true; } + virtual bool ReleaseCaptureOnMouseReleased(); // Does a mouse grab on this widget. virtual void DoGrab(); diff --git a/views/window/client_view.cc b/views/window/client_view.cc index de198ed..9fb3e70 100644 --- a/views/window/client_view.cc +++ b/views/window/client_view.cc @@ -24,6 +24,14 @@ int ClientView::NonClientHitTest(const gfx::Point& point) { return bounds().Contains(point) ? HTCLIENT : HTNOWHERE; } +DialogClientView* ClientView::AsDialogClientView() { + return NULL; +} + +bool ClientView::CanClose() { + return true; +} + void ClientView::WindowClosing() { window_->GetDelegate()->WindowClosing(); } diff --git a/views/window/client_view.h b/views/window/client_view.h index 08ddcd4..405ec4e 100644 --- a/views/window/client_view.h +++ b/views/window/client_view.h @@ -31,13 +31,13 @@ class ClientView : public View { virtual ~ClientView() {} // Manual RTTI ftw. - virtual DialogClientView* AsDialogClientView() { return NULL; } + virtual DialogClientView* AsDialogClientView(); // Returns true to signal that the Window can be closed. Specialized // ClientView subclasses can override this default behavior to allow the // close to be blocked until the user corrects mistakes, accepts a warning // dialog, etc. - virtual bool CanClose() { return true; } + virtual bool CanClose(); // Notification that the window is closing. The default implementation // forwards the notification to the delegate. diff --git a/views/window/dialog_client_view.cc b/views/window/dialog_client_view.cc index 730972e..cdf684c 100644 --- a/views/window/dialog_client_view.cc +++ b/views/window/dialog_client_view.cc @@ -297,6 +297,10 @@ int DialogClientView::NonClientHitTest(const gfx::Point& point) { return ClientView::NonClientHitTest(point); } +DialogClientView* DialogClientView::AsDialogClientView() { + return this; +} + //////////////////////////////////////////////////////////////////////////////// // DialogClientView, View overrides: diff --git a/views/window/dialog_client_view.h b/views/window/dialog_client_view.h index d6d87a5..06a2d73 100644 --- a/views/window/dialog_client_view.h +++ b/views/window/dialog_client_view.h @@ -68,7 +68,7 @@ class DialogClientView : public ClientView, virtual bool CanClose(); virtual void WindowClosing(); virtual int NonClientHitTest(const gfx::Point& point); - virtual DialogClientView* AsDialogClientView() { return this; } + virtual DialogClientView* AsDialogClientView(); // FocusChangeListener implementation: virtual void FocusWillChange(View* focused_before, View* focused_now); diff --git a/views/window/dialog_delegate.cc b/views/window/dialog_delegate.cc index 4ae9a91..43bdce3 100644 --- a/views/window/dialog_delegate.cc +++ b/views/window/dialog_delegate.cc @@ -12,6 +12,34 @@ namespace views { // Overridden from WindowDelegate: +DialogDelegate* DialogDelegate::AsDialogDelegate() { return this; } + +int DialogDelegate::GetDialogButtons() const { + return ui::MessageBoxFlags::DIALOGBUTTON_OK | + ui::MessageBoxFlags::DIALOGBUTTON_CANCEL; +} + +bool DialogDelegate::AreAcceleratorsEnabled( + ui::MessageBoxFlags::DialogButton button) { + return true; +} + +std::wstring DialogDelegate::GetDialogButtonLabel( + ui::MessageBoxFlags::DialogButton button) const { + // empty string results in defaults for + // ui::MessageBoxFlags::DIALOGBUTTON_OK, + // ui::MessageBoxFlags::DIALOGBUTTON_CANCEL. + return L""; +} + +View* DialogDelegate::GetExtraView() { + return NULL; +} + +bool DialogDelegate::GetSizeExtraViewHeightToButtons() { + return false; +} + int DialogDelegate::GetDefaultDialogButton() const { if (GetDialogButtons() & MessageBoxFlags::DIALOGBUTTON_OK) return MessageBoxFlags::DIALOGBUTTON_OK; @@ -20,6 +48,28 @@ int DialogDelegate::GetDefaultDialogButton() const { return MessageBoxFlags::DIALOGBUTTON_NONE; } +bool DialogDelegate::IsDialogButtonEnabled( + ui::MessageBoxFlags::DialogButton button) const { + return true; +} + +bool DialogDelegate::IsDialogButtonVisible( + ui::MessageBoxFlags::DialogButton button) const { + return true; +} + +bool DialogDelegate::Cancel() { + return true; +} + +bool DialogDelegate::Accept(bool window_closiang) { + return Accept(); +} + +bool DialogDelegate::Accept() { + return true; +} + View* DialogDelegate::GetInitiallyFocusedView() { // Focus the default button if any. DialogClientView* dcv = GetDialogClientView(); @@ -51,4 +101,8 @@ DialogClientView* DialogDelegate::GetDialogClientView() const { return dialog_client_view; } +AccessibilityTypes::Role DialogDelegate::accessible_role() const { + return AccessibilityTypes::ROLE_DIALOG; +} + } // namespace views diff --git a/views/window/dialog_delegate.h b/views/window/dialog_delegate.h index ac6d4e9..1b8e8a4 100644 --- a/views/window/dialog_delegate.h +++ b/views/window/dialog_delegate.h @@ -29,7 +29,7 @@ class View; /////////////////////////////////////////////////////////////////////////////// class DialogDelegate : public WindowDelegate { public: - virtual DialogDelegate* AsDialogDelegate() { return this; } + virtual DialogDelegate* AsDialogDelegate(); // Returns a mask specifying which of the available DialogButtons are visible // for the dialog. Note: If an OK button is provided, you should provide a @@ -38,38 +38,28 @@ class DialogDelegate : public WindowDelegate { // you should reconsider, or beng says there will be stabbings. // // To use the extra button you need to override GetDialogButtons() - virtual int GetDialogButtons() const { - return ui::MessageBoxFlags::DIALOGBUTTON_OK | - ui::MessageBoxFlags::DIALOGBUTTON_CANCEL; - } + virtual int GetDialogButtons() const; // Returns whether accelerators are enabled on the button. This is invoked // when an accelerator is pressed, not at construction time. This // returns true. virtual bool AreAcceleratorsEnabled( - ui::MessageBoxFlags::DialogButton button) { - return true; - } + ui::MessageBoxFlags::DialogButton button); // Returns the label of the specified DialogButton. virtual std::wstring GetDialogButtonLabel( - ui::MessageBoxFlags::DialogButton button) const { - // empty string results in defaults for - // ui::MessageBoxFlags::DIALOGBUTTON_OK, - // ui::MessageBoxFlags::DIALOGBUTTON_CANCEL. - return L""; - } + ui::MessageBoxFlags::DialogButton button) const; // Override this function if with a view which will be shown in the same // row as the OK and CANCEL buttons but flush to the left and extending // up to the buttons. - virtual View* GetExtraView() { return NULL; } + virtual View* GetExtraView(); // Returns whether the height of the extra view should be at least as tall as // the buttons. The default (false) is to give the extra view it's preferred // height. By returning true the height becomes // max(extra_view preferred height, buttons preferred height). - virtual bool GetSizeExtraViewHeightToButtons() { return false; } + virtual bool GetSizeExtraViewHeightToButtons(); // Returns the default dialog button. This should not be a mask as only // one button should ever be the default button. Return @@ -81,22 +71,18 @@ class DialogDelegate : public WindowDelegate { // Returns whether the specified dialog button is enabled. virtual bool IsDialogButtonEnabled( - ui::MessageBoxFlags::DialogButton button) const { - return true; - } + ui::MessageBoxFlags::DialogButton button) const; // Returns whether the specified dialog button is visible. virtual bool IsDialogButtonVisible( - ui::MessageBoxFlags::DialogButton button) const { - return true; - } + ui::MessageBoxFlags::DialogButton button) const; // For Dialog boxes, if there is a "Cancel" button, this is called when the // user presses the "Cancel" button or the Close button on the window or // in the system menu, or presses the Esc key. This function should return // true if the window can be closed after it returns, or false if it must // remain open. - virtual bool Cancel() { return true; } + virtual bool Cancel(); // For Dialog boxes, this is called when the user presses the "OK" button, // or the Enter key. Can also be called on Esc key or close button @@ -106,8 +92,8 @@ class DialogDelegate : public WindowDelegate { // true, it means that this handler is being called because the window is // being closed (e.g. by Window::Close) and there is no Cancel handler, // so Accept is being called instead. - virtual bool Accept(bool window_closing) { return Accept(); } - virtual bool Accept() { return true; } + virtual bool Accept(bool window_closing); + virtual bool Accept(); // Overridden from WindowDelegate: virtual View* GetInitiallyFocusedView(); @@ -124,9 +110,7 @@ class DialogDelegate : public WindowDelegate { private: // Overridden from WindowDelegate: - AccessibilityTypes::Role accessible_role() const { - return AccessibilityTypes::ROLE_DIALOG; - } + virtual AccessibilityTypes::Role accessible_role() const; }; } // namespace views diff --git a/views/window/non_client_view.cc b/views/window/non_client_view.cc index 210bd10..e882105 100644 --- a/views/window/non_client_view.cc +++ b/views/window/non_client_view.cc @@ -181,6 +181,14 @@ AccessibilityTypes::Role NonClientView::GetAccessibleRole() { //////////////////////////////////////////////////////////////////////////////// // NonClientFrameView, View overrides: +bool NonClientFrameView::AlwaysUseCustomFrame() const { + return false; +} + +bool NonClientFrameView::AlwaysUseNativeFrame() const { + return false; +} + bool NonClientFrameView::HitTest(const gfx::Point& l) const { // For the default case, we assume the non-client frame view never overlaps // the client view. diff --git a/views/window/non_client_view.h b/views/window/non_client_view.h index db1daff..d45c30e 100644 --- a/views/window/non_client_view.h +++ b/views/window/non_client_view.h @@ -48,12 +48,12 @@ class NonClientFrameView : public View { // Returns true if this FrameView should always use the custom frame, // regardless of the system settings. An example is the Constrained Window, // which is a child window and must always provide its own frame. - virtual bool AlwaysUseCustomFrame() const { return false; } + virtual bool AlwaysUseCustomFrame() const; // Like AlwaysUseCustomFrame, returns true if this FrameView should always use // the native frame, regardless of theme settings. An example is popup/app // windows, which we do not ever want to show themed. - virtual bool AlwaysUseNativeFrame() const { return false; } + virtual bool AlwaysUseNativeFrame() const; virtual gfx::Rect GetWindowBoundsForClientBounds( const gfx::Rect& client_bounds) const = 0; diff --git a/views/window/window.cc b/views/window/window.cc index ea6fcc1..07380f1 100644 --- a/views/window/window.cc +++ b/views/window/window.cc @@ -49,4 +49,8 @@ void Window::CloseSecondaryWidget(Widget* widget) { } } +bool Window::IsAppWindow() const { + return false; +} + } // namespace views diff --git a/views/window/window.h b/views/window/window.h index e5c1137..03e4f16 100644 --- a/views/window/window.h +++ b/views/window/window.h @@ -138,7 +138,7 @@ class Window { // Returns true if the Window is considered to be an "app window" - i.e. // any window which when it is the last of its type closed causes the // application to exit. - virtual bool IsAppWindow() const { return false; } + virtual bool IsAppWindow() const; // Toggles the enable state for the Close button (and the Close menu item in // the system menu). diff --git a/views/window/window_delegate.cc b/views/window/window_delegate.cc index 69bcc03..aa710ee 100644 --- a/views/window/window_delegate.cc +++ b/views/window/window_delegate.cc @@ -16,6 +16,50 @@ WindowDelegate::WindowDelegate() : window_(NULL) { WindowDelegate::~WindowDelegate() { } +DialogDelegate* WindowDelegate::AsDialogDelegate() { + return NULL; +} + +bool WindowDelegate::CanResize() const { + return false; +} + +bool WindowDelegate::CanMaximize() const { + return false; +} + +bool WindowDelegate::IsModal() const { + return false; +} + +AccessibilityTypes::Role WindowDelegate::accessible_role() const { + return AccessibilityTypes::ROLE_WINDOW; +} + +AccessibilityTypes::State WindowDelegate::accessible_state() const { + return 0; +} + +std::wstring WindowDelegate::GetAccessibleWindowTitle() const { + return GetWindowTitle(); +} + +std::wstring WindowDelegate::GetWindowTitle() const { + return L""; +} + +View* WindowDelegate::GetInitiallyFocusedView() { + return NULL; +} + +bool WindowDelegate::ShouldShowWindowTitle() const { + return true; +} + +bool WindowDelegate::ShouldShowClientEdge() const { + return true; +} + SkBitmap WindowDelegate::GetWindowAppIcon() { // Use the window icon as app icon by default. return GetWindowIcon(); @@ -26,6 +70,18 @@ SkBitmap WindowDelegate::GetWindowIcon() { return SkBitmap(); } +bool WindowDelegate::ShouldShowWindowIcon() const { + return false; +} + +bool WindowDelegate::ExecuteWindowsCommand(int command_id) { + return false; +} + +std::wstring WindowDelegate::GetWindowName() const { + return std::wstring(); +} + void WindowDelegate::SaveWindowPlacement(const gfx::Rect& bounds, bool maximized) { std::wstring window_name = GetWindowName(); @@ -58,6 +114,10 @@ bool WindowDelegate::ShouldRestoreWindowSize() const { return true; } +View* WindowDelegate::GetContentsView() { + return NULL; +} + ClientView* WindowDelegate::CreateClientView(Window* window) { return new ClientView(window, GetContentsView()); } diff --git a/views/window/window_delegate.h b/views/window/window_delegate.h index 04ac6b3..9b02387 100644 --- a/views/window/window_delegate.h +++ b/views/window/window_delegate.h @@ -38,55 +38,37 @@ class WindowDelegate { WindowDelegate(); virtual ~WindowDelegate(); - virtual DialogDelegate* AsDialogDelegate() { return NULL; } + virtual DialogDelegate* AsDialogDelegate(); // Returns true if the window can ever be resized. - virtual bool CanResize() const { - return false; - } + virtual bool CanResize() const; // Returns true if the window can ever be maximized. - virtual bool CanMaximize() const { - return false; - } + virtual bool CanMaximize() const; // Returns true if the dialog should be displayed modally to the window that // opened it. Only windows with WindowType == DIALOG can be modal. - virtual bool IsModal() const { - return false; - } + virtual bool IsModal() const; - virtual AccessibilityTypes::Role accessible_role() const { - return AccessibilityTypes::ROLE_WINDOW; - } + virtual AccessibilityTypes::Role accessible_role() const; - virtual AccessibilityTypes::State accessible_state() const { - return 0; - } + virtual AccessibilityTypes::State accessible_state() const; // Returns the title to be read with screen readers. - virtual std::wstring GetAccessibleWindowTitle() const { - return GetWindowTitle(); - } + virtual std::wstring GetAccessibleWindowTitle() const; // Returns the text to be displayed in the window title. - virtual std::wstring GetWindowTitle() const { - return L""; - } + virtual std::wstring GetWindowTitle() const; // Returns the view that should have the focus when the dialog is opened. If // NULL no view is focused. - virtual View* GetInitiallyFocusedView() { return NULL; } + virtual View* GetInitiallyFocusedView(); // Returns true if the window should show a title in the title bar. - virtual bool ShouldShowWindowTitle() const { - return true; - } + virtual bool ShouldShowWindowTitle() const; // Returns true if the window's client view wants a client edge. - virtual bool ShouldShowClientEdge() const { - return true; - } + virtual bool ShouldShowClientEdge() const; // Returns the app icon for the window. On Windows, this is the ICON_BIG used // in Alt-Tab list and Win7's taskbar. @@ -96,19 +78,15 @@ class WindowDelegate { virtual SkBitmap GetWindowIcon(); // Returns true if a window icon should be shown. - virtual bool ShouldShowWindowIcon() const { - return false; - } + virtual bool ShouldShowWindowIcon() const; // Execute a command in the window's controller. Returns true if the command // was handled, false if it was not. - virtual bool ExecuteWindowsCommand(int command_id) { return false; } + virtual bool ExecuteWindowsCommand(int command_id); // Returns the window's name identifier. Used to identify this window for // state restoration. - virtual std::wstring GetWindowName() const { - return std::wstring(); - } + virtual std::wstring GetWindowName() const; // Saves the window's bounds and maximized states. By default this uses the // process' local state keyed by window name (See GetWindowName above). This @@ -135,9 +113,7 @@ class WindowDelegate { virtual void DeleteDelegate() {} // Returns the View that is contained within this Window. - virtual View* GetContentsView() { - return NULL; - } + virtual View* GetContentsView(); // Called by the Window to create the Client View used to host the contents // of the window. diff --git a/views/window/window_gtk.cc b/views/window/window_gtk.cc index 6c0b7a6..345160e 100644 --- a/views/window/window_gtk.cc +++ b/views/window/window_gtk.cc @@ -269,6 +269,14 @@ void WindowGtk::FrameTypeChanged() { ThemeChanged(); } +Window* WindowGtk::AsWindow() { + return this; +} + +const Window* WindowGtk::AsWindow() const { + return this; +} + //////////////////////////////////////////////////////////////////////////////// // WindowGtk, WidgetGtk overrides: diff --git a/views/window/window_gtk.h b/views/window/window_gtk.h index 164a924..05edbcc 100644 --- a/views/window/window_gtk.h +++ b/views/window/window_gtk.h @@ -60,8 +60,8 @@ class WindowGtk : public WidgetGtk, public Window { virtual bool ShouldUseNativeFrame() const; virtual void FrameTypeChanged(); - virtual Window* AsWindow() { return this; } - virtual const Window* AsWindow() const { return this; } + virtual Window* AsWindow(); + virtual const Window* AsWindow() const; // Overridden from WidgetGtk: virtual gboolean OnButtonPress(GtkWidget* widget, GdkEventButton* event); |