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

Side by Side Diff: gfx/window_impl.h

Issue 6019007: Remove win_util::FormatMessage and FormatLastWin32Error. These were only used... (Closed) Base URL: svn://chrome-svn/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 | « gfx/gfx.gyp ('k') | gfx/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 GFX_WINDOW_IMPL_H_
6 #define GFX_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 gfx {
21
22 // An interface implemented by classes that use message maps.
23 // ProcessWindowMessage is implemented by the BEGIN_MESSAGE_MAP_EX macro.
24 class MessageMapInterface {
25 public:
26 // Processes one message from the window's message queue.
27 virtual BOOL ProcessWindowMessage(HWND window,
28 UINT message,
29 WPARAM w_param,
30 LPARAM l_param,
31 LRESULT& result,
32 DWORD msg_mad_id = 0) = 0;
33 };
34
35 ///////////////////////////////////////////////////////////////////////////////
36 //
37 // WindowImpl
38 // A convenience class that encapsulates the details of creating and
39 // destroying a HWND. This class also hosts the windows procedure used by all
40 // Windows.
41 //
42 ///////////////////////////////////////////////////////////////////////////////
43 class WindowImpl : public MessageMapInterface {
44 public:
45 WindowImpl();
46 virtual ~WindowImpl();
47
48 // Initializes the Window with a parent and an initial desired size.
49 void Init(HWND parent, const gfx::Rect& bounds);
50
51 // Retrieves the default window icon to use for windows if none is specified.
52 virtual HICON GetDefaultWindowIcon() const;
53
54 // Returns the HWND associated with this Window.
55 HWND hwnd() const { return hwnd_; }
56
57 // Sets the window styles. This is ONLY used when the window is created.
58 // In other words, if you invoke this after invoking Init, nothing happens.
59 void set_window_style(DWORD style) { window_style_ = style; }
60 DWORD window_style() const { return window_style_; }
61
62 // Sets the extended window styles. See comment about |set_window_style|.
63 void set_window_ex_style(DWORD style) { window_ex_style_ = style; }
64 DWORD window_ex_style() const { return window_ex_style_; }
65
66 // Sets the class style to use. The default is CS_DBLCLKS.
67 void set_initial_class_style(UINT class_style) {
68 // We dynamically generate the class name, so don't register it globally!
69 DCHECK_EQ((class_style & CS_GLOBALCLASS), 0u);
70 class_style_ = class_style;
71 }
72 UINT initial_class_style() const { return class_style_; }
73
74 // Returns true if the specified |hwnd| is a WindowImpl.
75 static bool IsWindowImpl(HWND hwnd);
76
77 protected:
78 // Handles the WndProc callback for this object.
79 virtual LRESULT OnWndProc(UINT message, WPARAM w_param, LPARAM l_param);
80
81 private:
82 friend class ClassRegistrar;
83
84 // The window procedure used by all Windows.
85 static LRESULT CALLBACK WndProc(HWND window,
86 UINT message,
87 WPARAM w_param,
88 LPARAM l_param);
89
90 // Gets the window class name to use when creating the corresponding HWND.
91 // If necessary, this registers the window class.
92 std::wstring GetWindowClassName();
93
94 // All classes registered by WidgetWin start with this name.
95 static const wchar_t* const kBaseClassName;
96
97 // Window Styles used when creating the window.
98 DWORD window_style_;
99
100 // Window Extended Styles used when creating the window.
101 DWORD window_ex_style_;
102
103 // Style of the class to use.
104 UINT class_style_;
105
106 // Our hwnd.
107 HWND hwnd_;
108
109 DISALLOW_COPY_AND_ASSIGN(WindowImpl);
110 };
111
112 } // namespace gfx
113
114 #endif // GFX_WINDOW_IMPL_H_
OLDNEW
« no previous file with comments | « gfx/gfx.gyp ('k') | gfx/window_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698