Back to index

unity  6.0.0
DashStyle.h
Go to the documentation of this file.
00001 // -*- Mode: C++; indent-tabs-mode: nil; tab-width: 2 -*-
00002 /*
00003  * Copyright (C) 2011 Canonical Ltd
00004  *
00005  * This program is free software: you can redistribute it and/or modify
00006  * it under the terms of the GNU General Public License version 3 as
00007  * published by the Free Software Foundation.
00008  *
00009  * This program is distributed in the hope that it will be useful,
00010  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00011  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012  * GNU General Public License for more details.
00013  *
00014  * You should have received a copy of the GNU General Public License
00015  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
00016  *
00017  * Authored by: Mirco Müller <mirco.mueller@canonical.com
00018  */
00019 
00020 #ifndef DASH_STYLE_H
00021 #define DASH_STYLE_H
00022 
00023 #include <Nux/Nux.h>
00024 #include <Nux/View.h>
00025 #include <Nux/AbstractButton.h>
00026 
00027 #include <cairo.h>
00028 
00029 namespace nux
00030 {
00031 class AbstractPaintLayer;
00032 }
00033 
00034 namespace unity
00035 {
00036 namespace dash
00037 {
00038 
00039 enum class StockIcon {
00040   CHECKMARK,
00041   CROSS,
00042   GRID_VIEW,
00043   FLOW_VIEW,
00044   STAR
00045 };
00046 
00047 enum class Alignment {
00048   LEFT,
00049   CENTER,
00050   RIGHT
00051 };
00052 
00053 enum class Orientation {
00054   UP,
00055   DOWN,
00056   LEFT,
00057   RIGHT
00058 };
00059 
00060 enum class BlendMode {
00061   NORMAL,
00062   MULTIPLY,
00063   SCREEN
00064 };
00065 
00066 enum class FontWeight {
00067   LIGHT,
00068   REGULAR,
00069   BOLD
00070 };
00071 
00072 enum class Segment {
00073   LEFT,
00074   MIDDLE,
00075   RIGHT
00076 };
00077 
00078 enum class Arrow {
00079   LEFT,
00080   RIGHT,
00081   BOTH,
00082   NONE
00083 };
00084 
00085 
00086 class Style
00087 {
00088 public:
00089   Style ();
00090   ~Style ();
00091 
00092   static Style& Instance();
00093 
00094   virtual bool Button(cairo_t* cr, nux::ButtonVisualState state,
00095                       std::string const& label, int font_size=-1,
00096                       Alignment alignment = Alignment::CENTER,
00097                       bool zeromargin=false);
00098 
00099   virtual bool SquareButton(cairo_t* cr, nux::ButtonVisualState state,
00100                             std::string const& label, bool curve_bottom,
00101                             int font_size=-1,
00102                             Alignment alignment = Alignment::CENTER,
00103                             bool zeromargin=false);
00104 
00105   virtual nux::AbstractPaintLayer* FocusOverlay(int width, int height);
00106 
00107   virtual bool ButtonFocusOverlay(cairo_t* cr);
00108 
00109   virtual bool MultiRangeSegment(cairo_t*    cr,
00110                                  nux::ButtonVisualState  state,
00111                                  std::string const& label,
00112                                  Arrow       arrow,
00113                                  Segment     segment);
00114 
00115   virtual bool MultiRangeFocusOverlay(cairo_t* cr,
00116                                       Arrow arrow,
00117                                       Segment segment);
00118 
00119   virtual bool TrackViewNumber(cairo_t*    cr,
00120                                nux::ButtonVisualState  state,
00121                                std::string const& trackNumber);
00122 
00123   virtual bool TrackViewPlay(cairo_t*   cr,
00124                              nux::ButtonVisualState state);
00125 
00126   virtual bool TrackViewPause(cairo_t*   cr,
00127                               nux::ButtonVisualState state);
00128 
00129   virtual bool TrackViewProgress(cairo_t* cr);
00130 
00131   virtual bool SeparatorVert(cairo_t* cr);
00132 
00133   virtual bool SeparatorHoriz(cairo_t* cr);
00134 
00135   virtual int GetButtonGarnishSize();
00136 
00137   virtual int GetSeparatorGarnishSize();
00138 
00139   virtual int GetScrollbarGarnishSize();
00140 
00141   void Blur(cairo_t* cr, int size);
00142 
00143   void RoundedRect(cairo_t* cr,
00144                    double   aspect,
00145                    double   x,
00146                    double   y,
00147                    double   cornerRadius,
00148                    double   width,
00149                    double   height);
00150 
00151   nux::Color const& GetTextColor() const;
00152 
00153   // TODO nux::Property<int>
00154   int  GetDefaultNColumns() const;
00155   void SetDefaultNColumns(int n_cols);
00156   sigc::signal<void> columns_changed;
00157 
00158   int GetTileIconSize() const;
00159   int GetTileWidth() const;
00160   int GetTileHeight() const;
00161 
00162   int GetHomeTileIconSize() const;
00163   int GetHomeTileWidth() const;
00164   int GetHomeTileHeight() const;
00165 
00166   int GetTextLineHeight() const;
00167 
00168   nux::BaseTexture* GetDashBottomTile();
00169   nux::BaseTexture* GetDashBottomTileMask();
00170   nux::BaseTexture* GetDashRightTile();
00171   nux::BaseTexture* GetDashRightTileMask();
00172   nux::BaseTexture* GetDashCorner();
00173   nux::BaseTexture* GetDashCornerMask();
00174   nux::BaseTexture* GetDashFullscreenIcon();
00175   nux::BaseTexture* GetDashLeftEdge();
00176   nux::BaseTexture* GetDashLeftCorner();
00177   nux::BaseTexture* GetDashLeftCornerMask();
00178   nux::BaseTexture* GetDashLeftTile();
00179   nux::BaseTexture* GetDashTopCorner();
00180   nux::BaseTexture* GetDashTopCornerMask();
00181   nux::BaseTexture* GetDashTopTile();
00182 
00183   int GetDashBottomTileHeight() const;
00184   int GetDashRightTileWidth() const;
00185 
00186   nux::BaseTexture* GetDashShine();
00187 
00188   nux::BaseTexture* GetSearchMagnifyIcon();
00189   nux::BaseTexture* GetSearchCircleIcon();
00190   nux::BaseTexture* GetSearchCloseIcon();
00191   nux::BaseTexture* GetSearchSpinIcon();
00192 
00193   nux::BaseTexture* GetGroupUnexpandIcon();
00194   nux::BaseTexture* GetGroupExpandIcon();
00195 
00196   nux::BaseTexture* GetStarDeselectedIcon();
00197   nux::BaseTexture* GetStarSelectedIcon();
00198   nux::BaseTexture* GetStarHighlightIcon();
00199 
00200   // Returns the width of the separator between the dash and the launcher.
00201   int GetVSeparatorSize() const;
00202 
00203   // Returns the height of the separator between the dash and the top panel.
00204   int GetHSeparatorSize() const;
00205 
00206   // Practically it is the space between the top border of the dash and the searchbar.
00207   int GetDashViewTopPadding() const;
00208 
00209   // Search bar
00210   int GetSearchBarLeftPadding() const;
00211   int GetSearchBarRightPadding() const;
00212   int GetSearchBarHeight() const;
00213   int GetFilterResultsHighlightRightPadding() const;
00214   int GetFilterResultsHighlightLeftPadding() const;
00215 
00216   // Filter bar
00217   int GetFilterBarTopPadding() const;
00218   int GetFilterHighlightPadding() const;
00219   int GetSpaceBetweenFilterWidgets() const;
00220   int GetAllButtonHeight() const;
00221   int GetFilterBarLeftPadding() const;
00222   int GetFilterBarRightPadding() const;
00223   int GetFilterBarWidth() const;
00224   int GetFilterButtonHeight() const;
00225   int GetFilterViewRightPadding() const;
00226 
00227   int GetSpaceBetweenLensAndFilters() const;
00228 
00229   // Scrollbars
00230   int GetScrollbarWidth() const;
00231 
00232   // Places Group
00233   int GetCategoryHighlightHeight() const;
00234   int GetPlacesGroupTopSpace() const;
00235   int GetCategoryHeaderLeftPadding() const;
00236   int GetCategorySeparatorLeftPadding() const;
00237   int GetCategorySeparatorRightPadding() const;
00238 
00239   sigc::signal<void> changed;
00240 
00241   nux::Property<bool> always_maximised;
00242 
00243 private:
00244   class Impl;
00245   Impl* pimpl;
00246 };
00247 
00248 }
00249 }
00250 
00251 #endif // DASH_STYLE_H