Back to index

unity  6.0.0
FilterBasicButton.h
Go to the documentation of this file.
00001 /*
00002  * Copyright 2011 Canonical Ltd.
00003  *
00004  * This program is free software: you can redistribute it and/or modify it
00005  * under the terms of the GNU Lesser General Public License version 3, as
00006  * published by the  Free Software Foundation.
00007  *
00008  * This program is distributed in the hope that it will be useful, but
00009  * WITHOUT ANY WARRANTY; without even the implied warranties of
00010  * MERCHANTABILITY, SATISFACTORY QUALITY or FITNESS FOR A PARTICULAR
00011  * PURPOSE.  See the applicable version of the GNU Lesser General Public
00012  * License for more details.
00013  *
00014  * You should have received a copy of both the GNU Lesser General Public
00015  * License version 3 along with this program.  If not, see
00016  * <http://www.gnu.org/licenses/>
00017  *
00018  * Authored by: Gordon Allott <gord.allott@canonical.com>
00019  *
00020  */
00021 
00022 #ifndef UNITYSHELL_FILTERBASICBUTTON_H
00023 #define UNITYSHELL_FILTERBASICBUTTON_H
00024 
00025 #include <Nux/Nux.h>
00026 #include <Nux/CairoWrapper.h>
00027 #include <Nux/ToggleButton.h>
00028 
00029 namespace unity
00030 {
00031 namespace dash
00032 {
00033 
00034 class FilterBasicButton : public nux::ToggleButton
00035 {
00036 public:
00037   FilterBasicButton(nux::TextureArea* image, NUX_FILE_LINE_PROTO);
00038   FilterBasicButton(std::string const& label, NUX_FILE_LINE_PROTO);
00039   FilterBasicButton(std::string const& label, nux::TextureArea* image, NUX_FILE_LINE_PROTO);
00040   FilterBasicButton(NUX_FILE_LINE_PROTO);
00041   virtual ~FilterBasicButton();
00042 
00043 protected:
00044   virtual long ComputeContentSize();
00045   virtual void Draw(nux::GraphicsEngine& GfxContext, bool force_draw);
00046 
00047   void Init();
00048   void InitTheme();
00049   void RedrawTheme(nux::Geometry const& geom, cairo_t* cr, nux::ButtonVisualState faked_state);
00050   void RedrawFocusOverlay(nux::Geometry const& geom, cairo_t* cr);
00051 
00052   typedef std::unique_ptr<nux::CairoWrapper> NuxCairoPtr;
00053 
00054   NuxCairoPtr prelight_;
00055   NuxCairoPtr active_;
00056   NuxCairoPtr normal_;
00057   NuxCairoPtr focus_;
00058 
00059   nux::Geometry cached_geometry_;
00060 
00061 private:
00062   std::string label_;
00063 };
00064 
00065 } // namespace dash
00066 } // namespace unity
00067 
00068 #endif // UNITYSHELL_FILTERBASICBUTTON_H