sptk2 logo
SPTK Home Page
CGroup.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 <FL/Fl_Group.H>
30#include <sptk5/Strings.h>
31#include <sptk5/gui/CLayoutClient.h>
32#include <sptk5/gui/CLayoutManager.h>
33
34namespace sptk {
35
47class SP_EXPORT CGroup
48 : public Fl_Group
49 , public CLayoutManager
50{
54 bool m_drawClipped;
55
56public:
60 bool drawClipped() const;
61
66 void drawClipped(bool drawClipped);
67
68protected:
73 void ctor_init(const char* label);
74
75public:
82 explicit CGroup(const char* label = nullptr, int layoutSize = 10,
83 CLayoutAlign layoutAlign = CLayoutAlign::TOP);
84
85#ifdef __COMPATIBILITY_MODE__
94 CGroup(int x, int y, int w, int h, const char* label = 0L);
95#endif
96
100 void draw() override;
101
109 void resize(int x, int y, int w, int h) override;
110
117 bool preferredSize(int& w, int& h) override;
118
122 void clear() override
123 {
124 Fl_Group::clear();
125 }
126
130 const String& label() const override
131 {
132 return m_label;
133 }
134
136
141 static CLayoutClient* creator(const xdoc::SNode& node);
142
146 String className() const override
147 {
148 return "group";
149 }
150};
154} // namespace sptk
SPTK group widget.
Definition: CGroup.h:50
void drawClipped(bool drawClipped)
static CLayoutClient * creator(const xdoc::SNode &node)
Creates a widget based on the XML node information.
bool drawClipped() const
void ctor_init(const char *label)
void clear() override
Removes all the widgets inside the group.
Definition: CGroup.h:122
String className() const override
Returns widget class name (internal SPTK RTTI).
Definition: CGroup.h:146
CGroup(const char *label=nullptr, int layoutSize=10, CLayoutAlign layoutAlign=CLayoutAlign::TOP)
const String & label() const override
Returns the current label.
Definition: CGroup.h:130
void draw() override
bool preferredSize(int &w, int &h) override
void resize(int x, int y, int w, int h) override
Definition: CLayoutClient.h:82
virtual const String & label() const
Definition: CLayoutClient.h:213
Layout Manager.
Definition: CLayoutManager.h:103
Definition: String.h:49
CLayoutAlign
Definition: CLayoutClient.h:44
@ TOP
Align to the right.

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