From 10f429ee0f51e7d882af090f20142c1d16e5033c Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Sat, 23 Feb 2013 16:17:25 +0100 Subject: [PATCH] CComponents: move components.cpp to cc_base.cpp, move types to own header --- src/gui/components/Makefile.am | 2 +- src/gui/components/cc.h | 84 +------------ .../{components.cpp => cc_base.cpp} | 2 +- src/gui/components/cc_types.h | 110 ++++++++++++++++++ 4 files changed, 114 insertions(+), 84 deletions(-) rename src/gui/components/{components.cpp => cc_base.cpp} (99%) create mode 100644 src/gui/components/cc_types.h diff --git a/src/gui/components/Makefile.am b/src/gui/components/Makefile.am index 5765a440c..ad5769abf 100644 --- a/src/gui/components/Makefile.am +++ b/src/gui/components/Makefile.am @@ -17,4 +17,4 @@ noinst_LIBRARIES = libneutrino_gui_components.a libneutrino_gui_components_a_SOURCES = \ - components.cpp + cc_base.cpp diff --git a/src/gui/components/cc.h b/src/gui/components/cc.h index 730f7b8c2..1a4ec1e19 100644 --- a/src/gui/components/cc.h +++ b/src/gui/components/cc.h @@ -2,7 +2,7 @@ Based up Neutrino-GUI - Tuxbox-Project Copyright (C) 2001 by Steffen Hehn 'McClean' - Classes for generic for GUI-related components. + Classes for generic GUI-related components. Copyright (C) 2012, 2013, Thilo Graf 'dbt' License: GPL @@ -26,92 +26,12 @@ #ifndef __COMPONENTS__ #define __COMPONENTS__ +#include "cc_types.h" #include -#include -#include #include #include #include -//required typedefs -typedef struct comp_fbdata_t -{ - int fbdata_type; - int x; - int y; - int dx; - int dy; - fb_pixel_t color; - int r; - int frame_thickness; - fb_pixel_t* pixbuf; - void * data; -} comp_fbdata_struct_t; - -//fb data object types -typedef enum -{ - CC_FBDATA_TYPE_BGSCREEN, - CC_FBDATA_TYPE_SHADOW, - CC_FBDATA_TYPE_BOX, - CC_FBDATA_TYPE_FRAME, - CC_FBDATA_TYPE_LINE, - CC_FBDATA_TYPE_BACKGROUND, - - CC_FBDATA_TYPES -}FBDATA_TYPES; - -typedef struct comp_screen_data_t -{ - int x; - int y; - int dx; - int dy; - fb_pixel_t* pixbuf; -} comp_screen_data_struct_t; - -//align types -enum -{ - CC_ALIGN_RIGHT = 0, - CC_ALIGN_LEFT = 1, - CC_ALIGN_TOP = 2, - CC_ALIGN_BOTTOM = 4, - CC_ALIGN_HOR_CENTER = 8, - CC_ALIGN_VER_CENTER = 16 -}; - -enum -{ - CC_ITEMBOX_ICON, - CC_ITEMBOX_PICTURE, - CC_ITEMBOX_TEXT, - CC_ITEMBOX_CLOCK -}; - -typedef struct comp_element_data_t -{ - int type; - int align; - std::string element; - int x; - int y; - int width; - int height; - void* handler1; - void* handler2; -}comp_element_data_struct_t; - - -#define CC_WIDTH_MIN 16 -#define CC_HEIGHT_MIN 16 -#define CC_SHADOW_ON true -#define CC_SHADOW_OFF false -#define CC_SAVE_SCREEN_YES true -#define CC_SAVE_SCREEN_NO false - -#define CC_NO_INDEX -1 - class CComponents { protected: diff --git a/src/gui/components/components.cpp b/src/gui/components/cc_base.cpp similarity index 99% rename from src/gui/components/components.cpp rename to src/gui/components/cc_base.cpp index 0c5c223aa..af5f7fd80 100644 --- a/src/gui/components/components.cpp +++ b/src/gui/components/cc_base.cpp @@ -2,7 +2,7 @@ Based up Neutrino-GUI - Tuxbox-Project Copyright (C) 2001 by Steffen Hehn 'McClean' - Classes for generic for GUI-related components. + Classes for generic GUI-related components. Copyright (C) 2012, 2013, Thilo Graf 'dbt' Copyright (C) 2012, Michael Liebmann 'micha-bbg' diff --git a/src/gui/components/cc_types.h b/src/gui/components/cc_types.h new file mode 100644 index 000000000..df2e53b48 --- /dev/null +++ b/src/gui/components/cc_types.h @@ -0,0 +1,110 @@ +/* + Based up Neutrino-GUI - Tuxbox-Project + Copyright (C) 2001 by Steffen Hehn 'McClean' + + Classes for generic GUI-related components. + Copyright (C) 2012, 2013, Thilo Graf 'dbt' + + License: GPL + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with this library; if not, write to the + Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#ifndef __CC_TYPES__ +#define __CC_TYPES__ + +//required typedefs +typedef struct comp_fbdata_t +{ + int fbdata_type; + int x; + int y; + int dx; + int dy; + fb_pixel_t color; + int r; + int frame_thickness; + fb_pixel_t* pixbuf; + void * data; +} comp_fbdata_struct_t; + +//fb data object types +typedef enum +{ + CC_FBDATA_TYPE_BGSCREEN, + CC_FBDATA_TYPE_SHADOW, + CC_FBDATA_TYPE_BOX, + CC_FBDATA_TYPE_FRAME, + CC_FBDATA_TYPE_LINE, + CC_FBDATA_TYPE_BACKGROUND, + + CC_FBDATA_TYPES +}FBDATA_TYPES; + +typedef struct comp_screen_data_t +{ + int x; + int y; + int dx; + int dy; + fb_pixel_t* pixbuf; +} comp_screen_data_struct_t; + +//align types +enum +{ + CC_ALIGN_RIGHT = 0, + CC_ALIGN_LEFT = 1, + CC_ALIGN_TOP = 2, + CC_ALIGN_BOTTOM = 4, + CC_ALIGN_HOR_CENTER = 8, + CC_ALIGN_VER_CENTER = 16 +}; + +enum +{ + CC_ITEMBOX_ICON, + CC_ITEMBOX_PICTURE, + CC_ITEMBOX_TEXT, + CC_ITEMBOX_CLOCK +}; + +typedef struct comp_element_data_t +{ + int type; + int align; + std::string element; + int x; + int y; + int width; + int height; + void* handler1; + void* handler2; +}comp_element_data_struct_t; + + +#define CC_WIDTH_MIN 16 +#define CC_HEIGHT_MIN 16 +#define CC_SHADOW_ON true +#define CC_SHADOW_OFF false +#define CC_SAVE_SCREEN_YES true +#define CC_SAVE_SCREEN_NO false + +#define CC_NO_INDEX -1 + + + +#endif