| 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 VIEWS_CONTROLS_HWND_VIEW_H_ | |
| 6 #define VIEWS_CONTROLS_HWND_VIEW_H_ | |
| 7 | |
| 8 #include <string> | |
| 9 | |
| 10 #include "views/controls/native_view_host.h" | |
| 11 | |
| 12 namespace views { | |
| 13 | |
| 14 ///////////////////////////////////////////////////////////////////////////// | |
| 15 // | |
| 16 // HWNDView class | |
| 17 // | |
| 18 // The HWNDView class hosts a native window handle (HWND) sizing it | |
| 19 // according to the bounds of the view. This is useful whenever you need to | |
| 20 // show a UI control that has a HWND (e.g. a native windows Edit control) | |
| 21 // within thew View hierarchy and benefit from the sizing/layout. | |
| 22 // | |
| 23 ///////////////////////////////////////////////////////////////////////////// | |
| 24 // TODO: Rename this to NativeViewHostWin. | |
| 25 class HWNDView : public NativeViewHost { | |
| 26 public: | |
| 27 HWNDView(); | |
| 28 virtual ~HWNDView(); | |
| 29 | |
| 30 // Attach a window handle to this View, making the window it represents | |
| 31 // subject to sizing according to this View's parent container's Layout | |
| 32 // Manager's sizing heuristics. | |
| 33 // | |
| 34 // This object should be added to the view hierarchy before calling this | |
| 35 // function, which will expect the parent to be valid. | |
| 36 void Attach(HWND hwnd); | |
| 37 | |
| 38 // Detach the attached window handle. It will no longer be updated | |
| 39 void Detach(); | |
| 40 | |
| 41 // TODO(sky): convert this to native_view(). | |
| 42 HWND GetHWND() const { return native_view(); } | |
| 43 | |
| 44 virtual void Paint(gfx::Canvas* canvas); | |
| 45 | |
| 46 // Overridden from View. | |
| 47 virtual std::string GetClassName() const; | |
| 48 | |
| 49 protected: | |
| 50 virtual void ViewHierarchyChanged(bool is_add, View *parent, View *child); | |
| 51 | |
| 52 virtual void Focus(); | |
| 53 | |
| 54 // NativeHostView overrides. | |
| 55 virtual void InstallClip(int x, int y, int w, int h); | |
| 56 virtual void UninstallClip(); | |
| 57 virtual void ShowWidget(int x, int y, int w, int h); | |
| 58 virtual void HideWidget(); | |
| 59 | |
| 60 private: | |
| 61 DISALLOW_COPY_AND_ASSIGN(HWNDView); | |
| 62 }; | |
| 63 | |
| 64 } // namespace views | |
| 65 | |
| 66 #endif // VIEWS_CONTROLS_HWND_VIEW_H_ | |
| OLD | NEW |