sptk2 logo
SPTK Home Page
CTabImage.h
1/*
2╔══════════════════════════════════════════════════════════════════════════════╗
3║ SIMPLY POWERFUL TOOLKIT (SPTK) ║
4╟──────────────────────────────────────────────────────────────────────────────╢
5║ copyright © 1999-2022 Alexey Parshin. All rights reserved. ║
6║ email alexeyp@gmail.com ║
7╚══════════════════════════════════════════════════════════════════════════════╝
8┌──────────────────────────────────────────────────────────────────────────────┐
9│ This library is free software; you can redistribute it and/or modify it │
10│ under the terms of the GNU Library General Public License as published by │
11│ the Free Software Foundation; either version 2 of the License, or (at your │
12│ option) any later version. │
13│ │
14│ This library is distributed in the hope that it will be useful, but │
15│ WITHOUT ANY WARRANTY; without even the implied warranty of │
16│ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library │
17│ General Public License for more details. │
18│ │
19│ You should have received a copy of the GNU Library General Public License │
20│ along with this library; if not, write to the Free Software Foundation, │
21│ Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. │
22│ │
23│ Please report all bugs and problems to alexeyp@gmail.com. │
24└──────────────────────────────────────────────────────────────────────────────┘
25*/
26
27#pragma once
28
29#include <sptk5/Tar.h>
30#include <sptk5/gui/CPngImage.h>
31#include <sptk5/xdoc/Node.h>
32
33namespace sptk {
34
44{
45 TI_INACTIVE = 0,
46 TI_ACTIVE = 1,
47 TI_BORDER = 2
48};
49
53class SP_EXPORT CTabImage
54{
58 CPngImage* m_image;
59
63 String m_name;
64
68 int m_leftFrameWidth;
69
73 int m_rightFrameWidth;
74
78 int m_topFrameHeight;
79
83 int m_bottomFrameHeight;
84
88 CPngImage::CPatternDrawMode m_backgroundDrawMode;
89
90public:
96 CTabImage(const sptk::Tar& tar, const xdoc::SNode& tabImageNode);
97
102 {
103 if (m_image)
104 {
105 delete m_image;
106 }
107 }
108
112 void draw(int x, int y, int w, int h);
113
117 String name() const
118 {
119 return m_name;
120 }
121};
122
127 : protected std::map<String, CTabImage*>
128{
129public:
134 {
135 }
136
142 void load(const sptk::Tar& tar, const xdoc::SNode& tabImagesNode);
143
148 {
149 clear();
150 }
151
155 void clear();
156
160 CTabImage* tabImage(const char* imageName);
161};
162
166} // namespace sptk
PNG image that is initialized from the memory buffer.
Definition: CPngImage.h:53
CPatternDrawMode
The way how the resized parts of image are drawn.
Definition: CPngImage.h:105
An image representing one of three required images for theme tabs.
Definition: CTabImage.h:54
~CTabImage()
Destructor.
Definition: CTabImage.h:101
CTabImage(const sptk::Tar &tar, const xdoc::SNode &tabImageNode)
Constructor.
void draw(int x, int y, int w, int h)
Custom draw method.
String name() const
Tab name.
Definition: CTabImage.h:117
Definition: CTabImage.h:128
~CTabImages()
Destructor.
Definition: CTabImage.h:147
CTabImages()
Constructor.
Definition: CTabImage.h:133
CTabImage * tabImage(const char *imageName)
Returns tab image for the name, or NULL if not found.
void clear()
Removes all the tab images from the vector.
void load(const sptk::Tar &tar, const xdoc::SNode &tabImagesNode)
Loads tab images from tar archive using XML node as an index.
Definition: String.h:49
Definition: Tar.h:44
CTabImageIndex
Typee of the tab image.
Definition: CTabImage.h:44

Fri Oct 14 2022 09:58:31: SPTK 5.4.1