00001
00012 #ifndef _CHECKBOX_H_
00013 #define _CHECKBOX_H_
00014
00015 #include "../jnilib.h"
00016 #include "listeners.h"
00017
00018 #ifdef __cplusplus
00019 extern "C" {
00020 #endif
00021
00023 #define CLS_CHECKBOX "java/awt/Checkbox"
00024
00025 struct CheckBox_;
00026
00027 struct CheckBoxCPP_;
00028
00029 #ifdef __cplusplus
00030 typedef CheckBoxCPP_ CheckBox;
00031 #define createCheckBox createCheckBoxCPP
00032 #define deleteCheckBox deleteCheckBoxCPP
00033 #else
00034 typedef struct CheckBox_ CheckBox;
00035 #define createCheckBox createCheckBoxC
00036 #define deleteCheckBox deleteCheckBoxC
00037 #endif
00038
00039 #include "checkboxgroup.h"
00040
00044 typedef struct CheckBoxData {
00045 jclass clscheckbox;
00046 jobject checkbox;
00047 jmethodID msetLabel;
00048 jmethodID mgetLabel;
00049 jmethodID msetState;
00050 jmethodID mgetState;
00051 jmethodID msetCheckBoxGroup;
00052 jmethodID maddItemListener;
00053 jmethodID mremoveItemListener;
00054 } CheckBoxData;
00055
00059 typedef struct CheckBox_ {
00060 CheckBoxData checkbox;
00061 jobject (*getObject)(CheckBox* checkbox);
00062 void (*setSize)(CheckBox* checkbox, jint width, jint height);
00063 jint (*getHeight)(CheckBox* checkbox);
00064 jint (*getWidth)(CheckBox* checkbox);
00065 void (*setLocation)(CheckBox* checkbox, jint x, jint y);
00066 jint (*getX)(CheckBox* checkbox);
00067 jint (*getY)(CheckBox* checkbox);
00068 char* (*getLabel)(CheckBox* checkbox);
00069 void (*setLabel)(CheckBox* checkbox, const char* label);
00070 jboolean (*getState)(CheckBox* checkbox);
00071 void (*setState)(CheckBox* checkbox, jboolean state);
00072 void (*setCheckBoxGroup)(CheckBox* checkbox, const CheckBoxGroup* checkboxgroup);
00073 ItemListener (*addItemListener)(CheckBox* checkbox, void (*func)(Component, jboolean, const char*));
00074 void (*removeItemListener)(CheckBox* checkbox, ItemListener il);
00075 } CheckBox_;
00076
00080 typedef struct CheckBoxCPP_ {
00081 CheckBoxData checkbox;
00082 struct CheckBox_ *functions;
00083
00084 #ifdef __cplusplus
00085 jobject getObject() {
00086 return functions->getObject(this);
00087 }
00088
00089 void setSize(jint width, jint height) {
00090 functions->setSize(this, width, height);
00091 }
00092
00093 jint getHeight() {
00094 return functions->getHeight(this);
00095 }
00096
00097 jint getWidth() {
00098 return functions->getWidth(this);
00099 }
00100
00101 void setLocation(jint x, jint y) {
00102 functions->setLocation(this, x, y);
00103 }
00104
00105 jint getX() {
00106 return functions->getX(this);
00107 }
00108
00109 jint getY() {
00110 return functions->getY(this);
00111 }
00112
00113 char* getLabel() {
00114 return functions->getLabel(this);
00115 }
00116
00117 void setLabel(const char* label) {
00118 functions->setLabel(this, label);
00119 }
00120
00121 jboolean getState() {
00122 return functions->getState(this);
00123 }
00124
00125 void setState(jboolean state) {
00126 functions->setState(this, state);
00127 }
00128
00129 void setCheckBoxGroup(const CheckBoxGroup* checkboxgroup) {
00130 functions->setCheckBoxGroup(this, checkboxgroup);
00131 }
00132
00133 ItemListener addItemListener(void (*func)(Component, jboolean, const char*)) {
00134 return functions->addItemListener(this, func);
00135 }
00136
00137 void removeItemListener(ItemListener il) {
00138 functions->removeItemListener(this, il);
00139 }
00140
00141 #endif
00142 } CheckBoxCPP_;
00143
00144
00145 void createCheckBoxC(CheckBox_* checkbox);
00146 void createCheckBoxCPP(CheckBoxCPP_* checkbox);
00147 void deleteCheckBoxC(CheckBox_* checkbox);
00148 void deleteCheckBoxCPP(CheckBoxCPP_* checkbox);
00149
00150 #ifdef __cplusplus
00151 }
00152 #endif
00153
00154 #endif
00155
00156