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.
5 #ifndef CHROME_BROWSER_STATUS_VIEW_H__
6 #define CHROME_BROWSER_STATUS_VIEW_H__
15 #include "base/basictypes.h"
16 #include "chrome/browser/tab_contents.h"
18 typedef CWinTraits
<WS_CHILD
| WS_CLIPCHILDREN
| WS_CLIPSIBLINGS
>
21 // A base class for about:network, about:ipc etc. It handles creating a row of
22 // buttons at the top of the page. Derived classes get a rect of the remaining
23 // area and can create their own controls there.
24 class StatusView
: public TabContents
,
25 public CWindowImpl
<StatusView
, CWindow
, StatusViewTraits
> {
27 StatusView(TabContentsType type
);
29 BEGIN_MSG_MAP(StatusView
)
30 MSG_WM_CREATE(OnCreate
)
31 MSG_WM_ERASEBKGND(OnEraseBkgnd
)
35 virtual void CreateView(HWND parent_hwnd
, const gfx::Rect
& initial_bounds
);
36 virtual HWND
GetContainerHWND() const { return m_hWnd
; }
38 // Derived classes should implement the following functions
39 // TabContents override, to set the page title.
40 // virtual const std::wstring GetDefaultTitle() = 0;
41 // Gives a rect whose top left corner is after the buttons. The size of the
42 // controls that are added by derived classes will be set in the next OnSize,
43 // for now can use any height/width.
44 virtual void OnCreate(const CRect
& rect
) = 0;
45 virtual void OnSize(const CRect
& rect
) = 0;
48 // Should be deleted via CloseContents.
49 virtual ~StatusView();
51 // Creates and adds a button to the top row of the page. Button ids should
52 // be unique and start at 101.
53 void CreateButton(int id
, const wchar_t* title
);
54 void SetButtonText(int id
, const wchar_t* title
);
56 static const int kLayoutPadding
;
57 static const int kButtonWidth
;
58 static const int kButtonHeight
;
61 // FocusTraversal Implementation
62 // TODO (jcampan): make focus traversal work
63 ChromeViews::View
* FindNextFocusableView(ChromeViews::View
* starting_view
,
64 bool reverse
, bool dont_loop
) {
69 LRESULT
OnCreate(LPCREATESTRUCT create_struct
);
70 void OnSize(UINT size_command
, const CSize
& new_size
);
71 LRESULT
OnEraseBkgnd(HDC hdc
);
78 std::vector
<ButtonInfo
> buttons_
;
80 DISALLOW_EVIL_CONSTRUCTORS(StatusView
);
83 #endif // #ifndef CHROME_BROWSER_STATUS_VIEW_H__