~smspillaz/unity/untiy.less-paint-insanity

« back to all changes in this revision

Viewing changes to plugins/unityshell/src/PlacesGroup.h

  • Committer: Daniel van Vugt
  • Date: 2012-03-14 06:24:18 UTC
  • mfrom: (2108 unity)
  • mto: This revision was merged to the branch mainline in revision 2146.
  • Revision ID: daniel.van.vugt@canonical.com-20120314062418-nprucpbr0m7qky5e
MergedĀ latestĀ lp:unity

Show diffs side-by-side

added added

removed removed

Lines of Context:
17
17
 * Authored by: Gordon Allott <gord.allott@canonical.com>
18
18
 */
19
19
 
20
 
#ifndef PLACES_GROUP_H
21
 
#define PLACES_GROUP_H
 
20
#ifndef UNITYSHELL_PLACES_GROUP_H
 
21
#define UNITYSHELL_PLACES_GROUP_H
22
22
 
23
23
#include <Nux/Nux.h>
24
24
#include <Nux/VLayout.h>
27
27
 
28
28
#include <sigc++/sigc++.h>
29
29
 
 
30
#include "AbstractPlacesGroup.h"
30
31
#include "IconTexture.h"
 
32
#include "Introspectable.h"
31
33
#include "StaticCairoText.h"
 
34
#include "UBusWrapper.h"
 
35
 
 
36
namespace nux
 
37
{
 
38
class AbstractPaintLayer;
 
39
}
32
40
 
33
41
namespace unity
34
42
{
35
43
 
36
 
class PlacesGroup : public nux::View
 
44
class PlacesGroup : public dash::AbstractPlacesGroup, public debug::Introspectable
37
45
{
38
 
  NUX_DECLARE_OBJECT_TYPE(PlacesGroup, nux::View);
 
46
  NUX_DECLARE_OBJECT_TYPE(PlacesGroup, dash::AbstractPlacesGroup);
39
47
public:
40
48
 
41
49
  PlacesGroup();
47
55
  nux::StaticCairoText* GetLabel();
48
56
  nux::StaticCairoText* GetExpandLabel();
49
57
 
50
 
  void       SetChildView(nux::View* view);
 
58
  void SetChildView(nux::View* view);
51
59
  nux::View* GetChildView();
52
60
 
53
61
  void SetChildLayout(nux::Layout* layout);
57
65
  void SetCounts(guint n_visible_items_in_unexpand_mode, guint n_total_items);
58
66
 
59
67
  void SetExpanded(bool is_expanded);
60
 
  bool GetExpanded();
61
 
 
62
 
  int  GetHeaderHeight();
63
 
 
64
 
  void SetDrawSeparator(bool draw_it);
 
68
  bool GetExpanded() const;
 
69
 
 
70
  int  GetHeaderHeight() const;
 
71
  bool HeaderIsFocusable() const;
 
72
  nux::View* GetHeaderFocusableView() const;
65
73
 
66
74
  sigc::signal<void, PlacesGroup*> expanded;
67
75
 
68
76
protected:
 
77
  long ComputeContentSize();
 
78
  void Draw(nux::GraphicsEngine& graphics_engine, bool force_draw);
 
79
  void DrawContent(nux::GraphicsEngine& graphics_engine, bool force_draw);
 
80
  void PostDraw (nux::GraphicsEngine &graphics_engine, bool force_draw);
 
81
 
69
82
  // Key navigation
70
83
  virtual bool AcceptKeyNavFocus();
71
84
 
 
85
  // Introspection
 
86
  virtual std::string GetName() const;
 
87
  virtual void AddProperties(GVariantBuilder* builder);
 
88
 
72
89
private:
73
90
  void Refresh();
74
 
 
75
 
  void Draw(nux::GraphicsEngine& GfxContext, bool force_draw);
76
 
  void DrawContent(nux::GraphicsEngine& GfxContext, bool force_draw);
77
 
  void PostDraw (nux::GraphicsEngine &GfxContext, bool force_draw);
78
 
 
79
91
  static gboolean OnIdleRelayout(PlacesGroup* self);
80
92
 
 
93
  bool HeaderHasKeyFocus() const;
 
94
  bool ShouldBeHighlighted() const;
 
95
 
81
96
  void RecvMouseClick(int x, int y, unsigned long button_flags, unsigned long key_flags);
82
97
  void RecvMouseEnter(int x, int y, unsigned long button_flags, unsigned long key_flags);
83
98
  void RecvMouseLeave(int x, int y, unsigned long button_flags, unsigned long key_flags);
84
99
  void OnLabelActivated(nux::Area* label);
85
 
  void OnLabelFocusChanged(nux::Area* label);
 
100
  void OnLabelFocusChanged(nux::Area* label, bool has_focus, nux::KeyNavDirection direction);
86
101
  void RefreshLabel();
87
102
 
88
103
private:
89
104
  nux::VLayout* _group_layout;
 
105
  nux::View* _header_view;
90
106
  nux::HLayout* _header_layout;
91
107
  nux::HLayout* _text_layout;
 
108
  nux::HLayout* _expand_label_layout;
92
109
  nux::HLayout* _expand_layout;
93
110
  nux::View*  _child_view;
 
111
  nux::AbstractPaintLayer* _focus_layer;
94
112
 
95
113
  IconTexture*          _icon;
96
114
  nux::StaticCairoText* _name;
104
122
  guint _n_total_items;
105
123
  char* _cached_name;
106
124
  bool  _draw_sep;
 
125
  nux::Geometry _cached_geometry;
107
126
 
 
127
  UBusManager _ubus;
108
128
};
109
129
 
110
130
}