Clapkit
Loading...
Searching...
No Matches
ckLabel.h
Go to the documentation of this file.
1/*
2 *
3 * Clapkit
4 * ----------------------------------------------------------------------
5 * A wrapper for creating a 'generalized' app for Classic MacOS
6 * that (hopefully) can be ported easily to other platforms.
7 *
8 * CKLabel
9 * ----------------------------------------------------------------------
10 * Defines a static label.
11 *
12 */
13
14#pragma once
15
16#include "ckApp.h"
17#include "ckControl.h"
18#include "ck_pTextableControl.h"
19
24class CKLabel : public CKControl, public CKTextableControl {
25
26 public:
27 CKLabel(const CKControlInitParams& params);
28 virtual ~CKLabel();
29
30 virtual void AddedToWindow(CKWindow* window);
31 virtual void RemovedFromWindow();
32
33 virtual void PrepareForDraw();
34 virtual void Redraw();
35 virtual void SetText(const char* text);
36 virtual const char* GetText();
37 void AutoHeight(int maxHeight = 0);
38
39 void SetFont(short fontId);
40 short GetFont();
41
42 void DoTEIdle() {
43 TEIdle(this->__teHandle);
44 }
45
46 virtual void RaisePropertyChange(const char* propertyName);
47
48 protected:
49 // Called once TE is created so you can override things in your class.
50 virtual void TECreated();
51 virtual void ResizeTE();
52
53 public:
61
62 protected:
64 TEHandle __teHandle = nullptr;
65 char* __tempTextStorage = nullptr;
66 bool __needsPreparing = true;
67};
Defines the base of all UI Controls.
Definition ckControl.h:89
Defines a text label.
Definition ckLabel.h:24
void DoTEIdle()
Definition ckLabel.h:42
virtual ~CKLabel()
Definition ckLabel.cpp:49
short __fontNumber
Definition ckLabel.h:63
CKProperty< bool > bold
Definition ckLabel.h:54
virtual void ResizeTE()
Definition ckLabel.cpp:360
char * __tempTextStorage
Definition ckLabel.h:65
virtual void TECreated()
Definition ckLabel.cpp:356
virtual void RemovedFromWindow()
Definition ckLabel.cpp:94
virtual void PrepareForDraw()
Definition ckLabel.cpp:102
virtual const char * GetText()
Definition ckLabel.cpp:253
virtual void SetText(const char *text)
Definition ckLabel.cpp:230
short GetFont()
Definition ckLabel.cpp:352
void AutoHeight(int maxHeight=0)
Increase the height until it fits.
Definition ckLabel.cpp:292
virtual void Redraw()
Definition ckLabel.cpp:192
CKProperty< int > fontSize
Definition ckLabel.h:59
CKProperty< bool > multiline
Definition ckLabel.h:57
CKProperty< CKColor > color
Definition ckLabel.h:58
virtual void AddedToWindow(CKWindow *window)
Definition ckLabel.cpp:62
virtual void RaisePropertyChange(const char *propertyName)
Definition ckLabel.cpp:378
bool __needsPreparing
Definition ckLabel.h:66
CKProperty< bool > italic
Definition ckLabel.h:55
CKProperty< bool > underline
Definition ckLabel.h:56
CKProperty< CKTextJustification > justification
Definition ckLabel.h:60
TEHandle __teHandle
Definition ckLabel.h:64
void SetFont(short fontId)
Definition ckLabel.cpp:348
Defines an observable value.
Definition ckProperty.h:60
A base for controls that have a text property.
Definition ck_pTextableControl.h:21
Defines a window. Window type (modal, document) is determined by CKWindowInitParams and CKWindowType.
Definition ckWindow.h:89
Initialization parameters for a CKControl.
Definition ckControl.h:27