~azzar1/unity/fix-trash-li-blocking

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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
// -*- Mode: C++; indent-tabs-mode: nil; tab-width: 2 -*-
/*
 * Copyright (C) 2011 Canonical Ltd
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 3 as
 * published by the Free Software Foundation.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 *
 * Authored by: Mirco Müller <mirco.mueller@canonical.com
 */

#ifndef DASH_STYLE_H
#define DASH_STYLE_H

#include "DashStyleInterface.h"

#include <Nux/Nux.h>
#include <Nux/View.h>
#include <Nux/AbstractButton.h>

#include <cairo.h>

namespace nux
{
class AbstractPaintLayer;
}

namespace unity
{
namespace dash
{
typedef nux::ObjectPtr<nux::BaseTexture> BaseTexturePtr;

enum class StockIcon {
  CHECKMARK,
  CROSS,
  GRID_VIEW,
  FLOW_VIEW,
  STAR
};

enum class Alignment {
  LEFT,
  CENTER,
  RIGHT
};

enum class Orientation {
  UP,
  DOWN,
  LEFT,
  RIGHT
};

enum class BlendMode {
  NORMAL,
  MULTIPLY,
  SCREEN
};

enum class FontWeight {
  LIGHT,
  REGULAR,
  BOLD
};

enum class Segment {
  LEFT,
  MIDDLE,
  RIGHT
};

enum class Arrow {
  LEFT,
  RIGHT,
  BOTH,
  NONE
};

enum class Position {
  LEFT,
  BOTTOM
};

class Style : public StyleInterface
{
public:
  Style ();
  ~Style ();

  static Style& Instance();

  virtual bool Button(cairo_t* cr, nux::ButtonVisualState state,
                      std::string const& label, int font_px_size=-1,
                      Alignment alignment = Alignment::CENTER,
                      bool zeromargin=false);

  virtual bool SquareButton(cairo_t* cr, nux::ButtonVisualState state,
                            std::string const& label, bool curve_bottom,
                            int font_px_size=-1,
                            Alignment alignment = Alignment::CENTER,
                            bool zeromargin=false);

  virtual nux::AbstractPaintLayer* FocusOverlay(int width, int height);

  virtual bool ButtonFocusOverlay(cairo_t* cr, float alpha = 0.50f);

  virtual bool MultiRangeSegment(cairo_t*    cr,
                                 nux::ButtonVisualState  state,
                                 std::string const& label,
                                 int font_px_size,
                                 Arrow       arrow,
                                 Segment     segment);

  virtual bool MultiRangeFocusOverlay(cairo_t* cr,
                                      Arrow arrow,
                                      Segment segment);

  virtual bool TrackViewNumber(cairo_t*    cr,
                               nux::ButtonVisualState  state,
                               std::string const& trackNumber);

  virtual bool TrackViewPlay(cairo_t*   cr,
                             nux::ButtonVisualState state);

  virtual bool TrackViewPause(cairo_t*   cr,
                              nux::ButtonVisualState state);

  virtual bool TrackViewProgress(cairo_t* cr);

  virtual bool SeparatorVert(cairo_t* cr);

  virtual bool SeparatorHoriz(cairo_t* cr);

  RawPixel GetButtonGarnishSize() const;

  RawPixel GetSeparatorGarnishSize() const;

  void Blur(cairo_t* cr, int size);

  void RoundedRect(cairo_t* cr,
                   double   aspect,
                   double   x,
                   double   y,
                   double   cornerRadius,
                   double   width,
                   double   height);

  nux::Color const& GetTextColor() const;

  RawPixel GetTileGIconSize() const;
  RawPixel GetTileImageSize() const;
  RawPixel GetTileWidth() const;
  RawPixel GetTileHeight() const;
  RawPixel GetTileIconHightlightHeight() const;
  RawPixel GetTileIconHightlightWidth() const;

  RawPixel GetHomeTileIconSize() const;
  RawPixel GetHomeTileWidth() const;
  RawPixel GetHomeTileHeight() const;

  RawPixel GetTextLineHeight() const;

  BaseTexturePtr const& GetCategoryBackground() const;
  BaseTexturePtr const& GetCategoryBackgroundNoFilters() const;

