00001
00011 #ifndef _CHOICE_H_
00012 #define _CHOICE_H_
00013
00014 #include "../jnilib.h"
00015 #include "listeners.h"
00016
00017 #ifdef __cplusplus
00018 extern "C" {
00019 #endif
00020
00022 #define CLS_CHOICE "java/awt/Choice"
00023
00024 struct Choice_;
00025
00026 struct ChoiceCPP_;
00027
00028 #ifdef __cplusplus
00029 typedef ChoiceCPP_ Choice;
00030 #define createChoice createChoiceCPP
00031 #define deleteChoice deleteChoiceCPP
00032 #else
00033 typedef struct Choice_ Choice;
00034 #define createChoice createChoiceC
00035 #define deleteChoice deleteChoiceC
00036 #endif
00037
00041 typedef struct ChoiceData {
00042 jclass clschoice;
00043 jobject choice;
00044 jmethodID mgetItem;
00045 jmethodID maddItem;
00046 jmethodID mremoveItem;
00047 jmethodID mremoveItemAtPos;
00048 jmethodID mremoveAll;
00049 jmethodID mgetItemCount;
00050 jmethodID mgetSelectedIndex;
00051 jmethodID maddItemListener;
00052 jmethodID mremoveItemListener;
00053 jmethodID mselectItem;
00054 } ChoiceData;
00055
00059 typedef struct Choice_ {
00060 ChoiceData choice;
00061 jobject (*getObject)(Choice* choice);
00062 void (*setSize)(Choice* choice, jint width, jint height);
00063 jint (*getHeight)(Choice* choice);
00064 jint (*getWidth)(Choice* choice);
00065 void (*setLocation)(Choice* choice, jint x, jint y);
00066 jint (*getX)(Choice* choice);
00067 jint (*getY)(Choice* choice);
00068 char* (*getItem)(Choice* choice, jint pos);
00069 void (*addItem)(Choice* choice, const char* item);
00070 void (*removeItem)(Choice* choice, const char* item);
00071 void (*removeItemAtPos)(Choice* choice, jint pos);
00072 void (*removeAll)(Choice* choice);
00073 jint (*getItemCount)(Choice* choice);
00074 jint (*getSelectedIndex)(Choice* choice);
00075 ItemListener (*addItemListener)(Choice* choice, void (*func)(Component, jboolean, const char*));
00076 void (*removeItemListener)(Choice* choice, ItemListener il);
00077 void (*selectItem)(Choice* choice, jint item);
00078 } Choice_;
00079
00083 typedef struct ChoiceCPP_ {
00084 ChoiceData choice;
00085 struct Choice_ *functions;
00086
00087 #ifdef __cplusplus
00088 jobject getObject() {
00089 return functions->getObject(this);
00090 }
00091
00092 void setSize(jint width, jint height) {
00093 functions->setSize(this, width, height);
00094 }
00095
00096 jint getHeight() {
00097 return functions->getHeight(this);
00098 }
00099
00100 jint getWidth() {
00101 return functions->getWidth(this);
00102 }
00103
00104 void setLocation(jint x, jint y) {
00105 functions->setLocation(this, x, y);
00106 }
00107
00108 jint getX() {
00109 return functions->getX(this);
00110 }
00111
00112 jint getY() {
00113 return functions->getY(this);
00114 }
00115
00116 char* getItem(jint pos) {
00117 return functions->getItem(this, pos);
00118 }
00119
00120 void addItem(const char* item) {
00121 functions->addItem(this, item);
00122 }
00123
00124 void removeItem(const char* item) {
00125 functions->removeItem(this, item);
00126 }
00127
00128 void removeItemAtPos(jint pos) {
00129 functions->removeItemAtPos(this, pos);
00130 }
00131
00132 void removeAll() {
00133 functions->removeAll(this);
00134 }
00135
00136 jint getItemCount() {
00137 return functions->getItemCount(this);
00138 }
00139
00140 jint getSelectedIndex() {
00141 return functions->getSelectedIndex(this);
00142 }
00143
00144 ItemListener addItemListener(void (*func)(Component, jboolean, const char*)) {
00145 return functions->addItemListener(this, func);
00146 }
00147
00148 void removeItemListener(ItemListener il) {
00149 functions->removeItemListener(this, il);
00150 }
00151
00152 void selectItem(jint item) {
00153 functions->selectItem(this, item);
00154 }
00155
00156 #endif
00157 } ChoiceCPP_;
00158
00159
00160 void createChoiceC(Choice_* choice);
00161 void createChoiceCPP(ChoiceCPP_* choice);
00162 void deleteChoiceC(Choice_* choice);
00163 void deleteChoiceCPP(ChoiceCPP_* choice);
00164
00165 #ifdef __cplusplus
00166 }
00167 #endif
00168
00169 #endif
00170
00171