summaryrefslogtreecommitdiffstats
path: root/ash/shell/panel_window.h
blob: ffa765ce7442744ed5ee7a230a12d20e285a8235 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef ASH_SHELL_PANEL_WINDOW_H_
#define ASH_SHELL_PANEL_WINDOW_H_

#include "base/basictypes.h"
#include "ui/aura/aura_export.h"
#include "ui/views/widget/widget.h"
#include "ui/views/widget/widget_delegate.h"

namespace ash {

class PanelFrameView;

// Example Class for panel windows (Widget::InitParams::TYPE_PANEL).
// Instances of PanelWindow will get added to the PanelContainer top level
// window which manages the panel layout through PanelLayoutManager.
class PanelWindow : public views::WidgetDelegateView {
 public:
  explicit PanelWindow(const std::string& name);
  virtual ~PanelWindow();

  // Creates the widget for the panel window using |params_|.
  views::Widget* CreateWidget();

  const std::string& name() { return name_; }
  views::Widget::InitParams& params() { return params_; }

  // Creates a panel window and returns the associated widget.
  static views::Widget* CreatePanelWindow(const gfx::Rect& rect);

 private:
  // Overridden from views::View:
  virtual gfx::Size GetPreferredSize() const override;
  virtual void OnPaint(gfx::Canvas* canvas) override;

  // Overridden from views::WidgetDelegate:
  virtual base::string16 GetWindowTitle() const override;
  virtual View* GetContentsView() override;
  virtual bool CanResize() const override;
  virtual bool CanMaximize() const override;
  virtual bool CanMinimize() const override;
  virtual views::NonClientFrameView* CreateNonClientFrameView(
      views::Widget* widget) override;

  std::string name_;
  views::Widget::InitParams params_;

  DISALLOW_COPY_AND_ASSIGN(PanelWindow);
};

}  // namespace ash

#endif  // ASH_SHELL_PANEL_WINDOW_H_