diff options
| -rw-r--r-- | unity-shared/AbstractSeparator.cpp | 68 | ||||
| -rw-r--r-- | unity-shared/AbstractSeparator.h | 49 | ||||
| -rw-r--r-- | unity-shared/CMakeLists.txt | 1 | ||||
| -rw-r--r-- | unity-shared/LineSeparator.cpp | 38 | ||||
| -rw-r--r-- | unity-shared/LineSeparator.h | 25 |
5 files changed, 42 insertions, 139 deletions
diff --git a/unity-shared/AbstractSeparator.cpp b/unity-shared/AbstractSeparator.cpp deleted file mode 100644 index fc782fdcd..000000000 --- a/unity-shared/AbstractSeparator.cpp +++ /dev/null @@ -1,68 +0,0 @@ -/* - * 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: Jay Taoko <jaytaoko@inalogic.com> - * - */ - -#include "AbstractSeparator.h" - -#include "Nux/Nux.h" - -namespace unity -{ - -AbstractSeparator::AbstractSeparator(NUX_FILE_LINE_DECL) - : nux::View(NUX_FILE_LINE_PARAM) - , color_(nux::color::White) - , alpha0_(0.0f) - , alpha1_(0.10f) - , border_size_(0) -{ -} - -// Maybe it's better to use default arguments? -AbstractSeparator::AbstractSeparator(nux::Color const& color, float alpha0, - float alpha1, int border, NUX_FILE_LINE_DECL) - : nux::View(NUX_FILE_LINE_PARAM) - , color_(color) - , alpha0_(alpha0) - , alpha1_(alpha1) - , border_size_(border) -{ -} - -AbstractSeparator::~AbstractSeparator() -{ - -} - -void AbstractSeparator::SetColor(nux::Color const &color) -{ - color_ = color; -} - -void AbstractSeparator::SetAlpha(float alpha0, float alpha1) -{ - alpha0_ = alpha0; - alpha1_ = alpha1; -} - -void AbstractSeparator::SetBorderSize(int border) -{ - border_size_ = border; -} - -} // namespace unity diff --git a/unity-shared/AbstractSeparator.h b/unity-shared/AbstractSeparator.h deleted file mode 100644 index 664270959..000000000 --- a/unity-shared/AbstractSeparator.h +++ /dev/null @@ -1,49 +0,0 @@ -/* - * 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: Jay Taoko <jaytaoko@inalogic.com> - * - */ - -#ifndef UNITYSHELL_ABSTRACTSEPARATOR_H -#define UNITYSHELL_ABSTRACTSEPARATOR_H - -#include <Nux/Nux.h> -#include <Nux/View.h> - -namespace unity -{ - -class AbstractSeparator: public nux::View -{ -public: - AbstractSeparator(NUX_FILE_LINE_PROTO); - AbstractSeparator(nux::Color const& color, float alpha0, float alpha1, int vorder, NUX_FILE_LINE_PROTO); - ~AbstractSeparator(); - - void SetColor(nux::Color const& color); - void SetAlpha(float alpha0, float alpha1); - void SetBorderSize(int border); - -protected: - nux::Color color_; - float alpha0_; - float alpha1_; - int border_size_; -}; - -} // namespace unity - -#endif // UNITYSHELL_ABSTRACTSEPARATOR_H diff --git a/unity-shared/CMakeLists.txt b/unity-shared/CMakeLists.txt index de923de86..d8f1f5960 100644 --- a/unity-shared/CMakeLists.txt +++ b/unity-shared/CMakeLists.txt @@ -17,7 +17,6 @@ include_directories (.. ../services ../UnityCore ${UNITY_SRC} ${CMAKE_BINARY_DIR # Headers & Sources # set (UNITY_SHARED_SOURCES - AbstractSeparator.cpp ApplicationManager.cpp BGHash.cpp CoverArt.cpp diff --git a/unity-shared/LineSeparator.cpp b/unity-shared/LineSeparator.cpp index 2e94a27f8..0cc1ea2c0 100644 --- a/unity-shared/LineSeparator.cpp +++ b/unity-shared/LineSeparator.cpp @@ -19,27 +19,24 @@ #include "LineSeparator.h" -#include "Nux/Nux.h" - namespace unity { -HSeparator::HSeparator() -{ - SetMinimumHeight(1); - SetMaximumHeight(1); -} -HSeparator::HSeparator(nux::Color const& color, float alpha0, float alpha1, int border) - : AbstractSeparator(color, alpha0, alpha1, border) +HSeparator::HSeparator(nux::Color const& color, float alpha0, float alpha1, int border, NUX_FILE_LINE_DECL) + : nux::View(NUX_FILE_LINE_PARAM) + , color_(color) + , alpha0_(alpha0) + , alpha1_(alpha1) + , border_size_(border) { SetMinimumHeight(1); SetMaximumHeight(1); } -HSeparator::~HSeparator() -{ -} +HSeparator::HSeparator(NUX_FILE_LINE_DECL) + : HSeparator(nux::color::White, 0.0f, 0.10f, 0) +{} void HSeparator::Draw(nux::GraphicsEngine &GfxContext, bool force_draw) { @@ -67,4 +64,21 @@ void HSeparator::Draw(nux::GraphicsEngine &GfxContext, bool force_draw) GfxContext.GetRenderStates().SetBlend(alpha, src, dest); } +void HSeparator::SetColor(nux::Color const &color) +{ + color_ = color; +} + +void HSeparator::SetAlpha(float alpha0, float alpha1) +{ + alpha0_ = alpha0; + alpha1_ = alpha1; +} + +void HSeparator::SetBorderSize(int border) +{ + border_size_ = border; +} + + } // namespace unity diff --git a/unity-shared/LineSeparator.h b/unity-shared/LineSeparator.h index f22cd6634..9822749dc 100644 --- a/unity-shared/LineSeparator.h +++ b/unity-shared/LineSeparator.h @@ -20,24 +20,31 @@ #ifndef UNITYSHELL_HSEPARATOR_H #define UNITYSHELL_HSEPARATOR_H -#include "AbstractSeparator.h" +#include <Nux/Nux.h> +#include <Nux/View.h> namespace unity { -class HSeparator: public AbstractSeparator +class HSeparator: public nux::View { public: - HSeparator(); - HSeparator(nux::Color const& color, float alpha0, float alpha1, int border); + HSeparator(NUX_FILE_LINE_PROTO); + HSeparator(nux::Color const& color, float alpha0, float alpha1, int border, NUX_FILE_LINE_PROTO); - ~HSeparator(); + void SetColor(nux::Color const& color); + void SetAlpha(float alpha0, float alpha1); + void SetBorderSize(int border); protected: - virtual bool AcceptKeyNavFocus() { return false; } - virtual void Draw(nux::GraphicsEngine& GfxContext, bool force_draw); - virtual void DrawContent(nux::GraphicsEngine& GfxContext, bool force_draw) {}; - + bool AcceptKeyNavFocus() override { return false; } + void Draw(nux::GraphicsEngine& GfxContext, bool force_draw) override; + void DrawContent(nux::GraphicsEngine& GfxContext, bool force_draw) override {}; + + nux::Color color_; + float alpha0_; + float alpha1_; + int border_size_; }; } // namespace unity |
