~canonical-dx-team/unity/unity.fix-ql-losing-focus

« back to all changes in this revision

Viewing changes to src/PanelMenuView.h

  • Committer: Michael Terry
  • Date: 2010-12-17 14:07:11 UTC
  • mfrom: (724 unity)
  • mto: This revision was merged to the branch mainline in revision 743.
  • Revision ID: mike@mterry.name-20101217140711-qlij3bxdjuq1xoph
mergeĀ fromĀ upstream

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * Copyright (C) 2010 Canonical Ltd
 
3
 *
 
4
 * This program is free software: you can redistribute it and/or modify
 
5
 * it under the terms of the GNU General Public License version 3 as
 
6
 * published by the Free Software Foundation.
 
7
 *
 
8
 * This program is distributed in the hope that it will be useful,
 
9
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
10
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
11
 * GNU General Public License for more details.
 
12
 *
 
13
 * You should have received a copy of the GNU General Public License
 
14
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
15
 *
 
16
 * Authored by: Neil Jagdish Patel <neil.patel@canonical.com>
 
17
 */
 
18
 
 
19
#ifndef PANEL_MENU_VIEW_H
 
20
#define PANEL_MENU_VIEW_H
 
21
 
 
22
#include <Nux/View.h>
 
23
#include <map>
 
24
 
 
25
#include "IndicatorObjectProxy.h"
 
26
#include "Introspectable.h"
 
27
#include "PanelIndicatorObjectView.h"
 
28
#include "StaticCairoText.h"
 
29
#include "WindowButtons.h"
 
30
 
 
31
#include <libbamf/libbamf.h>
 
32
 
 
33
class PanelMenuView : public PanelIndicatorObjectView
 
34
{
 
35
public:
 
36
  // This contains all the menubar logic for the Panel. Mainly it contains
 
37
  // the following states:
 
38
  // 1. Unmaximized window + no mouse hover
 
39
  // 2. Unmaximized window + mouse hover
 
40
  // 3. Unmaximized window + active menu (Alt+F/arrow key nav)
 
41
  // 4. Maximized window + no mouse hover
 
42
  // 5. Maximized window + mouse hover
 
43
  // 6. Maximized window + active menu
 
44
  //
 
45
  // It also deals with undecorating maximized windows (and redecorating them
 
46
  // on unmaximize)
 
47
 
 
48
  PanelMenuView ();
 
49
  ~PanelMenuView ();
 
50
 
 
51
  void FullRedraw ();
 
52
 
 
53
  virtual long ProcessEvent (nux::IEvent &ievent, long TraverseInfo, long ProcessEventInfo);
 
54
  virtual void Draw (nux::GraphicsEngine& GfxContext, bool force_draw);
 
55
  virtual void DrawContent (nux::GraphicsEngine &GfxContext, bool force_draw);
 
56
  virtual long PostLayoutManagement (long LayoutResult);
 
57
  
 
58
  void SetProxy (IndicatorObjectProxy *proxy);
 
59
 
 
60
  void OnEntryAdded (IndicatorObjectEntryProxy *proxy);
 
61
  void OnEntryMoved (IndicatorObjectEntryProxy *proxy);
 
62
  void OnEntryRemoved (IndicatorObjectEntryProxy *proxy);
 
63
  void OnActiveChanged (PanelIndicatorObjectEntryView *view, bool is_active);
 
64
  void OnActiveWindowChanged (BamfView *old_view, BamfView *new_view);
 
65
  
 
66
  void OnWindowUnmapped (guint xid);
 
67
  void OnWindowMaximized (guint32 xid);
 
68
  void OnWindowRestored  (guint32 xid);
 
69
 
 
70
  void Refresh ();
 
71
  void AllMenusClosed ();
 
72
  
 
73
  void OnCloseClicked ();
 
74
  void OnMinimizeClicked ();
 
75
  void OnRestoreClicked ();
 
76
  void OnWindowButtonsRedraw ();
 
77
 
 
78
protected:
 
79
  const gchar * GetName ();
 
80
  const gchar * GetChildsName ();
 
81
  void          AddProperties (GVariantBuilder *builder);
 
82
 
 
83
private:
 
84
  gchar * GetActiveViewName ();
 
85
  
 
86
private:
 
87
  BamfMatcher* _matcher;
 
88
 
 
89
  nux::AbstractPaintLayer *_title_layer;
 
90
  nux::HLayout            *_menu_layout;
 
91
  nux::CairoGraphics       _util_cg;
 
92
  nux::IntrusiveSP<nux::IOpenGLBaseTexture> _gradient_texture;
 
93
  nux::BaseTexture        *_title_tex;
 
94
 
 
95
  bool _is_inside;
 
96
  bool _is_maximized; 
 
97
  PanelIndicatorObjectEntryView *_last_active_view;
 
98
 
 
99
  WindowButtons *_window_buttons;
 
100
 
 
101
  std::map<guint32, bool> _decor_map;
 
102
};
 
103
#endif