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

Side by Side Diff: app/win/window_impl.h

Issue 6254011: Move UI-relevant Windows files to ui/base. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 11 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « app/win/hwnd_util.cc ('k') | app/win/window_impl.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef APP_WIN_WINDOW_IMPL_H_
6 #define APP_WIN_WINDOW_IMPL_H_
7 #pragma once
8
9 #include <atlbase.h>
10 #include <atlapp.h>
11 #include <atlmisc.h>
12 #include <atlcrack.h>
13
14 #include <string>
15
16 #include "base/logging.h"
17 #include "gfx/native_widget_types.h"
18 #include "gfx/rect.h"
19
20 namespace app {
21 namespace win {
22
23 // An interface implemented by classes that use message maps.
24 // ProcessWindowMessage is implemented by the BEGIN_MESSAGE_MAP_EX macro.
25 class MessageMapInterface {
26 public:
27 // Processes one message from the window's message queue.
28 virtual BOOL ProcessWindowMessage(HWND window,
29 UINT message,
30 WPARAM w_param,
31 LPARAM l_param,
32 LRESULT& result,
33 DWORD msg_mad_id = 0) = 0;
34 };
35
36 ///////////////////////////////////////////////////////////////////////////////
37 //
38 // WindowImpl
39 // A convenience class that encapsulates the details of creating and
40 // destroying a HWND. This class also hosts the windows procedure used by all
41 // Windows.
42 //
43 ///////////////////////////////////////////////////////////////////////////////
44 class WindowImpl : public MessageMapInterface {
45 public:
46 WindowImpl();
47 virtual ~WindowImpl();
48
49 // Initializes the Window with a parent and an initial desired size.
50 void Init(HWND parent, const gfx::Rect& bounds);
51
52 // Retrieves the default window icon to use for windows if none is specified.
53 virtual HICON GetDefaultWindowIcon() const;
54
55 // Returns the HWND associated with this Window.
56 HWND hwnd() const { return hwnd_; }
57
58 // Sets the window styles. This is ONLY used when the window is created.
59 // In other words, if you invoke this after invoking Init, nothing happens.
60 void set_window_style(DWORD style) { window_style_ = style; }
61 DWORD window_style() const { return window_style_; }
62
63 // Sets the extended window styles. See comment about |set_window_style|.
64 void set_window_ex_style(DWORD style) { window_ex_style_ = style; }
65 DWORD window_ex_style() const { return window_ex_style_; }
66
67 // Sets the class style to use. The default is CS_DBLCLKS.
68 void set_initial_class_style(UINT class_style) {
69 // We dynamically generate the class name, so don't register it globally!
70 DCHECK_EQ((class_style & CS_GLOBALCLASS), 0u);
71 class_style_ = class_style;
72 }
73 UINT initial_class_style() const { return class_style_; }
74
75 // Returns true if the specified |hwnd| is a WindowImpl.
76 static bool IsWindowImpl(HWND hwnd);
77
78 protected:
79 // Handles the WndProc callback for this object.
80 virtual LRESULT OnWndProc(UINT message, WPARAM w_param, LPARAM l_param);
81
82 private:
83 friend class ClassRegistrar;
84
85 // The window procedure used by all Windows.
86 static LRESULT CALLBACK WndProc(HWND window,
87 UINT message,
88 WPARAM w_param,
89 LPARAM l_param);
90
91 // Gets the window class name to use when creating the corresponding HWND.
92 // If necessary, this registers the window class.
93 std::wstring GetWindowClassName();
94
95 // All classes registered by WidgetWin start with this name.
96 static const wchar_t* const kBaseClassName;
97
98 // Window Styles used when creating the window.
99 DWORD window_style_;
100
101 // Window Extended Styles used when creating the window.
102 DWORD window_ex_style_;
103
104 // Style of the class to use.
105 UINT class_style_;
106
107 // Our hwnd.
108 HWND hwnd_;
109
110 DISALLOW_COPY_AND_ASSIGN(WindowImpl);
111 };
112
113 } // namespace win
114 } // namespace app
115
116 #endif // APP_WIN_WINDOW_IMPL_H_
OLDNEW
« no previous file with comments | « app/win/hwnd_util.cc ('k') | app/win/window_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698