Back to index

unity  6.0.0
PanelStyle.h
Go to the documentation of this file.
00001 // -*- Mode: C++; indent-tabs-mode: nil; tab-width: 2 -*-
00002 /*
00003  * Copyright (C) 2010, 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  *              Neil Jagdish Patel <neil.patel@canonical.com>
00019  *              Marco Trevisan <3v1n0@ubuntu.com>
00020  */
00021 
00022 #ifndef PANEL_STYLE_H
00023 #define PANEL_STYLE_H
00024 
00025 #include <Nux/Nux.h>
00026 #include <NuxCore/Property.h>
00027 
00028 #include <gtk/gtk.h>
00029 #include <UnityCore/GLibWrapper.h>
00030 #include <UnityCore/GLibSignal.h>
00031 
00032 namespace unity
00033 {
00034 namespace panel
00035 {
00036 
00037 enum class WindowButtonType
00038 {
00039   CLOSE,
00040   MINIMIZE,
00041   UNMAXIMIZE,
00042   MAXIMIZE
00043 };
00044 
00045 enum class WindowState
00046 {
00047   NORMAL,
00048   PRELIGHT,
00049   PRESSED,
00050   DISABLED,
00051   UNFOCUSED,
00052   UNFOCUSED_PRELIGHT,
00053   UNFOCUSED_PRESSED
00054 };
00055 
00056 enum class PanelItem
00057 {
00058   INDICATOR,
00059   MENU,
00060   TITLE
00061 };
00062 
00063 class Style
00064 {
00065 public:
00066   Style();
00067   ~Style();
00068 
00069   static Style& Instance();
00070 
00071   GtkStyleContext* GetStyleContext();
00072   nux::NBitmapData* GetBackground(int width, int height, float opacity);
00073   nux::BaseTexture* GetWindowButton(WindowButtonType type, WindowState state);
00074   nux::BaseTexture* GetFallbackWindowButton(WindowButtonType type, WindowState state);
00075   glib::Object<GdkPixbuf> GetHomeButton();
00076   std::string GetFontDescription(PanelItem item);
00077   int GetTextDPI();
00078 
00079   nux::Property<int> panel_height;
00080 
00081   sigc::signal<void> changed;
00082 
00083 private:
00084   void Refresh();
00085 
00086   glib::Object<GtkStyleContext> _style_context;
00087   glib::Signal<void, GtkSettings*, GParamSpec*> _style_changed_signal;
00088   glib::Signal<void, GtkSettings*, GParamSpec*> _font_changed_signal;
00089   glib::Signal<void, GtkSettings*, GParamSpec*> _dpi_changed_signal;
00090   guint _gconf_notify_id;
00091   std::string _theme_name;
00092   nux::Color _text_color;
00093 };
00094 
00095 }
00096 }
00097 #endif // PANEL_STYLE_H