aboutsummaryrefslogtreecommitdiffstats
path: root/OptionItem.h
diff options
context:
space:
mode:
authorDaniel Lange <DLange@git.local>2020-12-07 10:26:01 +0100
committerDaniel Lange <DLange@git.local>2020-12-07 10:26:01 +0100
commit65357c8c46154de4e4eca14075bfe5523bb5fc14 (patch)
tree8f430ee5a0d5de377c4e7c94e47842a27c70d7e8 /OptionItem.h
parentf80394a20254938142011855f2954b3f63fe5909 (diff)
downloaddebian_htop-65357c8c46154de4e4eca14075bfe5523bb5fc14.tar.gz
debian_htop-65357c8c46154de4e4eca14075bfe5523bb5fc14.tar.bz2
debian_htop-65357c8c46154de4e4eca14075bfe5523bb5fc14.zip
New upstream version 3.0.3upstream/3.0.3
Diffstat (limited to 'OptionItem.h')
-rw-r--r--OptionItem.h70
1 files changed, 70 insertions, 0 deletions
diff --git a/OptionItem.h b/OptionItem.h
new file mode 100644
index 0000000..8dd802d
--- /dev/null
+++ b/OptionItem.h
@@ -0,0 +1,70 @@
+#ifndef HEADER_OptionItem
+#define HEADER_OptionItem
+/*
+htop - OptionItem.h
+(C) 2004-2011 Hisham H. Muhammad
+Released under the GNU GPLv2, see the COPYING file
+in the source distribution for its full text.
+*/
+
+#include <stdbool.h>
+
+#include "Object.h"
+
+
+enum OptionItemType {
+ OPTION_ITEM_CHECK,
+ OPTION_ITEM_NUMBER,
+};
+
+typedef struct OptionItemClass_ {
+ const ObjectClass super;
+
+ enum OptionItemType kind;
+} OptionItemClass;
+
+#define As_OptionItem(this_) ((const OptionItemClass*)((this_)->super.klass))
+#define OptionItem_kind(this_) As_OptionItem(this_)->kind
+
+typedef struct OptionItem_ {
+ Object super;
+
+ char* text;
+} OptionItem;
+
+typedef struct CheckItem_ {
+ OptionItem super;
+
+ bool* ref;
+ bool value;
+} CheckItem;
+
+typedef struct NumberItem_ {
+ OptionItem super;
+
+ char* text;
+ int* ref;
+ int value;
+ int scale;
+ int min;
+ int max;
+} NumberItem;
+
+extern const OptionItemClass OptionItem_class;
+extern const OptionItemClass CheckItem_class;
+extern const OptionItemClass NumberItem_class;
+
+CheckItem* CheckItem_newByRef(const char* text, bool* ref);
+CheckItem* CheckItem_newByVal(const char* text, bool value);
+bool CheckItem_get(const CheckItem* this);
+void CheckItem_set(CheckItem* this, bool value);
+void CheckItem_toggle(CheckItem* this);
+
+NumberItem* NumberItem_newByRef(const char* text, int* ref, int scale, int min, int max);
+NumberItem* NumberItem_newByVal(const char* text, int value, int scale, int min, int max);
+int NumberItem_get(const NumberItem* this);
+void NumberItem_decrease(NumberItem* this);
+void NumberItem_increase(NumberItem* this);
+void NumberItem_toggle(NumberItem* this);
+
+#endif

© 2014-2024 Faster IT GmbH | imprint | privacy policy