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
This commit is contained in:
chrome
browser
ui
views
accessible_pane_view.ccaccessible_pane_view.h
autocomplete
bookmarks
clear_browsing_data.ccclear_browsing_data.hdownload_shelf_view.ccdownload_shelf_view.hextensions
frame
info_bubble.ccinfo_bubble.hjs_modal_dialog_views.ccjs_modal_dialog_views.hlocation_bar
content_setting_image_view.cccontent_setting_image_view.hlocation_bar_view.cclocation_bar_view.hstar_view.ccstar_view.h
options
page_info_bubble_view.ccpage_info_bubble_view.hsad_tab_view.ccsad_tab_view.htabs
base_tab.ccbase_tab.hbase_tab_strip.ccbase_tab_strip.htab.cctab.htab_renderer_data.cctab_renderer_data.htab_strip.h
theme_install_bubble_view.hui/views/focus
views
controls
label.cclabel.h
menu
menu_2.ccmenu_2.hmenu_config.ccmenu_config.hmenu_controller.ccmenu_controller.hmenu_delegate.ccmenu_delegate.hmenu_host_gtk.hmenu_item_view.ccmenu_item_view.hmenu_separator.hsubmenu_view.h
message_box_view.ccmessage_box_view.hthrobber.ccthrobber.hfocus
view.ccview.hviews.gypwidget
window
@@ -87,6 +87,10 @@ bool AccessiblePaneView::SetPaneFocusAndFocusDefault(
|
|||||||
return SetPaneFocus(view_storage_id, GetDefaultFocusableChild());
|
return SetPaneFocus(view_storage_id, GetDefaultFocusableChild());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
views::View* AccessiblePaneView::GetDefaultFocusableChild() {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
void AccessiblePaneView::RemovePaneFocus() {
|
void AccessiblePaneView::RemovePaneFocus() {
|
||||||
focus_manager_->RemoveFocusChangeListener(this);
|
focus_manager_->RemoveFocusChangeListener(this);
|
||||||
pane_has_focus_ = false;
|
pane_has_focus_ = false;
|
||||||
|
@@ -58,7 +58,7 @@ class AccessiblePaneView : public views::View,
|
|||||||
protected:
|
protected:
|
||||||
// A subclass can override this to provide a default focusable child
|
// A subclass can override this to provide a default focusable child
|
||||||
// other than the first focusable child.
|
// other than the first focusable child.
|
||||||
virtual views::View* GetDefaultFocusableChild() { return NULL; }
|
virtual views::View* GetDefaultFocusableChild();
|
||||||
|
|
||||||
// Remove pane focus.
|
// Remove pane focus.
|
||||||
virtual void RemovePaneFocus();
|
virtual void RemovePaneFocus();
|
||||||
|
@@ -34,6 +34,28 @@ const int kMinimumTextVerticalPadding = 3;
|
|||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
// AutocompleteResultView, public:
|
// AutocompleteResultView, public:
|
||||||
|
|
||||||
|
// Precalculated data used to draw the portion of a match classification that
|
||||||
|
// fits entirely within one run.
|
||||||
|
struct AutocompleteResultView::ClassificationData {
|
||||||
|
string16 text;
|
||||||
|
const gfx::Font* font;
|
||||||
|
SkColor color;
|
||||||
|
int pixel_width;
|
||||||
|
};
|
||||||
|
|
||||||
|
// Precalculated data used to draw a complete visual run within the match.
|
||||||
|
// This will include all or part of at leasdt one, and possibly several,
|
||||||
|
// classifications.
|
||||||
|
struct AutocompleteResultView::RunData {
|
||||||
|
size_t run_start; // Offset within the match text where this run begins.
|
||||||
|
int visual_order; // Where this run occurs in visual order. The earliest
|
||||||
|
// run drawn is run 0.
|
||||||
|
bool is_rtl;
|
||||||
|
int pixel_width;
|
||||||
|
Classifications classifications; // Classification pieces within this run,
|
||||||
|
// in logical order.
|
||||||
|
};
|
||||||
|
|
||||||
// This class is a utility class for calculations affected by whether the result
|
// This class is a utility class for calculations affected by whether the result
|
||||||
// view is horizontally mirrored. The drawing functions can be written as if
|
// view is horizontally mirrored. The drawing functions can be written as if
|
||||||
// all drawing occurs left-to-right, and then use this class to get the actual
|
// all drawing occurs left-to-right, and then use this class to get the actual
|
||||||
|
@@ -80,28 +80,10 @@ class AutocompleteResultView : public views::View {
|
|||||||
int text_vertical_padding_;
|
int text_vertical_padding_;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// Precalculated data used to draw the portion of a match classification that
|
struct ClassificationData;
|
||||||
// fits entirely within one run.
|
|
||||||
struct ClassificationData {
|
|
||||||
string16 text;
|
|
||||||
const gfx::Font* font;
|
|
||||||
SkColor color;
|
|
||||||
int pixel_width;
|
|
||||||
};
|
|
||||||
typedef std::vector<ClassificationData> Classifications;
|
typedef std::vector<ClassificationData> Classifications;
|
||||||
|
|
||||||
// Precalculated data used to draw a complete visual run within the match.
|
struct RunData;
|
||||||
// This will include all or part of at leasdt one, and possibly several,
|
|
||||||
// classifications.
|
|
||||||
struct RunData {
|
|
||||||
size_t run_start; // Offset within the match text where this run begins.
|
|
||||||
int visual_order; // Where this run occurs in visual order. The earliest
|
|
||||||
// run drawn is run 0.
|
|
||||||
bool is_rtl;
|
|
||||||
int pixel_width;
|
|
||||||
Classifications classifications; // Classification pieces within this run,
|
|
||||||
// in logical order.
|
|
||||||
};
|
|
||||||
typedef std::vector<RunData> Runs;
|
typedef std::vector<RunData> Runs;
|
||||||
|
|
||||||
// Predicate functions for use when sorting the runs.
|
// Predicate functions for use when sorting the runs.
|
||||||
|
@@ -716,6 +716,10 @@ double BookmarkBarView::GetAnimationValue() const {
|
|||||||
return size_animation_->GetCurrentValue();
|
return size_animation_->GetCurrentValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int BookmarkBarView::GetToolbarOverlap() const {
|
||||||
|
return GetToolbarOverlap(false);
|
||||||
|
}
|
||||||
|
|
||||||
bool BookmarkBarView::IsAlwaysShown() const {
|
bool BookmarkBarView::IsAlwaysShown() const {
|
||||||
return profile_->GetPrefs()->GetBoolean(prefs::kShowBookmarkBar);
|
return profile_->GetPrefs()->GetBoolean(prefs::kShowBookmarkBar);
|
||||||
}
|
}
|
||||||
|
@@ -114,9 +114,7 @@ class BookmarkBarView : public DetachableToolbarView,
|
|||||||
virtual bool IsDetached() const;
|
virtual bool IsDetached() const;
|
||||||
virtual bool IsOnTop() const;
|
virtual bool IsOnTop() const;
|
||||||
virtual double GetAnimationValue() const;
|
virtual double GetAnimationValue() const;
|
||||||
virtual int GetToolbarOverlap() const {
|
virtual int GetToolbarOverlap() const;
|
||||||
return GetToolbarOverlap(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
// View methods:
|
// View methods:
|
||||||
virtual gfx::Size GetPreferredSize();
|
virtual gfx::Size GetPreferredSize();
|
||||||
@@ -182,8 +180,8 @@ class BookmarkBarView : public DetachableToolbarView,
|
|||||||
bool is_animating();
|
bool is_animating();
|
||||||
|
|
||||||
// SlideAnimationDelegate implementation.
|
// SlideAnimationDelegate implementation.
|
||||||
void AnimationProgressed(const ui::Animation* animation);
|
virtual void AnimationProgressed(const ui::Animation* animation);
|
||||||
void AnimationEnded(const ui::Animation* animation);
|
virtual void AnimationEnded(const ui::Animation* animation);
|
||||||
|
|
||||||
// BookmarkMenuController::Observer
|
// BookmarkMenuController::Observer
|
||||||
virtual void BookmarkMenuDeleted(BookmarkMenuController* controller);
|
virtual void BookmarkMenuDeleted(BookmarkMenuController* controller);
|
||||||
|
@@ -333,6 +333,10 @@ bool BookmarkBubbleView::CloseOnEscape() {
|
|||||||
return delegate_ ? delegate_->CloseOnEscape() : true;
|
return delegate_ ? delegate_->CloseOnEscape() : true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool BookmarkBubbleView::FadeInOnShow() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
std::wstring BookmarkBubbleView::accessible_name() {
|
std::wstring BookmarkBubbleView::accessible_name() {
|
||||||
return UTF16ToWide(
|
return UTF16ToWide(
|
||||||
l10n_util::GetStringUTF16(IDS_BOOMARK_BUBBLE_ADD_BOOKMARK));
|
l10n_util::GetStringUTF16(IDS_BOOMARK_BUBBLE_ADD_BOOKMARK));
|
||||||
|
@@ -91,7 +91,7 @@ class BookmarkBubbleView : public views::View,
|
|||||||
virtual void InfoBubbleClosing(InfoBubble* info_bubble,
|
virtual void InfoBubbleClosing(InfoBubble* info_bubble,
|
||||||
bool closed_by_escape);
|
bool closed_by_escape);
|
||||||
virtual bool CloseOnEscape();
|
virtual bool CloseOnEscape();
|
||||||
virtual bool FadeInOnShow() { return false; }
|
virtual bool FadeInOnShow();
|
||||||
virtual std::wstring accessible_name();
|
virtual std::wstring accessible_name();
|
||||||
|
|
||||||
// Closes the bubble.
|
// Closes the bubble.
|
||||||
|
@@ -358,6 +358,14 @@ views::ClientView* ClearBrowsingDataView::CreateClientView(
|
|||||||
return client_view;
|
return client_view;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
views::View* ClearBrowsingDataView::GetExtraView() {
|
||||||
|
return throbber_view_;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool ClearBrowsingDataView::GetSizeExtraViewHeightToButtons() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
// ClearBrowsingDataView, ComboboxModel implementation:
|
// ClearBrowsingDataView, ComboboxModel implementation:
|
||||||
|
|
||||||
|
@@ -64,9 +64,9 @@ class ClearBrowsingDataView : public views::View,
|
|||||||
virtual std::wstring GetWindowTitle() const;
|
virtual std::wstring GetWindowTitle() const;
|
||||||
virtual bool Accept();
|
virtual bool Accept();
|
||||||
virtual views::View* GetContentsView();
|
virtual views::View* GetContentsView();
|
||||||
views::ClientView* CreateClientView(views::Window* window);
|
virtual views::ClientView* CreateClientView(views::Window* window);
|
||||||
virtual views::View* GetExtraView() { return throbber_view_; }
|
virtual views::View* GetExtraView();
|
||||||
virtual bool GetSizeExtraViewHeightToButtons() { return true; }
|
virtual bool GetSizeExtraViewHeightToButtons();
|
||||||
virtual views::View* GetInitiallyFocusedView();
|
virtual views::View* GetInitiallyFocusedView();
|
||||||
|
|
||||||
// Overridden from ui::ComboboxModel:
|
// Overridden from ui::ComboboxModel:
|
||||||
|
@@ -385,6 +385,10 @@ void DownloadShelfView::Close() {
|
|||||||
shelf_animation_->Hide();
|
shelf_animation_->Hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Browser* DownloadShelfView::browser() const {
|
||||||
|
return browser_;
|
||||||
|
}
|
||||||
|
|
||||||
void DownloadShelfView::Closed() {
|
void DownloadShelfView::Closed() {
|
||||||
// When the close animation is complete, remove all completed downloads.
|
// When the close animation is complete, remove all completed downloads.
|
||||||
size_t i = 0;
|
size_t i = 0;
|
||||||
|
@@ -70,7 +70,7 @@ class DownloadShelfView : public AccessiblePaneView,
|
|||||||
virtual bool IsClosing() const;
|
virtual bool IsClosing() const;
|
||||||
virtual void Show();
|
virtual void Show();
|
||||||
virtual void Close();
|
virtual void Close();
|
||||||
virtual Browser* browser() const { return browser_; }
|
virtual Browser* browser() const;
|
||||||
|
|
||||||
// Implementation of MouseWatcherDelegate.
|
// Implementation of MouseWatcherDelegate.
|
||||||
virtual void MouseMovedOutOfView();
|
virtual void MouseMovedOutOfView();
|
||||||
@@ -96,7 +96,7 @@ class DownloadShelfView : public AccessiblePaneView,
|
|||||||
void AddDownloadView(DownloadItemView* view);
|
void AddDownloadView(DownloadItemView* view);
|
||||||
|
|
||||||
// Paints the border.
|
// Paints the border.
|
||||||
void OnPaintBorder(gfx::Canvas* canvas);
|
virtual void OnPaintBorder(gfx::Canvas* canvas);
|
||||||
|
|
||||||
// Returns true if the shelf is wide enough to show the first download item.
|
// Returns true if the shelf is wide enough to show the first download item.
|
||||||
bool CanFitFirstDownloadItem();
|
bool CanFitFirstDownloadItem();
|
||||||
|
@@ -270,6 +270,8 @@ ExtensionInstalledBubble::ExtensionInstalledBubble(const Extension* extension,
|
|||||||
Source<Profile>(browser->profile()));
|
Source<Profile>(browser->profile()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ExtensionInstalledBubble::~ExtensionInstalledBubble() {}
|
||||||
|
|
||||||
void ExtensionInstalledBubble::Observe(NotificationType type,
|
void ExtensionInstalledBubble::Observe(NotificationType type,
|
||||||
const NotificationSource& source,
|
const NotificationSource& source,
|
||||||
const NotificationDetails& details) {
|
const NotificationDetails& details) {
|
||||||
@@ -370,3 +372,11 @@ void ExtensionInstalledBubble::InfoBubbleClosing(InfoBubble* info_bubble,
|
|||||||
|
|
||||||
Release(); // Balanced in ctor.
|
Release(); // Balanced in ctor.
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool ExtensionInstalledBubble::CloseOnEscape() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool ExtensionInstalledBubble::FadeInOnShow() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
@@ -54,7 +54,7 @@ class ExtensionInstalledBubble
|
|||||||
ExtensionInstalledBubble(const Extension* extension, Browser *browser,
|
ExtensionInstalledBubble(const Extension* extension, Browser *browser,
|
||||||
SkBitmap icon);
|
SkBitmap icon);
|
||||||
|
|
||||||
~ExtensionInstalledBubble() {}
|
virtual ~ExtensionInstalledBubble();
|
||||||
|
|
||||||
// Shows the bubble. Called internally via PostTask.
|
// Shows the bubble. Called internally via PostTask.
|
||||||
void ShowInternal();
|
void ShowInternal();
|
||||||
@@ -67,8 +67,8 @@ class ExtensionInstalledBubble
|
|||||||
// InfoBubbleDelegate
|
// InfoBubbleDelegate
|
||||||
virtual void InfoBubbleClosing(InfoBubble* info_bubble,
|
virtual void InfoBubbleClosing(InfoBubble* info_bubble,
|
||||||
bool closed_by_escape);
|
bool closed_by_escape);
|
||||||
virtual bool CloseOnEscape() { return true; }
|
virtual bool CloseOnEscape();
|
||||||
virtual bool FadeInOnShow() { return true; }
|
virtual bool FadeInOnShow();
|
||||||
|
|
||||||
const Extension* extension_;
|
const Extension* extension_;
|
||||||
Browser* browser_;
|
Browser* browser_;
|
||||||
|
@@ -7,6 +7,10 @@
|
|||||||
#include "base/logging.h"
|
#include "base/logging.h"
|
||||||
#include "chrome/browser/ui/views/browser_bubble.h"
|
#include "chrome/browser/ui/views/browser_bubble.h"
|
||||||
|
|
||||||
|
BrowserBubbleHost::BrowserBubbleHost() {}
|
||||||
|
|
||||||
|
BrowserBubbleHost::~BrowserBubbleHost() {}
|
||||||
|
|
||||||
void BrowserBubbleHost::WindowMoved() {
|
void BrowserBubbleHost::WindowMoved() {
|
||||||
// Do safe iteration in case the bubble winds up closing as a result of this
|
// Do safe iteration in case the bubble winds up closing as a result of this
|
||||||
// message.
|
// message.
|
||||||
|
@@ -17,7 +17,8 @@ class BrowserBubble;
|
|||||||
// close events.
|
// close events.
|
||||||
class BrowserBubbleHost {
|
class BrowserBubbleHost {
|
||||||
public:
|
public:
|
||||||
BrowserBubbleHost() {}
|
BrowserBubbleHost();
|
||||||
|
~BrowserBubbleHost();
|
||||||
|
|
||||||
// Invoked when the window containing the attached browser-bubbles is moved.
|
// Invoked when the window containing the attached browser-bubbles is moved.
|
||||||
// Calls BrowserBubble::BrowserWindowMoved on all attached bubbles.
|
// Calls BrowserBubble::BrowserWindowMoved on all attached bubbles.
|
||||||
|
@@ -171,7 +171,7 @@ class BrowserView : public BrowserBubbleHost,
|
|||||||
bool ShouldShowOffTheRecordAvatar() const;
|
bool ShouldShowOffTheRecordAvatar() const;
|
||||||
|
|
||||||
// Handle the specified |accelerator| being pressed.
|
// Handle the specified |accelerator| being pressed.
|
||||||
bool AcceleratorPressed(const views::Accelerator& accelerator);
|
virtual bool AcceleratorPressed(const views::Accelerator& accelerator);
|
||||||
|
|
||||||
// Provides the containing frame with the accelerator for the specified
|
// Provides the containing frame with the accelerator for the specified
|
||||||
// command id. This can be used to provide menu item shortcut hints etc.
|
// command id. This can be used to provide menu item shortcut hints etc.
|
||||||
@@ -228,7 +228,7 @@ class BrowserView : public BrowserBubbleHost,
|
|||||||
bool IsPositionInWindowCaption(const gfx::Point& point);
|
bool IsPositionInWindowCaption(const gfx::Point& point);
|
||||||
|
|
||||||
// Returns whether the fullscreen bubble is visible or not.
|
// Returns whether the fullscreen bubble is visible or not.
|
||||||
bool IsFullscreenBubbleVisible() const;
|
virtual bool IsFullscreenBubbleVisible() const;
|
||||||
|
|
||||||
// Invoked from the frame when the full screen state changes. This is only
|
// Invoked from the frame when the full screen state changes. This is only
|
||||||
// used on Linux.
|
// used on Linux.
|
||||||
|
@@ -239,6 +239,12 @@ LRESULT BorderWidget::OnMouseActivate(HWND window,
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// InfoBubbleDelegate ---------------------------------------------------------
|
||||||
|
|
||||||
|
std::wstring InfoBubbleDelegate::accessible_name() {
|
||||||
|
return L"";
|
||||||
|
}
|
||||||
|
|
||||||
// InfoBubble -----------------------------------------------------------------
|
// InfoBubble -----------------------------------------------------------------
|
||||||
|
|
||||||
// static
|
// static
|
||||||
|
@@ -171,7 +171,7 @@ class InfoBubbleDelegate {
|
|||||||
virtual bool FadeInOnShow() = 0;
|
virtual bool FadeInOnShow() = 0;
|
||||||
|
|
||||||
// The name of the window to which this delegate belongs.
|
// The name of the window to which this delegate belongs.
|
||||||
virtual std::wstring accessible_name() { return L""; }
|
virtual std::wstring accessible_name();
|
||||||
};
|
};
|
||||||
|
|
||||||
// TODO(sky): this code is ifdef-tastic. It might be cleaner to refactor the
|
// TODO(sky): this code is ifdef-tastic. It might be cleaner to refactor the
|
||||||
|
@@ -133,6 +133,10 @@ std::wstring JSModalDialogViews::GetDialogButtonLabel(
|
|||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
// JSModalDialogViews, views::WindowDelegate implementation:
|
// JSModalDialogViews, views::WindowDelegate implementation:
|
||||||
|
|
||||||
|
bool JSModalDialogViews::IsModal() const {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
views::View* JSModalDialogViews::GetContentsView() {
|
views::View* JSModalDialogViews::GetContentsView() {
|
||||||
return message_box_view_;
|
return message_box_view_;
|
||||||
}
|
}
|
||||||
|
@@ -42,7 +42,7 @@ class JSModalDialogViews : public NativeAppModalDialog,
|
|||||||
ui::MessageBoxFlags::DialogButton button) const;
|
ui::MessageBoxFlags::DialogButton button) const;
|
||||||
|
|
||||||
// Overridden from views::WindowDelegate:
|
// Overridden from views::WindowDelegate:
|
||||||
virtual bool IsModal() const { return true; }
|
virtual bool IsModal() const;
|
||||||
virtual views::View* GetContentsView();
|
virtual views::View* GetContentsView();
|
||||||
virtual views::View* GetInitiallyFocusedView();
|
virtual views::View* GetInitiallyFocusedView();
|
||||||
virtual void OnClose();
|
virtual void OnClose();
|
||||||
|
@@ -227,6 +227,10 @@ bool ContentSettingImageView::CloseOnEscape() {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool ContentSettingImageView::FadeInOnShow() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
void ContentSettingImageView::AnimateToState(double state) {
|
void ContentSettingImageView::AnimateToState(double state) {
|
||||||
if (state >= 1.0) {
|
if (state >= 1.0) {
|
||||||
// Animaton is over, clear the variables.
|
// Animaton is over, clear the variables.
|
||||||
|
@@ -52,7 +52,7 @@ class ContentSettingImageView : public views::ImageView,
|
|||||||
virtual void InfoBubbleClosing(InfoBubble* info_bubble,
|
virtual void InfoBubbleClosing(InfoBubble* info_bubble,
|
||||||
bool closed_by_escape);
|
bool closed_by_escape);
|
||||||
virtual bool CloseOnEscape();
|
virtual bool CloseOnEscape();
|
||||||
virtual bool FadeInOnShow() { return false; }
|
virtual bool FadeInOnShow();
|
||||||
|
|
||||||
// ui::LinearAnimation override:
|
// ui::LinearAnimation override:
|
||||||
virtual void AnimateToState(double state);
|
virtual void AnimateToState(double state);
|
||||||
|
@@ -1149,6 +1149,22 @@ void LocationBarView::Revert() {
|
|||||||
location_entry_->RevertAll();
|
location_entry_->RevertAll();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const AutocompleteEditView* LocationBarView::location_entry() const {
|
||||||
|
return location_entry_.get();
|
||||||
|
}
|
||||||
|
|
||||||
|
AutocompleteEditView* LocationBarView::location_entry() {
|
||||||
|
return location_entry_.get();
|
||||||
|
}
|
||||||
|
|
||||||
|
LocationBarTesting* LocationBarView::GetLocationBarForTesting() {
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
int LocationBarView::PageActionCount() {
|
||||||
|
return page_action_views_.size();
|
||||||
|
}
|
||||||
|
|
||||||
int LocationBarView::PageActionVisibleCount() {
|
int LocationBarView::PageActionVisibleCount() {
|
||||||
int result = 0;
|
int result = 0;
|
||||||
for (size_t i = 0; i < page_action_views_.size(); i++) {
|
for (size_t i = 0; i < page_action_views_.size(); i++) {
|
||||||
|
@@ -235,18 +235,12 @@ class LocationBarView : public LocationBar,
|
|||||||
virtual void InvalidatePageActions() OVERRIDE;
|
virtual void InvalidatePageActions() OVERRIDE;
|
||||||
virtual void SaveStateToContents(TabContents* contents) OVERRIDE;
|
virtual void SaveStateToContents(TabContents* contents) OVERRIDE;
|
||||||
virtual void Revert() OVERRIDE;
|
virtual void Revert() OVERRIDE;
|
||||||
virtual const AutocompleteEditView* location_entry() const OVERRIDE {
|
virtual const AutocompleteEditView* location_entry() const OVERRIDE;
|
||||||
return location_entry_.get();
|
virtual AutocompleteEditView* location_entry() OVERRIDE;
|
||||||
}
|
virtual LocationBarTesting* GetLocationBarForTesting() OVERRIDE;
|
||||||
virtual AutocompleteEditView* location_entry() OVERRIDE {
|
|
||||||
return location_entry_.get();
|
|
||||||
}
|
|
||||||
virtual LocationBarTesting* GetLocationBarForTesting() OVERRIDE {
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Overridden from LocationBarTesting:
|
// Overridden from LocationBarTesting:
|
||||||
virtual int PageActionCount() OVERRIDE { return page_action_views_.size(); }
|
virtual int PageActionCount() OVERRIDE;
|
||||||
virtual int PageActionVisibleCount() OVERRIDE;
|
virtual int PageActionVisibleCount() OVERRIDE;
|
||||||
virtual ExtensionAction* GetPageAction(size_t index) OVERRIDE;
|
virtual ExtensionAction* GetPageAction(size_t index) OVERRIDE;
|
||||||
virtual ExtensionAction* GetVisiblePageAction(size_t index) OVERRIDE;
|
virtual ExtensionAction* GetVisiblePageAction(size_t index) OVERRIDE;
|
||||||
|
@@ -73,3 +73,7 @@ void StarView::InfoBubbleClosing(InfoBubble* info_bubble,
|
|||||||
bool StarView::CloseOnEscape() {
|
bool StarView::CloseOnEscape() {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool StarView::FadeInOnShow() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
@@ -37,7 +37,7 @@ class StarView : public views::ImageView, public InfoBubbleDelegate {
|
|||||||
virtual void InfoBubbleClosing(InfoBubble* info_bubble,
|
virtual void InfoBubbleClosing(InfoBubble* info_bubble,
|
||||||
bool closed_by_escape);
|
bool closed_by_escape);
|
||||||
virtual bool CloseOnEscape();
|
virtual bool CloseOnEscape();
|
||||||
virtual bool FadeInOnShow() { return false; }
|
virtual bool FadeInOnShow();
|
||||||
|
|
||||||
// The CommandUpdater for the Browser object that owns the location bar.
|
// The CommandUpdater for the Browser object that owns the location bar.
|
||||||
CommandUpdater* command_updater_;
|
CommandUpdater* command_updater_;
|
||||||
|
@@ -21,6 +21,10 @@ OptionsPageView::~OptionsPageView() {
|
|||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
// OptionsPageView, views::View overrides:
|
// OptionsPageView, views::View overrides:
|
||||||
|
|
||||||
|
bool OptionsPageView::CanClose() const {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
void OptionsPageView::ViewHierarchyChanged(bool is_add,
|
void OptionsPageView::ViewHierarchyChanged(bool is_add,
|
||||||
views::View* parent,
|
views::View* parent,
|
||||||
views::View* child) {
|
views::View* child) {
|
||||||
|
@@ -26,7 +26,7 @@ class OptionsPageView : public views::View,
|
|||||||
// Returns true if the window containing this view can be closed, given the
|
// Returns true if the window containing this view can be closed, given the
|
||||||
// current state of this view. This can be used to prevent the window from
|
// current state of this view. This can be used to prevent the window from
|
||||||
// being closed when a modal dialog box is showing, for example.
|
// being closed when a modal dialog box is showing, for example.
|
||||||
virtual bool CanClose() const { return true; }
|
virtual bool CanClose() const;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
// This class cannot be instantiated directly, but its constructor must be
|
// This class cannot be instantiated directly, but its constructor must be
|
||||||
|
@@ -207,6 +207,18 @@ void PageInfoBubbleView::ModelChanged() {
|
|||||||
resize_animation_.Show();
|
resize_animation_.Show();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool PageInfoBubbleView::CloseOnEscape() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool PageInfoBubbleView::FadeInOnShow() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::wstring PageInfoBubbleView::accessible_name() {
|
||||||
|
return L"PageInfoBubble";
|
||||||
|
}
|
||||||
|
|
||||||
void PageInfoBubbleView::LinkActivated(views::Link* source, int event_flags) {
|
void PageInfoBubbleView::LinkActivated(views::Link* source, int event_flags) {
|
||||||
// We want to make sure the info bubble closes once the link is activated. So
|
// We want to make sure the info bubble closes once the link is activated. So
|
||||||
// we close it explicitly rather than relying on a side-effect of opening a
|
// we close it explicitly rather than relying on a side-effect of opening a
|
||||||
|
@@ -44,9 +44,9 @@ class PageInfoBubbleView : public views::View,
|
|||||||
// InfoBubbleDelegate methods:
|
// InfoBubbleDelegate methods:
|
||||||
virtual void InfoBubbleClosing(InfoBubble* info_bubble,
|
virtual void InfoBubbleClosing(InfoBubble* info_bubble,
|
||||||
bool closed_by_escape) {}
|
bool closed_by_escape) {}
|
||||||
virtual bool CloseOnEscape() { return true; }
|
virtual bool CloseOnEscape();
|
||||||
virtual bool FadeInOnShow() { return false; }
|
virtual bool FadeInOnShow();
|
||||||
virtual std::wstring accessible_name() { return L"PageInfoBubble"; }
|
virtual std::wstring accessible_name();
|
||||||
|
|
||||||
// LinkController methods:
|
// LinkController methods:
|
||||||
virtual void LinkActivated(views::Link* source, int event_flags);
|
virtual void LinkActivated(views::Link* source, int event_flags);
|
||||||
|
@@ -70,6 +70,8 @@ SadTabView::SadTabView(TabContents* tab_contents, Kind kind)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SadTabView::~SadTabView() {}
|
||||||
|
|
||||||
void SadTabView::OnPaint(gfx::Canvas* canvas) {
|
void SadTabView::OnPaint(gfx::Canvas* canvas) {
|
||||||
SkPaint paint;
|
SkPaint paint;
|
||||||
SkSafeUnref(paint.setShader(
|
SkSafeUnref(paint.setShader(
|
||||||
|
@@ -31,7 +31,7 @@ class SadTabView : public views::View,
|
|||||||
};
|
};
|
||||||
|
|
||||||
explicit SadTabView(TabContents* tab_contents, Kind kind);
|
explicit SadTabView(TabContents* tab_contents, Kind kind);
|
||||||
virtual ~SadTabView() {}
|
virtual ~SadTabView();
|
||||||
|
|
||||||
// Overridden from views::View:
|
// Overridden from views::View:
|
||||||
virtual void OnPaint(gfx::Canvas* canvas);
|
virtual void OnPaint(gfx::Canvas* canvas);
|
||||||
|
@@ -480,6 +480,18 @@ void BaseTab::ShowContextMenuForView(views::View* source,
|
|||||||
controller()->ShowContextMenuForTab(this, p);
|
controller()->ShowContextMenuForTab(this, p);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int BaseTab::loading_animation_frame() const {
|
||||||
|
return loading_animation_frame_;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool BaseTab::should_display_crashed_favicon() const {
|
||||||
|
return should_display_crashed_favicon_;
|
||||||
|
}
|
||||||
|
|
||||||
|
int BaseTab::fav_icon_hiding_offset() const {
|
||||||
|
return fav_icon_hiding_offset_;
|
||||||
|
}
|
||||||
|
|
||||||
void BaseTab::SetFavIconHidingOffset(int offset) {
|
void BaseTab::SetFavIconHidingOffset(int offset) {
|
||||||
fav_icon_hiding_offset_ = offset;
|
fav_icon_hiding_offset_ = offset;
|
||||||
ScheduleIconPaint();
|
ScheduleIconPaint();
|
||||||
|
@@ -136,13 +136,9 @@ class BaseTab : public ui::AnimationDelegate,
|
|||||||
virtual const gfx::Rect& GetTitleBounds() const = 0;
|
virtual const gfx::Rect& GetTitleBounds() const = 0;
|
||||||
virtual const gfx::Rect& GetIconBounds() const = 0;
|
virtual const gfx::Rect& GetIconBounds() const = 0;
|
||||||
|
|
||||||
virtual int loading_animation_frame() const {
|
virtual int loading_animation_frame() const;
|
||||||
return loading_animation_frame_;
|
virtual bool should_display_crashed_favicon() const;
|
||||||
}
|
virtual int fav_icon_hiding_offset() const;
|
||||||
virtual bool should_display_crashed_favicon() const {
|
|
||||||
return should_display_crashed_favicon_;
|
|
||||||
}
|
|
||||||
virtual int fav_icon_hiding_offset() const { return fav_icon_hiding_offset_; }
|
|
||||||
|
|
||||||
static gfx::Font* font() { return font_; }
|
static gfx::Font* font() { return font_; }
|
||||||
static int font_height() { return font_height_; }
|
static int font_height() { return font_height_; }
|
||||||
|
@@ -390,6 +390,10 @@ void BaseTabStrip::StartMiniTabAnimation() {
|
|||||||
AnimateToIdealBounds();
|
AnimateToIdealBounds();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool BaseTabStrip::ShouldHighlightCloseButtonAfterRemove() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
void BaseTabStrip::RemoveAndDeleteTab(BaseTab* tab) {
|
void BaseTabStrip::RemoveAndDeleteTab(BaseTab* tab) {
|
||||||
int tab_data_index = TabIndexOfTab(tab);
|
int tab_data_index = TabIndexOfTab(tab);
|
||||||
|
|
||||||
|
@@ -173,7 +173,7 @@ class BaseTabStrip : public views::View,
|
|||||||
virtual void StartMiniTabAnimation();
|
virtual void StartMiniTabAnimation();
|
||||||
|
|
||||||
// Returns whether the highlight button should be highlighted after a remove.
|
// Returns whether the highlight button should be highlighted after a remove.
|
||||||
virtual bool ShouldHighlightCloseButtonAfterRemove() { return true; }
|
virtual bool ShouldHighlightCloseButtonAfterRemove();
|
||||||
|
|
||||||
// Animates all the views to their ideal bounds.
|
// Animates all the views to their ideal bounds.
|
||||||
// NOTE: this does *not* invoke GenerateIdealBounds, it uses the bounds
|
// NOTE: this does *not* invoke GenerateIdealBounds, it uses the bounds
|
||||||
|
@@ -310,6 +310,10 @@ void Tab::OnThemeChanged() {
|
|||||||
LoadTabImages();
|
LoadTabImages();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::string Tab::GetClassName() const {
|
||||||
|
return kViewClassName;
|
||||||
|
}
|
||||||
|
|
||||||
bool Tab::HasHitTestMask() const {
|
bool Tab::HasHitTestMask() const {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@@ -66,7 +66,7 @@ class Tab : public BaseTab {
|
|||||||
virtual void OnPaint(gfx::Canvas* canvas);
|
virtual void OnPaint(gfx::Canvas* canvas);
|
||||||
virtual void Layout();
|
virtual void Layout();
|
||||||
virtual void OnThemeChanged();
|
virtual void OnThemeChanged();
|
||||||
virtual std::string GetClassName() const { return kViewClassName; }
|
virtual std::string GetClassName() const;
|
||||||
virtual bool HasHitTestMask() const;
|
virtual bool HasHitTestMask() const;
|
||||||
virtual void GetHitTestMask(gfx::Path* path) const;
|
virtual void GetHitTestMask(gfx::Path* path) const;
|
||||||
virtual bool GetTooltipTextOrigin(const gfx::Point& p, gfx::Point* origin);
|
virtual bool GetTooltipTextOrigin(const gfx::Point& p, gfx::Point* origin);
|
||||||
|
34
chrome/browser/ui/views/tabs/tab_renderer_data.cc
Normal file
34
chrome/browser/ui/views/tabs/tab_renderer_data.cc
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
// 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 "chrome/browser/ui/views/tabs/tab_renderer_data.h"
|
||||||
|
|
||||||
|
TabRendererData::TabRendererData()
|
||||||
|
: network_state(NETWORK_STATE_NONE),
|
||||||
|
loading(false),
|
||||||
|
crashed_status(base::TERMINATION_STATUS_STILL_RUNNING),
|
||||||
|
off_the_record(false),
|
||||||
|
show_icon(true),
|
||||||
|
mini(false),
|
||||||
|
blocked(false),
|
||||||
|
app(false) {
|
||||||
|
}
|
||||||
|
|
||||||
|
TabRendererData::~TabRendererData() {}
|
||||||
|
|
||||||
|
bool TabRendererData::Equals(const TabRendererData& data) {
|
||||||
|
return
|
||||||
|
favicon.pixelRef() &&
|
||||||
|
favicon.pixelRef() == data.favicon.pixelRef() &&
|
||||||
|
favicon.pixelRefOffset() == data.favicon.pixelRefOffset() &&
|
||||||
|
network_state == data.network_state &&
|
||||||
|
title == data.title &&
|
||||||
|
loading == data.loading &&
|
||||||
|
crashed_status == data.crashed_status &&
|
||||||
|
off_the_record == data.off_the_record &&
|
||||||
|
show_icon == data.show_icon &&
|
||||||
|
mini == data.mini &&
|
||||||
|
blocked == data.blocked &&
|
||||||
|
app == data.app;
|
||||||
|
}
|
@@ -1,4 +1,4 @@
|
|||||||
// Copyright (c) 2010 The Chromium Authors. All rights reserved.
|
// Copyright (c) 2011 The Chromium Authors. All rights reserved.
|
||||||
// Use of this source code is governed by a BSD-style license that can be
|
// Use of this source code is governed by a BSD-style license that can be
|
||||||
// found in the LICENSE file.
|
// found in the LICENSE file.
|
||||||
|
|
||||||
@@ -21,16 +21,8 @@ struct TabRendererData {
|
|||||||
NETWORK_STATE_LOADING, // connected, transferring data.
|
NETWORK_STATE_LOADING, // connected, transferring data.
|
||||||
};
|
};
|
||||||
|
|
||||||
TabRendererData()
|
TabRendererData();
|
||||||
: network_state(NETWORK_STATE_NONE),
|
~TabRendererData();
|
||||||
loading(false),
|
|
||||||
crashed_status(base::TERMINATION_STATUS_STILL_RUNNING),
|
|
||||||
off_the_record(false),
|
|
||||||
show_icon(true),
|
|
||||||
mini(false),
|
|
||||||
blocked(false),
|
|
||||||
app(false) {
|
|
||||||
}
|
|
||||||
|
|
||||||
// This interprets the crashed status to decide whether or not this
|
// This interprets the crashed status to decide whether or not this
|
||||||
// render data represents a tab that is "crashed" (i.e. the render
|
// render data represents a tab that is "crashed" (i.e. the render
|
||||||
@@ -43,21 +35,7 @@ struct TabRendererData {
|
|||||||
|
|
||||||
// Returns true if the TabRendererData is same as given |data|. Two favicons
|
// Returns true if the TabRendererData is same as given |data|. Two favicons
|
||||||
// are considered equals if two SkBitmaps point to the same SkPixelRef object.
|
// are considered equals if two SkBitmaps point to the same SkPixelRef object.
|
||||||
bool Equals(const TabRendererData& data) {
|
bool Equals(const TabRendererData& data);
|
||||||
return
|
|
||||||
favicon.pixelRef() &&
|
|
||||||
favicon.pixelRef() == data.favicon.pixelRef() &&
|
|
||||||
favicon.pixelRefOffset() == data.favicon.pixelRefOffset() &&
|
|
||||||
network_state == data.network_state &&
|
|
||||||
title == data.title &&
|
|
||||||
loading == data.loading &&
|
|
||||||
crashed_status == data.crashed_status &&
|
|
||||||
off_the_record == data.off_the_record &&
|
|
||||||
show_icon == data.show_icon &&
|
|
||||||
mini == data.mini &&
|
|
||||||
blocked == data.blocked &&
|
|
||||||
app == data.app;
|
|
||||||
}
|
|
||||||
|
|
||||||
SkBitmap favicon;
|
SkBitmap favicon;
|
||||||
NetworkState network_state;
|
NetworkState network_state;
|
||||||
|
@@ -209,13 +209,13 @@ class TabStrip : public BaseTabStrip,
|
|||||||
// animating to their desired position/bounds. This is used by the standard
|
// animating to their desired position/bounds. This is used by the standard
|
||||||
// Layout method and other callers like the DraggedTabController that need
|
// Layout method and other callers like the DraggedTabController that need
|
||||||
// stable representations of Tab positions.
|
// stable representations of Tab positions.
|
||||||
void GenerateIdealBounds();
|
virtual void GenerateIdealBounds();
|
||||||
|
|
||||||
// Starts various types of TabStrip animations.
|
// Starts various types of TabStrip animations.
|
||||||
void StartResizeLayoutAnimation();
|
void StartResizeLayoutAnimation();
|
||||||
void StartMoveTabAnimation(int from_model_index,
|
void StartMoveTabAnimation(int from_model_index,
|
||||||
int to_model_index);
|
int to_model_index);
|
||||||
void StartMiniTabAnimation();
|
virtual void StartMiniTabAnimation();
|
||||||
void StartMouseInitiatedRemoveTabAnimation(int model_index);
|
void StartMouseInitiatedRemoveTabAnimation(int model_index);
|
||||||
|
|
||||||
// Calculates the available width for tabs, assuming a Tab is to be closed.
|
// Calculates the available width for tabs, assuming a Tab is to be closed.
|
||||||
|
@@ -34,7 +34,7 @@ class Widget;
|
|||||||
class ThemeInstallBubbleView : public NotificationObserver,
|
class ThemeInstallBubbleView : public NotificationObserver,
|
||||||
public views::Label {
|
public views::Label {
|
||||||
public:
|
public:
|
||||||
~ThemeInstallBubbleView();
|
virtual ~ThemeInstallBubbleView();
|
||||||
|
|
||||||
// NotificationObserver
|
// NotificationObserver
|
||||||
virtual void Observe(NotificationType type,
|
virtual void Observe(NotificationType type,
|
||||||
@@ -51,7 +51,7 @@ class ThemeInstallBubbleView : public NotificationObserver,
|
|||||||
void Reposition();
|
void Reposition();
|
||||||
|
|
||||||
// Inherited from views.
|
// Inherited from views.
|
||||||
gfx::Size GetPreferredSize();
|
virtual gfx::Size GetPreferredSize();
|
||||||
|
|
||||||
// Shut down the popup and remove our notifications.
|
// Shut down the popup and remove our notifications.
|
||||||
void Close();
|
void Close();
|
||||||
|
@@ -3168,6 +3168,7 @@
|
|||||||
'browser/ui/views/tabs/tab.cc',
|
'browser/ui/views/tabs/tab.cc',
|
||||||
'browser/ui/views/tabs/tab.h',
|
'browser/ui/views/tabs/tab.h',
|
||||||
'browser/ui/views/tabs/tab_controller.h',
|
'browser/ui/views/tabs/tab_controller.h',
|
||||||
|
'browser/ui/views/tabs/tab_renderer_data.cc',
|
||||||
'browser/ui/views/tabs/tab_renderer_data.h',
|
'browser/ui/views/tabs/tab_renderer_data.h',
|
||||||
'browser/ui/views/tabs/tab_strip.cc',
|
'browser/ui/views/tabs/tab_strip.cc',
|
||||||
'browser/ui/views/tabs/tab_strip.h',
|
'browser/ui/views/tabs/tab_strip.h',
|
||||||
@@ -4057,6 +4058,7 @@
|
|||||||
['include', '^browser/ui/views/tabs/tab.cc'],
|
['include', '^browser/ui/views/tabs/tab.cc'],
|
||||||
['include', '^browser/ui/views/tabs/tab.h'],
|
['include', '^browser/ui/views/tabs/tab.h'],
|
||||||
['include', '^browser/ui/views/tabs/tab_controller.h'],
|
['include', '^browser/ui/views/tabs/tab_controller.h'],
|
||||||
|
['include', '^browser/ui/views/tabs/tab_renderer_data.cc'],
|
||||||
['include', '^browser/ui/views/tabs/tab_renderer_data.h'],
|
['include', '^browser/ui/views/tabs/tab_renderer_data.h'],
|
||||||
['include', '^browser/ui/views/tabs/tab_strip.cc'],
|
['include', '^browser/ui/views/tabs/tab_strip.cc'],
|
||||||
['include', '^browser/ui/views/tabs/tab_strip.h'],
|
['include', '^browser/ui/views/tabs/tab_strip.h'],
|
||||||
|
@@ -101,6 +101,10 @@ FocusManager::WidgetFocusManager::GetInstance() {
|
|||||||
return Singleton<WidgetFocusManager>::get();
|
return Singleton<WidgetFocusManager>::get();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
FocusManager::WidgetFocusManager::WidgetFocusManager() : enabled_(true) {}
|
||||||
|
|
||||||
|
FocusManager::WidgetFocusManager::~WidgetFocusManager() {}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
// FocusManager, public:
|
// FocusManager, public:
|
||||||
|
|
||||||
|
@@ -150,7 +150,8 @@ class FocusManager {
|
|||||||
void DisableNotifications() { enabled_ = false; }
|
void DisableNotifications() { enabled_ = false; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
WidgetFocusManager() : enabled_(true) {}
|
WidgetFocusManager();
|
||||||
|
~WidgetFocusManager();
|
||||||
|
|
||||||
typedef std::vector<WidgetFocusChangeListener*>
|
typedef std::vector<WidgetFocusChangeListener*>
|
||||||
WidgetFocusChangeListenerList;
|
WidgetFocusChangeListenerList;
|
||||||
|
@@ -77,6 +77,10 @@ void Label::OnBoundsChanged() {
|
|||||||
text_size_valid_ &= !is_multi_line_;
|
text_size_valid_ &= !is_multi_line_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::string Label::GetClassName() const {
|
||||||
|
return kViewClassName;
|
||||||
|
}
|
||||||
|
|
||||||
void Label::OnPaint(gfx::Canvas* canvas) {
|
void Label::OnPaint(gfx::Canvas* canvas) {
|
||||||
OnPaintBackground(canvas);
|
OnPaintBackground(canvas);
|
||||||
|
|
||||||
@@ -128,6 +132,14 @@ const GURL Label::GetURL() const {
|
|||||||
return url_set_ ? url_ : GURL(UTF16ToUTF8(text_));
|
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) {
|
void Label::SetHorizontalAlignment(Alignment alignment) {
|
||||||
// If the View's UI layout is right-to-left and rtl_alignment_mode_ is
|
// 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
|
// USE_UI_ALIGNMENT, we need to flip the alignment so that the alignment
|
||||||
|
@@ -69,7 +69,7 @@ class Label : public View {
|
|||||||
virtual void OnBoundsChanged();
|
virtual void OnBoundsChanged();
|
||||||
|
|
||||||
// Returns views/Label.
|
// Returns views/Label.
|
||||||
virtual std::string GetClassName() const { return kViewClassName; }
|
virtual std::string GetClassName() const;
|
||||||
|
|
||||||
// Overridden to paint
|
// Overridden to paint
|
||||||
virtual void OnPaint(gfx::Canvas* canvas);
|
virtual void OnPaint(gfx::Canvas* canvas);
|
||||||
@@ -97,10 +97,10 @@ class Label : public View {
|
|||||||
const GURL GetURL() const;
|
const GURL GetURL() const;
|
||||||
|
|
||||||
// Set the color
|
// 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.
|
// 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
|
// Set horizontal alignment. If the locale is RTL, and the RTL alignment
|
||||||
// setting is set as USE_UI_ALIGNMENT, the alignment is flipped around.
|
// setting is set as USE_UI_ALIGNMENT, the alignment is flipped around.
|
||||||
|
@@ -16,6 +16,8 @@ Menu2::Menu2(ui::MenuModel* model)
|
|||||||
Rebuild();
|
Rebuild();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Menu2::~Menu2() {}
|
||||||
|
|
||||||
gfx::NativeMenu Menu2::GetNativeMenu() const {
|
gfx::NativeMenu Menu2::GetNativeMenu() const {
|
||||||
return wrapper_->GetNativeMenu();
|
return wrapper_->GetNativeMenu();
|
||||||
}
|
}
|
||||||
|
@@ -33,7 +33,7 @@ class Menu2 {
|
|||||||
// MyClass : menu_(this) {}
|
// MyClass : menu_(this) {}
|
||||||
// is likely to have problems.
|
// is likely to have problems.
|
||||||
explicit Menu2(ui::MenuModel* model);
|
explicit Menu2(ui::MenuModel* model);
|
||||||
virtual ~Menu2() {}
|
virtual ~Menu2();
|
||||||
|
|
||||||
// How the menu is aligned relative to the point it is shown at.
|
// 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.
|
// The alignment is reversed by menu if text direction is right to left.
|
||||||
|
@@ -10,6 +10,33 @@ namespace views {
|
|||||||
|
|
||||||
static MenuConfig* config_instance = NULL;
|
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() {
|
void MenuConfig::Reset() {
|
||||||
delete config_instance;
|
delete config_instance;
|
||||||
config_instance = NULL;
|
config_instance = NULL;
|
||||||
|
@@ -14,30 +14,8 @@ namespace views {
|
|||||||
// Layout type information for menu items. Use the instance() method to obtain
|
// Layout type information for menu items. Use the instance() method to obtain
|
||||||
// the MenuConfig for the current platform.
|
// the MenuConfig for the current platform.
|
||||||
struct MenuConfig {
|
struct MenuConfig {
|
||||||
MenuConfig()
|
MenuConfig();
|
||||||
: text_color(SK_ColorBLACK),
|
~MenuConfig();
|
||||||
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) {
|
|
||||||
}
|
|
||||||
|
|
||||||
// Resets the single shared MenuConfig instance. The next time instance() is
|
// Resets the single shared MenuConfig instance. The next time instance() is
|
||||||
// invoked a new MenuConfig is created and configured.
|
// invoked a new MenuConfig is created and configured.
|
||||||
|
@@ -243,6 +243,12 @@ struct MenuController::SelectByCharDetails {
|
|||||||
int next_match;
|
int next_match;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// MenuController:State ------------------------------------------------------
|
||||||
|
|
||||||
|
MenuController::State::State() : item(NULL), submenu_open(false) {}
|
||||||
|
|
||||||
|
MenuController::State::~State() {}
|
||||||
|
|
||||||
// MenuController ------------------------------------------------------------
|
// MenuController ------------------------------------------------------------
|
||||||
|
|
||||||
// static
|
// static
|
||||||
|
@@ -131,7 +131,8 @@ class MenuController : public MessageLoopForUI::Dispatcher {
|
|||||||
|
|
||||||
// Tracks selection information.
|
// Tracks selection information.
|
||||||
struct State {
|
struct State {
|
||||||
State() : item(NULL), submenu_open(false) {}
|
State();
|
||||||
|
~State();
|
||||||
|
|
||||||
// The selected menu item.
|
// The selected menu item.
|
||||||
MenuItemView* item;
|
MenuItemView* item;
|
||||||
|
113
views/controls/menu/menu_delegate.cc
Normal file
113
views/controls/menu/menu_delegate.cc
Normal file
@@ -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
|
@@ -47,27 +47,19 @@ class MenuDelegate {
|
|||||||
|
|
||||||
// Whether or not an item should be shown as checked. This is invoked for
|
// Whether or not an item should be shown as checked. This is invoked for
|
||||||
// radio buttons and check buttons.
|
// radio buttons and check buttons.
|
||||||
virtual bool IsItemChecked(int id) const {
|
virtual bool IsItemChecked(int id) const;
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// The string shown for the menu item. This is only invoked when an item is
|
// The string shown for the menu item. This is only invoked when an item is
|
||||||
// added with an empty label.
|
// added with an empty label.
|
||||||
virtual std::wstring GetLabel(int id) const {
|
virtual std::wstring GetLabel(int id) const;
|
||||||
return std::wstring();
|
|
||||||
}
|
|
||||||
|
|
||||||
// The tooltip shown for the menu item. This is invoked when the user
|
// 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.
|
// 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) {
|
virtual std::wstring GetTooltipText(int id, const gfx::Point& screen_loc);
|
||||||
return std::wstring();
|
|
||||||
}
|
|
||||||
|
|
||||||
// If there is an accelerator for the menu item with id |id| it is set in
|
// If there is an accelerator for the menu item with id |id| it is set in
|
||||||
// |accelerator| and true is returned.
|
// |accelerator| and true is returned.
|
||||||
virtual bool GetAccelerator(int id, Accelerator* accelerator) {
|
virtual bool GetAccelerator(int id, Accelerator* accelerator);
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Shows the context menu with the specified id. This is invoked when the
|
// 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
|
// user does the appropriate gesture to show a context menu. The id
|
||||||
@@ -80,20 +72,12 @@ class MenuDelegate {
|
|||||||
virtual bool ShowContextMenu(MenuItemView* source,
|
virtual bool ShowContextMenu(MenuItemView* source,
|
||||||
int id,
|
int id,
|
||||||
const gfx::Point& p,
|
const gfx::Point& p,
|
||||||
bool is_mouse_gesture) {
|
bool is_mouse_gesture);
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Controller
|
// Controller
|
||||||
virtual bool SupportsCommand(int id) const {
|
virtual bool SupportsCommand(int id) const;
|
||||||
return true;
|
virtual bool IsCommandEnabled(int id) const;
|
||||||
}
|
virtual bool GetContextualLabel(int id, std::wstring* out) const;
|
||||||
virtual bool IsCommandEnabled(int id) const {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
virtual bool GetContextualLabel(int id, std::wstring* out) const {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
virtual void ExecuteCommand(int id) {
|
virtual void ExecuteCommand(int id) {
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -102,23 +86,17 @@ class MenuDelegate {
|
|||||||
// the user selects the menu with the command |id|. This returns true to
|
// 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
|
// indicate that all menus should be closed. Return false if only the
|
||||||
// context menu should be closed.
|
// context menu should be closed.
|
||||||
virtual bool ShouldCloseAllMenusOnExecute(int id) {
|
virtual bool ShouldCloseAllMenusOnExecute(int id);
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Executes the specified command. mouse_event_flags give the flags of the
|
// Executes the specified command. mouse_event_flags give the flags of the
|
||||||
// mouse event that triggered this to be invoked (views::MouseEvent
|
// mouse event that triggered this to be invoked (views::MouseEvent
|
||||||
// flags). mouse_event_flags is 0 if this is triggered by a user gesture
|
// flags). mouse_event_flags is 0 if this is triggered by a user gesture
|
||||||
// other than a mouse event.
|
// other than a mouse event.
|
||||||
virtual void ExecuteCommand(int id, int mouse_event_flags) {
|
virtual void ExecuteCommand(int id, int mouse_event_flags);
|
||||||
ExecuteCommand(id);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Returns true if the specified mouse event is one the user can use
|
// 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.
|
// to trigger, or accept, the mouse. Defaults to left or right mouse buttons.
|
||||||
virtual bool IsTriggerableEvent(const MouseEvent& e) {
|
virtual bool IsTriggerableEvent(const MouseEvent& e);
|
||||||
return e.IsLeftMouseButton() || e.IsRightMouseButton();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Invoked to determine if drops can be accepted for a submenu. This is
|
// 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
|
// 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.
|
// To restrict which children can be dropped on override GetDropOperation.
|
||||||
virtual bool CanDrop(MenuItemView* menu, const OSExchangeData& data) {
|
virtual bool CanDrop(MenuItemView* menu, const OSExchangeData& data);
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// See view for a description of this method.
|
// See view for a description of this method.
|
||||||
virtual bool GetDropFormats(
|
virtual bool GetDropFormats(
|
||||||
MenuItemView* menu,
|
MenuItemView* menu,
|
||||||
int* formats,
|
int* formats,
|
||||||
std::set<OSExchangeData::CustomFormat>* custom_formats) {
|
std::set<OSExchangeData::CustomFormat>* custom_formats);
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// See view for a description of this method.
|
// See view for a description of this method.
|
||||||
virtual bool AreDropTypesRequired(MenuItemView* menu) {
|
virtual bool AreDropTypesRequired(MenuItemView* menu);
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Returns the drop operation for the specified target menu item. This is
|
// Returns the drop operation for the specified target menu item. This is
|
||||||
// only invoked if CanDrop returned true for the parent menu. position
|
// 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.
|
// If a drop should not be allowed, returned ui::DragDropTypes::DRAG_NONE.
|
||||||
virtual int GetDropOperation(MenuItemView* item,
|
virtual int GetDropOperation(MenuItemView* item,
|
||||||
const DropTargetEvent& event,
|
const DropTargetEvent& event,
|
||||||
DropPosition* position) {
|
DropPosition* position);
|
||||||
NOTREACHED() << "If you override CanDrop, you need to override this too";
|
|
||||||
return ui::DragDropTypes::DRAG_NONE;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Invoked to perform the drop operation. This is ONLY invoked if
|
// Invoked to perform the drop operation. This is ONLY invoked if
|
||||||
// canDrop returned true for the parent menu item, and GetDropOperation
|
// canDrop returned true for the parent menu item, and GetDropOperation
|
||||||
@@ -171,29 +140,19 @@ class MenuDelegate {
|
|||||||
// menu indicates the menu the drop occurred on.
|
// menu indicates the menu the drop occurred on.
|
||||||
virtual int OnPerformDrop(MenuItemView* menu,
|
virtual int OnPerformDrop(MenuItemView* menu,
|
||||||
DropPosition position,
|
DropPosition position,
|
||||||
const DropTargetEvent& event) {
|
const DropTargetEvent& event);
|
||||||
NOTREACHED() << "If you override CanDrop, you need to override this too";
|
|
||||||
return ui::DragDropTypes::DRAG_NONE;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Invoked to determine if it is possible for the user to drag the specified
|
// Invoked to determine if it is possible for the user to drag the specified
|
||||||
// menu item.
|
// menu item.
|
||||||
virtual bool CanDrag(MenuItemView* menu) {
|
virtual bool CanDrag(MenuItemView* menu);
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Invoked to write the data for a drag operation to data. sender is the
|
// Invoked to write the data for a drag operation to data. sender is the
|
||||||
// MenuItemView being dragged.
|
// MenuItemView being dragged.
|
||||||
virtual void WriteDragData(MenuItemView* sender, OSExchangeData* data) {
|
virtual void WriteDragData(MenuItemView* sender, OSExchangeData* data);
|
||||||
NOTREACHED() << "If you override CanDrag, you must override this too.";
|
|
||||||
}
|
|
||||||
|
|
||||||
// Invoked to determine the drag operations for a drag session of sender.
|
// Invoked to determine the drag operations for a drag session of sender.
|
||||||
// See DragDropTypes for possible values.
|
// See DragDropTypes for possible values.
|
||||||
virtual int GetDragOperations(MenuItemView* sender) {
|
virtual int GetDragOperations(MenuItemView* sender);
|
||||||
NOTREACHED() << "If you override CanDrag, you must override this too.";
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Notification the menu has closed. This is only sent when running the
|
// Notification the menu has closed. This is only sent when running the
|
||||||
// menu for a drop.
|
// menu for a drop.
|
||||||
@@ -213,16 +172,10 @@ class MenuDelegate {
|
|||||||
const gfx::Point& screen_point,
|
const gfx::Point& screen_point,
|
||||||
MenuItemView::AnchorPosition* anchor,
|
MenuItemView::AnchorPosition* anchor,
|
||||||
bool* has_mnemonics,
|
bool* has_mnemonics,
|
||||||
MenuButton** button) {
|
MenuButton** button);
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Returns the max width menus can grow to be.
|
// Returns the max width menus can grow to be.
|
||||||
virtual int GetMaxWidthForMenu() {
|
virtual int GetMaxWidthForMenu();
|
||||||
// NOTE: this needs to be large enough to accommodate the wrench menu with
|
|
||||||
// big fonts.
|
|
||||||
return 800;
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace views
|
} // namespace views
|
||||||
|
@@ -21,10 +21,10 @@ class MenuHostGtk : public WidgetGtk, public MenuHost {
|
|||||||
virtual ~MenuHostGtk();
|
virtual ~MenuHostGtk();
|
||||||
|
|
||||||
// MenuHost overrides.
|
// MenuHost overrides.
|
||||||
void InitMenuHost(gfx::NativeWindow parent,
|
virtual void InitMenuHost(gfx::NativeWindow parent,
|
||||||
const gfx::Rect& bounds,
|
const gfx::Rect& bounds,
|
||||||
View* contents_view,
|
View* contents_view,
|
||||||
bool do_capture);
|
bool do_capture);
|
||||||
virtual bool IsMenuHostVisible();
|
virtual bool IsMenuHostVisible();
|
||||||
virtual void ShowMenuHost(bool do_capture);
|
virtual void ShowMenuHost(bool do_capture);
|
||||||
virtual void HideMenuHost();
|
virtual void HideMenuHost();
|
||||||
|
@@ -318,6 +318,14 @@ SubmenuView* MenuItemView::CreateSubmenu() {
|
|||||||
return submenu_;
|
return submenu_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool MenuItemView::HasSubmenu() const {
|
||||||
|
return (submenu_ != NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
SubmenuView* MenuItemView::GetSubmenu() const {
|
||||||
|
return submenu_;
|
||||||
|
}
|
||||||
|
|
||||||
void MenuItemView::SetTitle(const std::wstring& title) {
|
void MenuItemView::SetTitle(const std::wstring& title) {
|
||||||
title_ = WideToUTF16Hack(title);
|
title_ = WideToUTF16Hack(title);
|
||||||
SetAccessibleName(GetAccessibleNameForMenuItem(title_, GetAcceleratorText()));
|
SetAccessibleName(GetAccessibleNameForMenuItem(title_, GetAcceleratorText()));
|
||||||
|
@@ -199,10 +199,10 @@ class MenuItemView : public View {
|
|||||||
virtual SubmenuView* CreateSubmenu();
|
virtual SubmenuView* CreateSubmenu();
|
||||||
|
|
||||||
// Returns true if this menu item has a submenu.
|
// 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.
|
// Returns the view containing child menu items.
|
||||||
virtual SubmenuView* GetSubmenu() const { return submenu_; }
|
virtual SubmenuView* GetSubmenu() const;
|
||||||
|
|
||||||
// Returns the parent menu item.
|
// Returns the parent menu item.
|
||||||
MenuItemView* GetParentMenuItem() const { return parent_menu_item_; }
|
MenuItemView* GetParentMenuItem() const { return parent_menu_item_; }
|
||||||
|
@@ -16,8 +16,8 @@ class MenuSeparator : public View {
|
|||||||
MenuSeparator() {}
|
MenuSeparator() {}
|
||||||
|
|
||||||
// View overrides.
|
// View overrides.
|
||||||
void OnPaint(gfx::Canvas* canvas);
|
virtual void OnPaint(gfx::Canvas* canvas);
|
||||||
gfx::Size GetPreferredSize();
|
virtual gfx::Size GetPreferredSize();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
DISALLOW_COPY_AND_ASSIGN(MenuSeparator);
|
DISALLOW_COPY_AND_ASSIGN(MenuSeparator);
|
||||||
|
@@ -61,7 +61,7 @@ class SubmenuView : public View {
|
|||||||
virtual AccessibilityTypes::Role GetAccessibleRole();
|
virtual AccessibilityTypes::Role GetAccessibleRole();
|
||||||
|
|
||||||
// Painting.
|
// Painting.
|
||||||
void PaintChildren(gfx::Canvas* canvas);
|
virtual void PaintChildren(gfx::Canvas* canvas);
|
||||||
|
|
||||||
// Drag and drop methods. These are forwarded to the MenuController.
|
// Drag and drop methods. These are forwarded to the MenuController.
|
||||||
virtual bool GetDropFormats(
|
virtual bool GetDropFormats(
|
||||||
|
@@ -46,6 +46,8 @@ MessageBoxView::MessageBoxView(int dialog_flags,
|
|||||||
Init(dialog_flags, default_prompt);
|
Init(dialog_flags, default_prompt);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
MessageBoxView::~MessageBoxView() {}
|
||||||
|
|
||||||
std::wstring MessageBoxView::GetInputText() {
|
std::wstring MessageBoxView::GetInputText() {
|
||||||
if (prompt_field_)
|
if (prompt_field_)
|
||||||
return UTF16ToWideHack(prompt_field_->text());
|
return UTF16ToWideHack(prompt_field_->text());
|
||||||
|
@@ -32,6 +32,8 @@ class MessageBoxView : public views::View {
|
|||||||
const std::wstring& message,
|
const std::wstring& message,
|
||||||
const std::wstring& default_prompt);
|
const std::wstring& default_prompt);
|
||||||
|
|
||||||
|
virtual ~MessageBoxView();
|
||||||
|
|
||||||
// Returns the text box.
|
// Returns the text box.
|
||||||
views::Textfield* text_box() { return prompt_field_; }
|
views::Textfield* text_box() { return prompt_field_; }
|
||||||
|
|
||||||
|
@@ -104,6 +104,8 @@ SmoothedThrobber::SmoothedThrobber(int frame_time_ms)
|
|||||||
stop_delay_ms_(kStopDelay) {
|
stop_delay_ms_(kStopDelay) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SmoothedThrobber::~SmoothedThrobber() {}
|
||||||
|
|
||||||
void SmoothedThrobber::Start() {
|
void SmoothedThrobber::Start() {
|
||||||
stop_timer_.Stop();
|
stop_timer_.Stop();
|
||||||
|
|
||||||
|
@@ -63,6 +63,7 @@ class SmoothedThrobber : public Throbber {
|
|||||||
public:
|
public:
|
||||||
SmoothedThrobber(int frame_delay_ms);
|
SmoothedThrobber(int frame_delay_ms);
|
||||||
SmoothedThrobber(int frame_delay_ms, SkBitmap* frames);
|
SmoothedThrobber(int frame_delay_ms, SkBitmap* frames);
|
||||||
|
virtual ~SmoothedThrobber();
|
||||||
|
|
||||||
virtual void Start();
|
virtual void Start();
|
||||||
virtual void Stop();
|
virtual void Stop();
|
||||||
|
@@ -63,6 +63,10 @@ void FocusManager::WidgetFocusManager::OnWidgetFocusEvent(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
FocusManager::WidgetFocusManager::WidgetFocusManager() : enabled_(true) {}
|
||||||
|
|
||||||
|
FocusManager::WidgetFocusManager::~WidgetFocusManager() {}
|
||||||
|
|
||||||
// static
|
// static
|
||||||
FocusManager::WidgetFocusManager*
|
FocusManager::WidgetFocusManager*
|
||||||
FocusManager::WidgetFocusManager::GetInstance() {
|
FocusManager::WidgetFocusManager::GetInstance() {
|
||||||
|
@@ -150,7 +150,8 @@ class FocusManager {
|
|||||||
void DisableNotifications() { enabled_ = false; }
|
void DisableNotifications() { enabled_ = false; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
WidgetFocusManager() : enabled_(true) {}
|
WidgetFocusManager();
|
||||||
|
~WidgetFocusManager();
|
||||||
|
|
||||||
typedef std::vector<WidgetFocusChangeListener*>
|
typedef std::vector<WidgetFocusChangeListener*>
|
||||||
WidgetFocusChangeListenerList;
|
WidgetFocusChangeListenerList;
|
||||||
|
@@ -48,6 +48,15 @@ char View::kViewClassName[] = "views/View";
|
|||||||
void View::SetHotTracked(bool flag) {
|
void View::SetHotTracked(bool flag) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool View::IsHotTracked() const {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// FATE TBD --------------------------------------------------------------------
|
||||||
|
|
||||||
|
Widget* View::child_widget() {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
// Creation and lifetime -------------------------------------------------------
|
// Creation and lifetime -------------------------------------------------------
|
||||||
|
|
||||||
@@ -340,6 +349,10 @@ void View::SetVisible(bool flag) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool View::IsVisible() const {
|
||||||
|
return is_visible_;
|
||||||
|
}
|
||||||
|
|
||||||
bool View::IsVisibleInRootView() const {
|
bool View::IsVisibleInRootView() const {
|
||||||
return IsVisible() && parent() ? parent()->IsVisibleInRootView() : false;
|
return IsVisible() && parent() ? parent()->IsVisibleInRootView() : false;
|
||||||
}
|
}
|
||||||
@@ -544,6 +557,10 @@ int View::GetGroup() const {
|
|||||||
return group_;
|
return group_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool View::IsGroupFocusTraversable() const {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
void View::GetViewsWithGroup(int group_id, std::vector<View*>* out) {
|
void View::GetViewsWithGroup(int group_id, std::vector<View*>* out) {
|
||||||
if (group_ == group_id)
|
if (group_ == group_id)
|
||||||
out->push_back(this);
|
out->push_back(this);
|
||||||
@@ -861,6 +878,10 @@ void View::ResetAccelerators() {
|
|||||||
UnregisterAccelerators(false);
|
UnregisterAccelerators(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool View::AcceleratorPressed(const Accelerator& accelerator) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
// Focus -----------------------------------------------------------------------
|
// Focus -----------------------------------------------------------------------
|
||||||
|
|
||||||
bool View::HasFocus() {
|
bool View::HasFocus() {
|
||||||
@@ -900,6 +921,10 @@ bool View::IsAccessibilityFocusableInRootView() const {
|
|||||||
IsVisibleInRootView();
|
IsVisibleInRootView();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void View::set_accessibility_focusable(bool accessibility_focusable) {
|
||||||
|
accessibility_focusable_ = accessibility_focusable;
|
||||||
|
}
|
||||||
|
|
||||||
FocusManager* View::GetFocusManager() {
|
FocusManager* View::GetFocusManager() {
|
||||||
Widget* widget = GetWidget();
|
Widget* widget = GetWidget();
|
||||||
return widget ? widget->GetFocusManager() : NULL;
|
return widget ? widget->GetFocusManager() : NULL;
|
||||||
@@ -911,6 +936,18 @@ void View::RequestFocus() {
|
|||||||
focus_manager->SetFocusedView(this);
|
focus_manager->SetFocusedView(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool View::SkipDefaultKeyEventProcessing(const KeyEvent& e) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
FocusTraversable* View::GetFocusTraversable() {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
FocusTraversable* View::GetPaneFocusTraversable() {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
// Tooltips --------------------------------------------------------------------
|
// Tooltips --------------------------------------------------------------------
|
||||||
|
|
||||||
bool View::GetTooltipText(const gfx::Point& p, std::wstring* tooltip) {
|
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);
|
NotifyAccessibilityEvent(event_type, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
string16 View::GetAccessibleDefaultAction() {
|
||||||
|
return string16();
|
||||||
|
}
|
||||||
|
|
||||||
|
string16 View::GetAccessibleKeyboardShortcut() {
|
||||||
|
return string16();
|
||||||
|
}
|
||||||
|
|
||||||
bool View::GetAccessibleName(string16* name) {
|
bool View::GetAccessibleName(string16* name) {
|
||||||
DCHECK(name);
|
DCHECK(name);
|
||||||
|
|
||||||
@@ -1001,6 +1046,14 @@ AccessibilityTypes::Role View::GetAccessibleRole() {
|
|||||||
return AccessibilityTypes::ROLE_CLIENT;
|
return AccessibilityTypes::ROLE_CLIENT;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
AccessibilityTypes::State View::GetAccessibleState() {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
string16 View::GetAccessibleValue() {
|
||||||
|
return string16();
|
||||||
|
}
|
||||||
|
|
||||||
void View::SetAccessibleName(const string16& name) {
|
void View::SetAccessibleName(const string16& name) {
|
||||||
accessible_name_ = name;
|
accessible_name_ = name;
|
||||||
}
|
}
|
||||||
|
36
views/view.h
36
views/view.h
@@ -154,13 +154,13 @@ class View : public AcceleratorTarget {
|
|||||||
|
|
||||||
// TODO(beng): delete
|
// TODO(beng): delete
|
||||||
// Returns whether the view is hot-tracked.
|
// Returns whether the view is hot-tracked.
|
||||||
virtual bool IsHotTracked() const { return false; }
|
virtual bool IsHotTracked() const;
|
||||||
|
|
||||||
// FATE TBD ------------------------------------------------------------------
|
// FATE TBD ------------------------------------------------------------------
|
||||||
// TODO(beng): Figure out what these methods are for and delete them.
|
// TODO(beng): Figure out what these methods are for and delete them.
|
||||||
|
|
||||||
// TODO(beng): this one isn't even google3-style. wth.
|
// TODO(beng): this one isn't even google3-style. wth.
|
||||||
virtual Widget* child_widget() { return NULL; }
|
virtual Widget* child_widget();
|
||||||
|
|
||||||
// Creation and lifetime -----------------------------------------------------
|
// Creation and lifetime -----------------------------------------------------
|
||||||
|
|
||||||
@@ -309,7 +309,7 @@ class View : public AcceleratorTarget {
|
|||||||
virtual void SetVisible(bool flag);
|
virtual void SetVisible(bool flag);
|
||||||
|
|
||||||
// Return whether a view is visible
|
// 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
|
// Return whether a view and its ancestors are visible. Returns true if the
|
||||||
// path from this view to the root view is visible.
|
// 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,
|
// when moving focus with the Tab/Shift-Tab key. If this returns false,
|
||||||
// only the selected view from the group (obtained with
|
// only the selected view from the group (obtained with
|
||||||
// GetSelectedViewForGroup()) is focused.
|
// 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
|
// Fills the provided vector with all the available views which belong to the
|
||||||
// provided group.
|
// provided group.
|
||||||
@@ -693,9 +693,7 @@ class View : public AcceleratorTarget {
|
|||||||
// Called when a keyboard accelerator is pressed.
|
// Called when a keyboard accelerator is pressed.
|
||||||
// Derived classes should implement desired behavior and return true if they
|
// Derived classes should implement desired behavior and return true if they
|
||||||
// handled the accelerator.
|
// handled the accelerator.
|
||||||
virtual bool AcceleratorPressed(const Accelerator& accelerator) {
|
virtual bool AcceleratorPressed(const Accelerator& accelerator);
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Focus ---------------------------------------------------------------------
|
// Focus ---------------------------------------------------------------------
|
||||||
|
|
||||||
@@ -732,9 +730,7 @@ class View : public AcceleratorTarget {
|
|||||||
// Set whether this view can be made focusable if the user requires
|
// Set whether this view can be made focusable if the user requires
|
||||||
// full keyboard access, even though it's not normally focusable.
|
// full keyboard access, even though it's not normally focusable.
|
||||||
// Note that this is false by default.
|
// Note that this is false by default.
|
||||||
virtual void set_accessibility_focusable(bool accessibility_focusable) {
|
virtual void set_accessibility_focusable(bool accessibility_focusable);
|
||||||
accessibility_focusable_ = accessibility_focusable;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Convenience method to retrieve the FocusManager associated with the
|
// Convenience method to retrieve the FocusManager associated with the
|
||||||
// Widget that contains this view. This can return NULL if this view is not
|
// 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
|
// 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
|
// key event is for the TAB key). In that case, OnKeyPressed will
|
||||||
// subsequently be invoked for that event.
|
// subsequently be invoked for that event.
|
||||||
virtual bool SkipDefaultKeyEventProcessing(const KeyEvent& e) {
|
virtual bool SkipDefaultKeyEventProcessing(const KeyEvent& e);
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Subclasses that contain traversable children that are not directly
|
// Subclasses that contain traversable children that are not directly
|
||||||
// accessible through the children hierarchy should return the associated
|
// accessible through the children hierarchy should return the associated
|
||||||
// FocusTraversable for the focus traversal to work properly.
|
// 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
|
// Subclasses that can act as a "pane" must implement their own
|
||||||
// FocusTraversable to keep the focus trapped within the pane.
|
// FocusTraversable to keep the focus trapped within the pane.
|
||||||
// If this method returns an object, any view that's a direct or
|
// If this method returns an object, any view that's a direct or
|
||||||
// indirect child of this view will always use this FocusTraversable
|
// indirect child of this view will always use this FocusTraversable
|
||||||
// rather than the one from the widget.
|
// rather than the one from the widget.
|
||||||
virtual FocusTraversable* GetPaneFocusTraversable() { return NULL; }
|
virtual FocusTraversable* GetPaneFocusTraversable();
|
||||||
|
|
||||||
// Tooltips ------------------------------------------------------------------
|
// Tooltips ------------------------------------------------------------------
|
||||||
|
|
||||||
@@ -893,13 +887,11 @@ class View : public AcceleratorTarget {
|
|||||||
// describes the default action that will occur when executing
|
// describes the default action that will occur when executing
|
||||||
// IAccessible::DoDefaultAction. For instance, default action of a button is
|
// IAccessible::DoDefaultAction. For instance, default action of a button is
|
||||||
// 'Press'.
|
// 'Press'.
|
||||||
virtual string16 GetAccessibleDefaultAction() { return string16(); }
|
virtual string16 GetAccessibleDefaultAction();
|
||||||
|
|
||||||
// Returns a string containing the mnemonic, or the keyboard shortcut, for a
|
// Returns a string containing the mnemonic, or the keyboard shortcut, for a
|
||||||
// given control.
|
// given control.
|
||||||
virtual string16 GetAccessibleKeyboardShortcut() {
|
virtual string16 GetAccessibleKeyboardShortcut();
|
||||||
return string16();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Returns a brief, identifying string, containing a unique, readable name of
|
// Returns a brief, identifying string, containing a unique, readable name of
|
||||||
// a given control. Sets the input string appropriately, and returns true if
|
// a given control. Sets the input string appropriately, and returns true if
|
||||||
@@ -912,12 +904,10 @@ class View : public AcceleratorTarget {
|
|||||||
virtual AccessibilityTypes::Role GetAccessibleRole();
|
virtual AccessibilityTypes::Role GetAccessibleRole();
|
||||||
|
|
||||||
// Returns the accessibility state of the current view.
|
// Returns the accessibility state of the current view.
|
||||||
virtual AccessibilityTypes::State GetAccessibleState() {
|
virtual AccessibilityTypes::State GetAccessibleState();
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Returns the current value associated with a view.
|
// 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
|
// 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
|
// which name will be associated with it until it is created to be a
|
||||||
|
@@ -135,6 +135,7 @@
|
|||||||
'controls/menu/menu_config_win.cc',
|
'controls/menu/menu_config_win.cc',
|
||||||
'controls/menu/menu_controller.cc',
|
'controls/menu/menu_controller.cc',
|
||||||
'controls/menu/menu_controller.h',
|
'controls/menu/menu_controller.h',
|
||||||
|
'controls/menu/menu_delegate.cc',
|
||||||
'controls/menu/menu_delegate.h',
|
'controls/menu/menu_delegate.h',
|
||||||
'controls/menu/menu_gtk.cc',
|
'controls/menu/menu_gtk.cc',
|
||||||
'controls/menu/menu_gtk.h',
|
'controls/menu/menu_gtk.h',
|
||||||
|
@@ -12,10 +12,25 @@
|
|||||||
|
|
||||||
namespace views {
|
namespace views {
|
||||||
|
|
||||||
|
DefaultThemeProvider::DefaultThemeProvider() {}
|
||||||
|
|
||||||
|
DefaultThemeProvider::~DefaultThemeProvider() {}
|
||||||
|
|
||||||
|
void DefaultThemeProvider::Init(Profile* profile) {}
|
||||||
|
|
||||||
SkBitmap* DefaultThemeProvider::GetBitmapNamed(int id) const {
|
SkBitmap* DefaultThemeProvider::GetBitmapNamed(int id) const {
|
||||||
return ResourceBundle::GetSharedInstance().GetBitmapNamed(id);
|
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 {
|
bool DefaultThemeProvider::ShouldUseNativeFrame() const {
|
||||||
#if defined(OS_WIN)
|
#if defined(OS_WIN)
|
||||||
return WidgetWin::IsAeroGlassEnabled();
|
return WidgetWin::IsAeroGlassEnabled();
|
||||||
@@ -24,4 +39,12 @@ bool DefaultThemeProvider::ShouldUseNativeFrame() const {
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool DefaultThemeProvider::HasCustomImage(int id) const {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
RefCountedMemory* DefaultThemeProvider::GetRawData(int id) const {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace views
|
} // namespace views
|
||||||
|
@@ -22,20 +22,17 @@ namespace views {
|
|||||||
|
|
||||||
class DefaultThemeProvider : public ui::ThemeProvider {
|
class DefaultThemeProvider : public ui::ThemeProvider {
|
||||||
public:
|
public:
|
||||||
DefaultThemeProvider() { };
|
DefaultThemeProvider();
|
||||||
virtual ~DefaultThemeProvider() { };
|
virtual ~DefaultThemeProvider();
|
||||||
|
|
||||||
// Overridden from ui::ThemeProvider.
|
// Overridden from ui::ThemeProvider.
|
||||||
virtual void Init(Profile* profile) { }
|
virtual void Init(Profile* profile);
|
||||||
virtual SkBitmap* GetBitmapNamed(int id) const;
|
virtual SkBitmap* GetBitmapNamed(int id) const;
|
||||||
virtual SkColor GetColor(int id) const {
|
virtual SkColor GetColor(int id) const;
|
||||||
// Return debugging-blue.
|
virtual bool GetDisplayProperty(int id, int* result) const;
|
||||||
return 0xff0000ff;
|
|
||||||
}
|
|
||||||
virtual bool GetDisplayProperty(int id, int* result) const { return false; }
|
|
||||||
virtual bool ShouldUseNativeFrame() const;
|
virtual bool ShouldUseNativeFrame() const;
|
||||||
virtual bool HasCustomImage(int id) const { return false; }
|
virtual bool HasCustomImage(int id) const;
|
||||||
virtual RefCountedMemory* GetRawData(int id) const { return NULL; }
|
virtual RefCountedMemory* GetRawData(int id) const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
DISALLOW_COPY_AND_ASSIGN(DefaultThemeProvider);
|
DISALLOW_COPY_AND_ASSIGN(DefaultThemeProvider);
|
||||||
|
@@ -1224,6 +1224,10 @@ void WidgetGtk::OnShow(GtkWidget* widget) {
|
|||||||
void WidgetGtk::OnHide(GtkWidget* widget) {
|
void WidgetGtk::OnHide(GtkWidget* widget) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool WidgetGtk::ReleaseCaptureOnMouseReleased() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
void WidgetGtk::DoGrab() {
|
void WidgetGtk::DoGrab() {
|
||||||
has_capture_ = true;
|
has_capture_ = true;
|
||||||
gtk_grab_add(window_contents_);
|
gtk_grab_add(window_contents_);
|
||||||
|
@@ -265,7 +265,7 @@ class WidgetGtk : public Widget,
|
|||||||
|
|
||||||
// Returns whether capture should be released on mouse release. The default
|
// Returns whether capture should be released on mouse release. The default
|
||||||
// is true.
|
// is true.
|
||||||
virtual bool ReleaseCaptureOnMouseReleased() { return true; }
|
virtual bool ReleaseCaptureOnMouseReleased();
|
||||||
|
|
||||||
// Does a mouse grab on this widget.
|
// Does a mouse grab on this widget.
|
||||||
virtual void DoGrab();
|
virtual void DoGrab();
|
||||||
|
@@ -24,6 +24,14 @@ int ClientView::NonClientHitTest(const gfx::Point& point) {
|
|||||||
return bounds().Contains(point) ? HTCLIENT : HTNOWHERE;
|
return bounds().Contains(point) ? HTCLIENT : HTNOWHERE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DialogClientView* ClientView::AsDialogClientView() {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool ClientView::CanClose() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
void ClientView::WindowClosing() {
|
void ClientView::WindowClosing() {
|
||||||
window_->GetDelegate()->WindowClosing();
|
window_->GetDelegate()->WindowClosing();
|
||||||
}
|
}
|
||||||
|
@@ -31,13 +31,13 @@ class ClientView : public View {
|
|||||||
virtual ~ClientView() {}
|
virtual ~ClientView() {}
|
||||||
|
|
||||||
// Manual RTTI ftw.
|
// Manual RTTI ftw.
|
||||||
virtual DialogClientView* AsDialogClientView() { return NULL; }
|
virtual DialogClientView* AsDialogClientView();
|
||||||
|
|
||||||
// Returns true to signal that the Window can be closed. Specialized
|
// Returns true to signal that the Window can be closed. Specialized
|
||||||
// ClientView subclasses can override this default behavior to allow the
|
// ClientView subclasses can override this default behavior to allow the
|
||||||
// close to be blocked until the user corrects mistakes, accepts a warning
|
// close to be blocked until the user corrects mistakes, accepts a warning
|
||||||
// dialog, etc.
|
// dialog, etc.
|
||||||
virtual bool CanClose() { return true; }
|
virtual bool CanClose();
|
||||||
|
|
||||||
// Notification that the window is closing. The default implementation
|
// Notification that the window is closing. The default implementation
|
||||||
// forwards the notification to the delegate.
|
// forwards the notification to the delegate.
|
||||||
|
@@ -297,6 +297,10 @@ int DialogClientView::NonClientHitTest(const gfx::Point& point) {
|
|||||||
return ClientView::NonClientHitTest(point);
|
return ClientView::NonClientHitTest(point);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DialogClientView* DialogClientView::AsDialogClientView() {
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
// DialogClientView, View overrides:
|
// DialogClientView, View overrides:
|
||||||
|
|
||||||
|
@@ -68,7 +68,7 @@ class DialogClientView : public ClientView,
|
|||||||
virtual bool CanClose();
|
virtual bool CanClose();
|
||||||
virtual void WindowClosing();
|
virtual void WindowClosing();
|
||||||
virtual int NonClientHitTest(const gfx::Point& point);
|
virtual int NonClientHitTest(const gfx::Point& point);
|
||||||
virtual DialogClientView* AsDialogClientView() { return this; }
|
virtual DialogClientView* AsDialogClientView();
|
||||||
|
|
||||||
// FocusChangeListener implementation:
|
// FocusChangeListener implementation:
|
||||||
virtual void FocusWillChange(View* focused_before, View* focused_now);
|
virtual void FocusWillChange(View* focused_before, View* focused_now);
|
||||||
|
@@ -12,6 +12,34 @@ namespace views {
|
|||||||
|
|
||||||
// Overridden from WindowDelegate:
|
// 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 {
|
int DialogDelegate::GetDefaultDialogButton() const {
|
||||||
if (GetDialogButtons() & MessageBoxFlags::DIALOGBUTTON_OK)
|
if (GetDialogButtons() & MessageBoxFlags::DIALOGBUTTON_OK)
|
||||||
return MessageBoxFlags::DIALOGBUTTON_OK;
|
return MessageBoxFlags::DIALOGBUTTON_OK;
|
||||||
@@ -20,6 +48,28 @@ int DialogDelegate::GetDefaultDialogButton() const {
|
|||||||
return MessageBoxFlags::DIALOGBUTTON_NONE;
|
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() {
|
View* DialogDelegate::GetInitiallyFocusedView() {
|
||||||
// Focus the default button if any.
|
// Focus the default button if any.
|
||||||
DialogClientView* dcv = GetDialogClientView();
|
DialogClientView* dcv = GetDialogClientView();
|
||||||
@@ -51,4 +101,8 @@ DialogClientView* DialogDelegate::GetDialogClientView() const {
|
|||||||
return dialog_client_view;
|
return dialog_client_view;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
AccessibilityTypes::Role DialogDelegate::accessible_role() const {
|
||||||
|
return AccessibilityTypes::ROLE_DIALOG;
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace views
|
} // namespace views
|
||||||
|
@@ -29,7 +29,7 @@ class View;
|
|||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
class DialogDelegate : public WindowDelegate {
|
class DialogDelegate : public WindowDelegate {
|
||||||
public:
|
public:
|
||||||
virtual DialogDelegate* AsDialogDelegate() { return this; }
|
virtual DialogDelegate* AsDialogDelegate();
|
||||||
|
|
||||||
// Returns a mask specifying which of the available DialogButtons are visible
|
// 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
|
// 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.
|
// you should reconsider, or beng says there will be stabbings.
|
||||||
//
|
//
|
||||||
// To use the extra button you need to override GetDialogButtons()
|
// To use the extra button you need to override GetDialogButtons()
|
||||||
virtual int GetDialogButtons() const {
|
virtual int GetDialogButtons() const;
|
||||||
return ui::MessageBoxFlags::DIALOGBUTTON_OK |
|
|
||||||
ui::MessageBoxFlags::DIALOGBUTTON_CANCEL;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Returns whether accelerators are enabled on the button. This is invoked
|
// Returns whether accelerators are enabled on the button. This is invoked
|
||||||
// when an accelerator is pressed, not at construction time. This
|
// when an accelerator is pressed, not at construction time. This
|
||||||
// returns true.
|
// returns true.
|
||||||
virtual bool AreAcceleratorsEnabled(
|
virtual bool AreAcceleratorsEnabled(
|
||||||
ui::MessageBoxFlags::DialogButton button) {
|
ui::MessageBoxFlags::DialogButton button);
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Returns the label of the specified DialogButton.
|
// Returns the label of the specified DialogButton.
|
||||||
virtual std::wstring GetDialogButtonLabel(
|
virtual std::wstring GetDialogButtonLabel(
|
||||||
ui::MessageBoxFlags::DialogButton button) const {
|
ui::MessageBoxFlags::DialogButton button) const;
|
||||||
// empty string results in defaults for
|
|
||||||
// ui::MessageBoxFlags::DIALOGBUTTON_OK,
|
|
||||||
// ui::MessageBoxFlags::DIALOGBUTTON_CANCEL.
|
|
||||||
return L"";
|
|
||||||
}
|
|
||||||
|
|
||||||
// Override this function if with a view which will be shown in the same
|
// 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
|
// row as the OK and CANCEL buttons but flush to the left and extending
|
||||||
// up to the buttons.
|
// 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
|
// 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
|
// the buttons. The default (false) is to give the extra view it's preferred
|
||||||
// height. By returning true the height becomes
|
// height. By returning true the height becomes
|
||||||
// max(extra_view preferred height, buttons preferred height).
|
// 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
|
// Returns the default dialog button. This should not be a mask as only
|
||||||
// one button should ever be the default button. Return
|
// 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.
|
// Returns whether the specified dialog button is enabled.
|
||||||
virtual bool IsDialogButtonEnabled(
|
virtual bool IsDialogButtonEnabled(
|
||||||
ui::MessageBoxFlags::DialogButton button) const {
|
ui::MessageBoxFlags::DialogButton button) const;
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Returns whether the specified dialog button is visible.
|
// Returns whether the specified dialog button is visible.
|
||||||
virtual bool IsDialogButtonVisible(
|
virtual bool IsDialogButtonVisible(
|
||||||
ui::MessageBoxFlags::DialogButton button) const {
|
ui::MessageBoxFlags::DialogButton button) const;
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// For Dialog boxes, if there is a "Cancel" button, this is called when the
|
// 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
|
// 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
|
// 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
|
// true if the window can be closed after it returns, or false if it must
|
||||||
// remain open.
|
// remain open.
|
||||||
virtual bool Cancel() { return true; }
|
virtual bool Cancel();
|
||||||
|
|
||||||
// For Dialog boxes, this is called when the user presses the "OK" button,
|
// 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
|
// 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
|
// 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,
|
// being closed (e.g. by Window::Close) and there is no Cancel handler,
|
||||||
// so Accept is being called instead.
|
// so Accept is being called instead.
|
||||||
virtual bool Accept(bool window_closing) { return Accept(); }
|
virtual bool Accept(bool window_closing);
|
||||||
virtual bool Accept() { return true; }
|
virtual bool Accept();
|
||||||
|
|
||||||
// Overridden from WindowDelegate:
|
// Overridden from WindowDelegate:
|
||||||
virtual View* GetInitiallyFocusedView();
|
virtual View* GetInitiallyFocusedView();
|
||||||
@@ -124,9 +110,7 @@ class DialogDelegate : public WindowDelegate {
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
// Overridden from WindowDelegate:
|
// Overridden from WindowDelegate:
|
||||||
AccessibilityTypes::Role accessible_role() const {
|
virtual AccessibilityTypes::Role accessible_role() const;
|
||||||
return AccessibilityTypes::ROLE_DIALOG;
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace views
|
} // namespace views
|
||||||
|
@@ -181,6 +181,14 @@ AccessibilityTypes::Role NonClientView::GetAccessibleRole() {
|
|||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
// NonClientFrameView, View overrides:
|
// NonClientFrameView, View overrides:
|
||||||
|
|
||||||
|
bool NonClientFrameView::AlwaysUseCustomFrame() const {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool NonClientFrameView::AlwaysUseNativeFrame() const {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
bool NonClientFrameView::HitTest(const gfx::Point& l) const {
|
bool NonClientFrameView::HitTest(const gfx::Point& l) const {
|
||||||
// For the default case, we assume the non-client frame view never overlaps
|
// For the default case, we assume the non-client frame view never overlaps
|
||||||
// the client view.
|
// the client view.
|
||||||
|
@@ -48,12 +48,12 @@ class NonClientFrameView : public View {
|
|||||||
// Returns true if this FrameView should always use the custom frame,
|
// Returns true if this FrameView should always use the custom frame,
|
||||||
// regardless of the system settings. An example is the Constrained Window,
|
// regardless of the system settings. An example is the Constrained Window,
|
||||||
// which is a child window and must always provide its own frame.
|
// 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
|
// Like AlwaysUseCustomFrame, returns true if this FrameView should always use
|
||||||
// the native frame, regardless of theme settings. An example is popup/app
|
// the native frame, regardless of theme settings. An example is popup/app
|
||||||
// windows, which we do not ever want to show themed.
|
// windows, which we do not ever want to show themed.
|
||||||
virtual bool AlwaysUseNativeFrame() const { return false; }
|
virtual bool AlwaysUseNativeFrame() const;
|
||||||
|
|
||||||
virtual gfx::Rect GetWindowBoundsForClientBounds(
|
virtual gfx::Rect GetWindowBoundsForClientBounds(
|
||||||
const gfx::Rect& client_bounds) const = 0;
|
const gfx::Rect& client_bounds) const = 0;
|
||||||
|
@@ -49,4 +49,8 @@ void Window::CloseSecondaryWidget(Widget* widget) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool Window::IsAppWindow() const {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace views
|
} // namespace views
|
||||||
|
@@ -138,7 +138,7 @@ class Window {
|
|||||||
// Returns true if the Window is considered to be an "app window" - i.e.
|
// 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
|
// any window which when it is the last of its type closed causes the
|
||||||
// application to exit.
|
// 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
|
// Toggles the enable state for the Close button (and the Close menu item in
|
||||||
// the system menu).
|
// the system menu).
|
||||||
|
@@ -16,6 +16,50 @@ WindowDelegate::WindowDelegate() : window_(NULL) {
|
|||||||
WindowDelegate::~WindowDelegate() {
|
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() {
|
SkBitmap WindowDelegate::GetWindowAppIcon() {
|
||||||
// Use the window icon as app icon by default.
|
// Use the window icon as app icon by default.
|
||||||
return GetWindowIcon();
|
return GetWindowIcon();
|
||||||
@@ -26,6 +70,18 @@ SkBitmap WindowDelegate::GetWindowIcon() {
|
|||||||
return SkBitmap();
|
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,
|
void WindowDelegate::SaveWindowPlacement(const gfx::Rect& bounds,
|
||||||
bool maximized) {
|
bool maximized) {
|
||||||
std::wstring window_name = GetWindowName();
|
std::wstring window_name = GetWindowName();
|
||||||
@@ -58,6 +114,10 @@ bool WindowDelegate::ShouldRestoreWindowSize() const {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
View* WindowDelegate::GetContentsView() {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
ClientView* WindowDelegate::CreateClientView(Window* window) {
|
ClientView* WindowDelegate::CreateClientView(Window* window) {
|
||||||
return new ClientView(window, GetContentsView());
|
return new ClientView(window, GetContentsView());
|
||||||
}
|
}
|
||||||
|
@@ -38,55 +38,37 @@ class WindowDelegate {
|
|||||||
WindowDelegate();
|
WindowDelegate();
|
||||||
virtual ~WindowDelegate();
|
virtual ~WindowDelegate();
|
||||||
|
|
||||||
virtual DialogDelegate* AsDialogDelegate() { return NULL; }
|
virtual DialogDelegate* AsDialogDelegate();
|
||||||
|
|
||||||
// Returns true if the window can ever be resized.
|
// Returns true if the window can ever be resized.
|
||||||
virtual bool CanResize() const {
|
virtual bool CanResize() const;
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Returns true if the window can ever be maximized.
|
// Returns true if the window can ever be maximized.
|
||||||
virtual bool CanMaximize() const {
|
virtual bool CanMaximize() const;
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Returns true if the dialog should be displayed modally to the window that
|
// Returns true if the dialog should be displayed modally to the window that
|
||||||
// opened it. Only windows with WindowType == DIALOG can be modal.
|
// opened it. Only windows with WindowType == DIALOG can be modal.
|
||||||
virtual bool IsModal() const {
|
virtual bool IsModal() const;
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
virtual AccessibilityTypes::Role accessible_role() const {
|
virtual AccessibilityTypes::Role accessible_role() const;
|
||||||
return AccessibilityTypes::ROLE_WINDOW;
|
|
||||||
}
|
|
||||||
|
|
||||||
virtual AccessibilityTypes::State accessible_state() const {
|
virtual AccessibilityTypes::State accessible_state() const;
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Returns the title to be read with screen readers.
|
// Returns the title to be read with screen readers.
|
||||||
virtual std::wstring GetAccessibleWindowTitle() const {
|
virtual std::wstring GetAccessibleWindowTitle() const;
|
||||||
return GetWindowTitle();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Returns the text to be displayed in the window title.
|
// Returns the text to be displayed in the window title.
|
||||||
virtual std::wstring GetWindowTitle() const {
|
virtual std::wstring GetWindowTitle() const;
|
||||||
return L"";
|
|
||||||
}
|
|
||||||
|
|
||||||
// Returns the view that should have the focus when the dialog is opened. If
|
// Returns the view that should have the focus when the dialog is opened. If
|
||||||
// NULL no view is focused.
|
// 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.
|
// Returns true if the window should show a title in the title bar.
|
||||||
virtual bool ShouldShowWindowTitle() const {
|
virtual bool ShouldShowWindowTitle() const;
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Returns true if the window's client view wants a client edge.
|
// Returns true if the window's client view wants a client edge.
|
||||||
virtual bool ShouldShowClientEdge() const {
|
virtual bool ShouldShowClientEdge() const;
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Returns the app icon for the window. On Windows, this is the ICON_BIG used
|
// Returns the app icon for the window. On Windows, this is the ICON_BIG used
|
||||||
// in Alt-Tab list and Win7's taskbar.
|
// in Alt-Tab list and Win7's taskbar.
|
||||||
@@ -96,19 +78,15 @@ class WindowDelegate {
|
|||||||
virtual SkBitmap GetWindowIcon();
|
virtual SkBitmap GetWindowIcon();
|
||||||
|
|
||||||
// Returns true if a window icon should be shown.
|
// Returns true if a window icon should be shown.
|
||||||
virtual bool ShouldShowWindowIcon() const {
|
virtual bool ShouldShowWindowIcon() const;
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Execute a command in the window's controller. Returns true if the command
|
// Execute a command in the window's controller. Returns true if the command
|
||||||
// was handled, false if it was not.
|
// 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
|
// Returns the window's name identifier. Used to identify this window for
|
||||||
// state restoration.
|
// state restoration.
|
||||||
virtual std::wstring GetWindowName() const {
|
virtual std::wstring GetWindowName() const;
|
||||||
return std::wstring();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Saves the window's bounds and maximized states. By default this uses the
|
// Saves the window's bounds and maximized states. By default this uses the
|
||||||
// process' local state keyed by window name (See GetWindowName above). This
|
// process' local state keyed by window name (See GetWindowName above). This
|
||||||
@@ -135,9 +113,7 @@ class WindowDelegate {
|
|||||||
virtual void DeleteDelegate() {}
|
virtual void DeleteDelegate() {}
|
||||||
|
|
||||||
// Returns the View that is contained within this Window.
|
// Returns the View that is contained within this Window.
|
||||||
virtual View* GetContentsView() {
|
virtual View* GetContentsView();
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Called by the Window to create the Client View used to host the contents
|
// Called by the Window to create the Client View used to host the contents
|
||||||
// of the window.
|
// of the window.
|
||||||
|
@@ -269,6 +269,14 @@ void WindowGtk::FrameTypeChanged() {
|
|||||||
ThemeChanged();
|
ThemeChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Window* WindowGtk::AsWindow() {
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
const Window* WindowGtk::AsWindow() const {
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
// WindowGtk, WidgetGtk overrides:
|
// WindowGtk, WidgetGtk overrides:
|
||||||
|
|
||||||
|
@@ -60,8 +60,8 @@ class WindowGtk : public WidgetGtk, public Window {
|
|||||||
virtual bool ShouldUseNativeFrame() const;
|
virtual bool ShouldUseNativeFrame() const;
|
||||||
virtual void FrameTypeChanged();
|
virtual void FrameTypeChanged();
|
||||||
|
|
||||||
virtual Window* AsWindow() { return this; }
|
virtual Window* AsWindow();
|
||||||
virtual const Window* AsWindow() const { return this; }
|
virtual const Window* AsWindow() const;
|
||||||
|
|
||||||
// Overridden from WidgetGtk:
|
// Overridden from WidgetGtk:
|
||||||
virtual gboolean OnButtonPress(GtkWidget* widget, GdkEventButton* event);
|
virtual gboolean OnButtonPress(GtkWidget* widget, GdkEventButton* event);
|
||||||
|
Reference in New Issue
Block a user