  BaseTexturePtr GetDashHorizontalTile(double scale, Position) const;
  BaseTexturePtr GetDashHorizontalTileMask(double scale, Position) const;
  BaseTexturePtr GetDashRightTile(double scale) const;
  BaseTexturePtr GetDashRightTileMask(double scale) const;
  BaseTexturePtr GetDashLeftTile(double scale) const;
  BaseTexturePtr GetDashTopOrBottomTile(double scale, Position) const;

  BaseTexturePtr GetDashCorner(double scale, Position) const;
  BaseTexturePtr GetDashCornerMask(double scale, Position) const;
  BaseTexturePtr GetDashLeftCorner(double scale, Position) const;
  BaseTexturePtr GetDashLeftCornerMask(double scale, Position) const;
  BaseTexturePtr GetDashRightCorner(double scale, Position) const;
  BaseTexturePtr GetDashRightCornerMask(double scale, Position) const;

  RawPixel GetDashHorizontalBorderHeight() const;
  RawPixel GetDashVerticalBorderWidth() const;

  BaseTexturePtr const& GetDashShine() const;

  BaseTexturePtr GetSearchMagnifyIcon(double scale) const;
  BaseTexturePtr GetSearchCircleIcon(double scale) const;
  BaseTexturePtr GetSearchCloseIcon(double scale) const;
  BaseTexturePtr GetSearchSpinIcon(double scale) const;

  BaseTexturePtr const& GetGroupUnexpandIcon() const;
  BaseTexturePtr const& GetGroupExpandIcon() const;

  BaseTexturePtr const& GetStarDeselectedIcon() const;
  BaseTexturePtr const& GetStarSelectedIcon() const;
  BaseTexturePtr const& GetStarHighlightIcon() const;

  BaseTexturePtr const& GetInformationTexture() const;

  BaseTexturePtr const& GetRefineTextureCorner() const;
  BaseTexturePtr const& GetRefineTextureDash() const;

  // Returns the width of the separator between the dash and the launcher.
  RawPixel GetVSeparatorSize() const;

  // Returns the height of the separator between the dash and the top panel.
  RawPixel GetHSeparatorSize() const;

  // Practically it is the space between the top border of the dash and the searchbar.
  RawPixel GetDashViewTopPadding() const;


  // Search bar
  RawPixel GetSearchBarLeftPadding() const;
  RawPixel GetSearchBarRightPadding() const;
  RawPixel GetSearchBarHeight() const;

  // Filter bar
  RawPixel GetFilterResultsHighlightRightPadding() const;
  RawPixel GetFilterResultsHighlightLeftPadding() const;
  RawPixel GetFilterBarTopPadding() const;
  RawPixel GetFilterHighlightPadding() const;
  RawPixel GetSpaceBetweenFilterWidgets() const;
  RawPixel GetAllButtonHeight() const;
  RawPixel GetFilterBarLeftPadding() const;
  RawPixel GetFilterBarRightPadding() const;
  RawPixel GetFilterBarWidth() const;
  RawPixel GetFilterButtonHeight() const;
  RawPixel GetFilterViewRightPadding() const;

  RawPixel GetSpaceBetweenScopeAndFilters() const;

  // Scrollbars
  RawPixel GetOverlayScrollbarSize() const;
  RawPixel GetScrollbarSize() const;
  RawPixel GetScrollbarButtonsSize() const;

  RawPixel GetOverlayScrollbarCornerRadius() const;
  RawPixel GetScrollbarCornerRadius() const;

  nux::Color GetOverlayScrollbarColor() const;
  nux::Color GetScrollbarColor() const;
  nux::Color GetScrollbarTrackColor() const;

  // Places Group
  RawPixel GetCategoryIconSize() const;
  RawPixel GetCategoryHighlightHeight() const;
  RawPixel GetPlacesGroupTopSpace() const;
  RawPixel GetPlacesGroupResultTopPadding() const;
  RawPixel GetPlacesGroupResultLeftPadding() const;
  RawPixel GetCategoryHeaderLeftPadding() const;
  RawPixel GetCategorySeparatorLeftPadding() const;
  RawPixel GetCategorySeparatorRightPadding() const;

  sigc::signal<void> changed;
  sigc::signal<void> textures_changed;

  nux::Property<int> columns_number;
  nux::Property<bool> always_maximised;
  nux::Property<bool> preview_mode;

private:
  class Impl;
  Impl* pimpl;
};

}
}

#endif // DASH_STYLE_H