Clapkit
Loading...
Searching...
No Matches
ck_pValueContainingControl.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 * CKValueContainingControl
9 * ----------------------------------------------------------------------
10 * Describes a control where it has a "value" - like a textbox or a
11 * checkbox, radiobox, etc.
12 */
13
14#pragma once
15#include <string>
16#include <variant>
17
18enum class CKValueType {
19 None,
20 Boolean,
21 Text,
22 Misc
23};
24
29
30 public:
31 void SetValue(bool value) {
32 _value.bValue = value;
34 }
35
36 void SetValue(void* value) {
37 _value.mValue = value;
39 }
40
41 bool GetBoolean() const {
42 return _type == CKValueType::Boolean ? _value.bValue : false;
43 }
44
45 void* GetMisc() const {
46 return _type == CKValueType::Misc ? _value.mValue : nullptr;
47 }
48
49 protected:
51 union {
52 bool bValue;
53 void* mValue;
55};
CKValueType
Definition ck_pValueContainingControl.h:18
A base for controls that have a 'main' boolean or custom property.
Definition ck_pValueContainingControl.h:28
void * mValue
Definition ck_pValueContainingControl.h:53
void SetValue(void *value)
Definition ck_pValueContainingControl.h:36
bool bValue
Definition ck_pValueContainingControl.h:52
CKValueType _type
Definition ck_pValueContainingControl.h:50
void * GetMisc() const
Definition ck_pValueContainingControl.h:45
union CKValueContainingControl::@0 _value
void SetValue(bool value)
Definition ck_pValueContainingControl.h:31
bool GetBoolean() const
Definition ck_pValueContainingControl.h:41