diff options
author | ben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-05-29 22:40:33 +0000 |
---|---|---|
committer | ben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-05-29 22:40:33 +0000 |
commit | 5ba558427115a9038b377c912e56c2f24cdef03b (patch) | |
tree | 5b17cb07c12e7055e3f25ce8c204c8846893dbbd /views/window | |
parent | 26a4b2702bd44b32e422aaa6ccff6d071c5210b6 (diff) | |
download | chromium_src-5ba558427115a9038b377c912e56c2f24cdef03b.zip chromium_src-5ba558427115a9038b377c912e56c2f24cdef03b.tar.gz chromium_src-5ba558427115a9038b377c912e56c2f24cdef03b.tar.bz2 |
Make DialogClientView compile on Linux.
BUG=none
TEST=none
Review URL: http://codereview.chromium.org/115957
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@17250 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'views/window')
-rw-r--r-- | views/window/dialog_client_view.cc | 43 |
1 files changed, 41 insertions, 2 deletions
diff --git a/views/window/dialog_client_view.cc b/views/window/dialog_client_view.cc index 9650f26..f59831e 100644 --- a/views/window/dialog_client_view.cc +++ b/views/window/dialog_client_view.cc @@ -4,19 +4,26 @@ #include "views/window/dialog_client_view.h" +#if defined(OS_WIN) #include <windows.h> #include <uxtheme.h> #include <vsstyle.h> +#endif #include "app/gfx/canvas.h" #include "app/gfx/font.h" #include "app/l10n_util.h" #include "app/resource_bundle.h" +#if defined(OS_WIN) #include "base/gfx/native_theme.h" +#endif #include "grit/app_strings.h" #include "views/controls/button/native_button.h" #include "views/standard_layout.h" #include "views/window/dialog_delegate.h" +#if !defined(OS_WIN) +#include "views/window/hit_test.h" +#endif #include "views/window/window.h" namespace views { @@ -34,11 +41,13 @@ void UpdateButtonHelper(NativeButton* button_view, button_view->SetVisible(delegate->IsDialogButtonVisible(button)); } +#if defined(OS_WIN) void FillViewWithSysColor(gfx::Canvas* canvas, View* view, COLORREF color) { SkColor sk_color = SkColorSetRGB(GetRValue(color), GetGValue(color), GetBValue(color)); canvas->FillRectInt(sk_color, 0, 0, view->width(), view->height()); } +#endif // DialogButton ---------------------------------------------------------------- @@ -93,9 +102,9 @@ DialogClientView::DialogClientView(Window* owner, View* contents_view) : ClientView(owner, contents_view), ok_button_(NULL), cancel_button_(NULL), + default_button_(NULL), extra_view_(NULL), - accepted_(false), - default_button_(NULL) { + accepted_(false) { InitClass(); } @@ -118,8 +127,13 @@ void DialogClientView::ShowDialogButtons() { ok_button_->SetGroup(kButtonGroup); if (is_default_button) default_button_ = ok_button_; +#if defined(OS_WIN) if (!(buttons & MessageBoxFlags::DIALOGBUTTON_CANCEL)) ok_button_->AddAccelerator(Accelerator(VK_ESCAPE, false, false, false)); +#else + NOTIMPLEMENTED(); + // TODO(port): add accelerators +#endif AddChildView(ok_button_); } if (buttons & MessageBoxFlags::DIALOGBUTTON_CANCEL && !cancel_button_) { @@ -139,7 +153,12 @@ void DialogClientView::ShowDialogButtons() { MessageBoxFlags::DIALOGBUTTON_CANCEL, label, is_default_button); cancel_button_->SetGroup(kButtonGroup); +#if defined(OS_WIN) cancel_button_->AddAccelerator(Accelerator(VK_ESCAPE, false, false, false)); +#else + NOTIMPLEMENTED(); + // TODO(port): add accelerators +#endif if (is_default_button) default_button_ = ok_button_; AddChildView(cancel_button_); @@ -147,7 +166,12 @@ void DialogClientView::ShowDialogButtons() { if (!buttons) { // Register the escape key as an accelerator which will close the window // if there are no dialog buttons. +#if defined(OS_WIN) AddAccelerator(Accelerator(VK_ESCAPE, false, false, false)); +#else + NOTIMPLEMENTED(); + // TODO(port): add accelerators +#endif } } @@ -251,7 +275,12 @@ int DialogClientView::NonClientHitTest(const gfx::Point& point) { // DialogClientView, View overrides: void DialogClientView::Paint(gfx::Canvas* canvas) { +#if defined(OS_WIN) FillViewWithSysColor(canvas, this, GetSysColor(COLOR_3DFACE)); +#else + NOTIMPLEMENTED(); + // TODO(port): paint dialog background color +#endif } void DialogClientView::PaintChildren(gfx::Canvas* canvas) { @@ -326,7 +355,12 @@ gfx::Size DialogClientView::GetPreferredSize() { } bool DialogClientView::AcceleratorPressed(const Accelerator& accelerator) { +#if defined(OS_WIN) DCHECK(accelerator.GetKeyCode() == VK_ESCAPE); // We only expect Escape key. +#else + NOTIMPLEMENTED(); + // TODO(port): add accelerators +#endif Close(); return true; } @@ -350,6 +384,7 @@ void DialogClientView::ButtonPressed(Button* sender) { void DialogClientView::PaintSizeBox(gfx::Canvas* canvas) { if (window()->GetDelegate()->CanResize() || window()->GetDelegate()->CanMaximize()) { +#if defined(OS_WIN) HDC dc = canvas->beginPlatformPaint(); SIZE gripper_size = { 0, 0 }; gfx::NativeTheme::instance()->GetThemePartSize( @@ -367,6 +402,10 @@ void DialogClientView::PaintSizeBox(gfx::Canvas* canvas) { gfx::NativeTheme::instance()->PaintStatusGripper( dc, SP_PANE, 1, 0, &native_bounds); canvas->endPlatformPaint(); +#else + NOTIMPLEMENTED(); + // TODO(port): paint size box +#endif } } |