Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(478)

Unified Diff: views/window/dialog_client_view.cc

Issue 115957: Make DialogClientView compile on Linux. (Closed) Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: '' Created 11 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « views/views.gyp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: views/window/dialog_client_view.cc
===================================================================
--- views/window/dialog_client_view.cc (revision 17205)
+++ views/window/dialog_client_view.cc (working copy)
@@ -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 @@
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 @@
: 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 @@
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 @@
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 @@
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 @@
// 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 @@
}
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::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 @@
gfx::NativeTheme::instance()->PaintStatusGripper(
dc, SP_PANE, 1, 0, &native_bounds);
canvas->endPlatformPaint();
+#else
+ NOTIMPLEMENTED();
+ // TODO(port): paint size box
+#endif
}
}
« no previous file with comments | « views/views.gyp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698