| OLD | NEW |
| (Empty) |
| 1 // Copyright (c) 2006-2008 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 CHROME_VIEWS_CUSTOM_FRAME_WINDOW_H__ | |
| 6 #define CHROME_VIEWS_CUSTOM_FRAME_WINDOW_H__ | |
| 7 | |
| 8 #include "chrome/common/gfx/chrome_canvas.h" | |
| 9 #include "chrome/views/window.h" | |
| 10 #include "chrome/views/window_delegate.h" | |
| 11 | |
| 12 namespace views { | |
| 13 | |
| 14 class NonClientView; | |
| 15 | |
| 16 //////////////////////////////////////////////////////////////////////////////// | |
| 17 // | |
| 18 // CustomFrameWindow | |
| 19 // | |
| 20 // A CustomFrameWindow is a Window subclass that implements the Chrome-style | |
| 21 // window frame used on Windows XP and Vista without DWM Composition. | |
| 22 // See documentation in window.h for more information about the capabilities | |
| 23 // of this window type. | |
| 24 // | |
| 25 //////////////////////////////////////////////////////////////////////////////// | |
| 26 class CustomFrameWindow : public Window { | |
| 27 public: | |
| 28 explicit CustomFrameWindow(WindowDelegate* window_delegate); | |
| 29 CustomFrameWindow(WindowDelegate* window_delegate, | |
| 30 NonClientView* non_client_view); | |
| 31 virtual ~CustomFrameWindow(); | |
| 32 | |
| 33 // Returns whether or not the frame is active. | |
| 34 bool is_active() const { return is_active_; } | |
| 35 | |
| 36 // Overridden from Window: | |
| 37 virtual void Init(HWND parent, const gfx::Rect& bounds); | |
| 38 virtual void UpdateWindowTitle(); | |
| 39 virtual void UpdateWindowIcon(); | |
| 40 | |
| 41 protected: | |
| 42 // Overridden from Window: | |
| 43 virtual void SizeWindowToDefault(); | |
| 44 virtual void EnableClose(bool enable); | |
| 45 virtual void DisableInactiveRendering(bool disable); | |
| 46 | |
| 47 // Overridden from WidgetWin: | |
| 48 virtual void OnInitMenu(HMENU menu); | |
| 49 virtual void OnMouseLeave(); | |
| 50 virtual LRESULT OnNCActivate(BOOL active); | |
| 51 virtual LRESULT OnNCCalcSize(BOOL mode, LPARAM l_param); | |
| 52 virtual LRESULT OnNCHitTest(const CPoint& point); | |
| 53 virtual void OnNCPaint(HRGN rgn); | |
| 54 virtual void OnNCLButtonDown(UINT ht_component, const CPoint& point); | |
| 55 virtual LRESULT OnNCUAHDrawCaption(UINT msg, WPARAM w_param, LPARAM l_param); | |
| 56 virtual LRESULT OnNCUAHDrawFrame(UINT msg, WPARAM w_param, LPARAM l_param); | |
| 57 virtual LRESULT OnSetCursor(HWND window, UINT hittest_code, UINT message); | |
| 58 virtual LRESULT OnSetIcon(UINT size_type, HICON new_icon); | |
| 59 virtual LRESULT OnSetText(const wchar_t* text); | |
| 60 virtual void OnSize(UINT param, const CSize& size); | |
| 61 virtual void OnSysCommand(UINT notification_code, CPoint click); | |
| 62 | |
| 63 private: | |
| 64 class ScopedRedrawLock; | |
| 65 | |
| 66 // Lock or unlock the window from being able to redraw itself in response to | |
| 67 // updates to its invalid region. | |
| 68 void LockUpdates(); | |
| 69 void UnlockUpdates(); | |
| 70 | |
| 71 // Resets the window region. | |
| 72 void ResetWindowRegion(); | |
| 73 | |
| 74 // Converts a non-client mouse down message to a regular ChromeViews event | |
| 75 // and handle it. |point| is the mouse position of the message in screen | |
| 76 // coords. |flags| are flags that would be passed with a WM_L/M/RBUTTON* | |
| 77 // message and relate to things like which button was pressed. These are | |
| 78 // combined with flags relating to the current key state. | |
| 79 void ProcessNCMousePress(const CPoint& point, int flags); | |
| 80 | |
| 81 // True if this window is the active top level window. | |
| 82 bool is_active_; | |
| 83 | |
| 84 // True if updates to this window are currently locked. | |
| 85 bool lock_updates_; | |
| 86 | |
| 87 // The window styles of the window before updates were locked. | |
| 88 DWORD saved_window_style_; | |
| 89 | |
| 90 // Static resource initialization. | |
| 91 static void InitClass(); | |
| 92 enum ResizeCursor { | |
| 93 RC_NORMAL = 0, RC_VERTICAL, RC_HORIZONTAL, RC_NESW, RC_NWSE | |
| 94 }; | |
| 95 static HCURSOR resize_cursors_[6]; | |
| 96 | |
| 97 DISALLOW_EVIL_CONSTRUCTORS(CustomFrameWindow); | |
| 98 }; | |
| 99 | |
| 100 } // namespace views | |
| 101 | |
| 102 #endif // CHROME_VIEWS_CUSTOM_FRAME_WINDOW_H__ | |
| 103 | |
| OLD | NEW |