sptk2 logo
SPTK Home Page
CHtmlBox.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/sptk.h>
30
31#include <FL/Fl_Group.H>
32#include <FL/Fl_Box.H>
33#include <FL/Fl_Input_.H>
34#include <sptk5/gui/CInput.h>
35#include <sptk5/gui/CControl.h>
36
37namespace sptk {
38
49class SP_EXPORT CHtmlBox
50 : public CInput
51{
52 using inherited = class CInput;
53
57 void ctor_init(const char* label);
58
59public:
60
67 explicit CHtmlBox(const char* label = nullptr, int layoutSize = 10,
68 CLayoutAlign layoutAlign = CLayoutAlign::TOP);
69
70#ifdef __COMPATIBILITY_MODE__
79 CHtmlBox(int,int,int,int,const char * = 0);
80#endif
81
85 Variant data() const override;
86
90 void data(const Variant& v) override;
91
96 CControlKind kind() const override
97 {
99 }
100
104 String className() const override
105 {
106 return "html";
107 }
108
112 Fl_Font textFont() const override;
113
117 void textFont(Fl_Font f) override;
118
122 uchar textSize() const override;
123
127 void textSize(uchar s) override;
128
132 int totalHeight() const;
133
140 bool preferredSize(int& w, int& h) override;
141
145 static CLayoutClient* creator(const xdoc::SNode& node);
146};
147
151}
Simple HTML viewer.
Definition: CHtmlBox.h:51
static CLayoutClient * creator(const xdoc::SNode &node)
Creates a widget based on the XML node information.
String className() const override
Returns the control class name, SPTK-style RTTI.
Definition: CHtmlBox.h:104
void textFont(Fl_Font f) override
Sets the input text font type.
Fl_Font textFont() const override
Returns the input text font type.
void data(const Variant &v) override
Universal data connection, sets data from control.
void textSize(uchar s) override
Sets the input text font size.
bool preferredSize(int &w, int &h) override
Computes the optimal widget size.
int totalHeight() const
Computes the total height of HTML text inside if the widgets height isn't limited.
uchar textSize() const override
Returns the input text font size.
CControlKind kind() const override
Returns the control kind, SPTK-style RTTI.
Definition: CHtmlBox.h:96
CHtmlBox(const char *label=nullptr, int layoutSize=10, CLayoutAlign layoutAlign=CLayoutAlign::TOP)
Constructor in SPTK style.
Variant data() const override
Universal data connection, returns data from control.
Definition: CInput.h:197
Definition: CLayoutClient.h:82
Definition: String.h:49
Definition: Variant.h:372
CControlKind
Control kind is the constant to report the internal SPTK RTTI.
Definition: CControl.h:50
CLayoutAlign
Definition: CLayoutClient.h:44
@ TOP
Align to the right.

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