list.h

Go to the documentation of this file.
00001 
00011 #ifndef _LIST_H_
00012 #define _LIST_H_
00013 
00014 #include "../jnilib.h"
00015 #include "listeners.h"
00016 
00017 #ifdef __cplusplus
00018 extern "C" {
00019 #endif
00020 
00022 #define CLS_LIST "java/awt/List"
00023 
00024 struct List_;
00025 
00026 struct ListCPP_;
00027 
00028 #ifdef __cplusplus
00029    typedef ListCPP_ List; 
00030    #define createList createListCPP 
00031    #define deleteList deleteListCPP 
00032 #else
00033    typedef struct List_ List; 
00034    #define createList createListC 
00035    #define deleteList deleteListC 
00036 #endif
00037 
00041 typedef struct ListData {
00042    jclass clslist; 
00043    jobject list; 
00044    jmethodID mgetRows; 
00045    jmethodID mgetItem; 
00046    jmethodID maddItem; 
00047    jmethodID mremoveItem; 
00048    jmethodID mremoveItemAtPos; 
00049    jmethodID mremoveAll; 
00050    jmethodID mreplaceItem; 
00051    jmethodID mgetItemCount; 
00052    jmethodID mgetSelectedIndex; 
00053    jmethodID mselectItem; 
00054    jmethodID mdeselectItem; 
00055    jmethodID misSelected; 
00056    jmethodID msetMultipleMode; 
00057    jmethodID misMultipleMode; 
00058 } ListData;
00059 
00063 typedef struct List_ {
00064    ListData list;
00065    jobject (*getObject)(List* list);
00066    void (*setSize)(List* list, jint width, jint height);
00067    jint (*getHeight)(List* list);
00068    jint (*getWidth)(List* list);
00069    void (*setLocation)(List* list, jint x, jint y);
00070    jint (*getX)(List* list);
00071    jint (*getY)(List* list);
00072    jint (*getRows)(List* list);
00073    char* (*getItem)(List* list, jint pos);
00074    void (*addItem)(List* list, const char* item, jint pos);
00075    void (*removeItem)(List* list, const char* item);
00076    void (*removeItemAtPos)(List* list, jint pos);
00077    void (*removeAll)(List* list);
00078    void (*replaceItem)(List* list, const char* item, jint pos);
00079    jint (*getItemCount)(List* list);
00080    jint (*getSelectedIndex)(List* list);
00081    ItemListener (*addItemListener)(List* list, void (*func)(Component, jboolean, const char*));
00082    void (*removeItemListener)(List* list, ItemListener il);
00083    void (*selectItem)(List* list, jint item);
00084    void (*deselectItem)(List* list, jint item);
00085    jboolean (*isSelected)(List* list, jint item);
00086    void (*setMultipleMode)(List* list, jboolean multiple);
00087    jboolean (*isMultipleMode)(List* list);
00088 } List_;
00089 
00093 typedef struct ListCPP_ {
00094    ListData list;
00095    struct List_ *functions;
00096 
00097 #ifdef __cplusplus
00098    jobject getObject() {
00099       return functions->getObject(this);
00100    }
00101 
00102    void setSize(jint width, jint height) {
00103       functions->setSize(this, width, height);
00104    }
00105 
00106    jint getHeight() {
00107       return functions->getHeight(this);
00108    }
00109 
00110    jint getWidth() {
00111       return functions->getWidth(this);
00112    }
00113 
00114    void setLocation(jint x, jint y) {
00115       functions->setLocation(this, x, y);
00116    }
00117 
00118    jint getX() {
00119       return functions->getX(this);
00120    }
00121 
00122    jint getY() {
00123       return functions->getY(this);
00124    }
00125 
00126    jint getRows() {
00127       return functions->getRows(this);
00128    }
00129 
00130    char* getItem(jint pos) {
00131       return functions->getItem(this, pos);
00132    }
00133 
00134    void addItem(const char* item, jint pos) {
00135       functions->addItem(this, item, pos);
00136    }
00137 
00138    void removeItem(const char* item) {
00139       functions->removeItem(this, item);
00140    }
00141 
00142    void removeItemAtPos(jint pos) {
00143       functions->removeItemAtPos(this, pos);
00144    }
00145 
00146    void removeAll() {
00147       functions->removeAll(this);
00148    }
00149 
00150    void replaceItem(const char* item, jint pos) {
00151       functions->replaceItem(this, item, pos);
00152    }
00153 
00154    jint getItemCount() {
00155       return functions->getItemCount(this);
00156    }
00157 
00158    jint getSelectedIndex() {
00159       return functions->getSelectedIndex(this);
00160    }
00161 
00162    ItemListener addItemListener(void (*func)(Component, jboolean, const char*)) {
00163       return functions->addItemListener(this, func);
00164    }
00165 
00166    void removeItemListener(ItemListener il) {
00167       functions->removeItemListener(this, il);
00168    }
00169 
00170    void selectItem(jint item) {
00171       functions->selectItem(this, item);
00172    }
00173 
00174    void deselectItem(jint item) {
00175       functions->deselectItem(this, item);
00176    }
00177 
00178    jboolean isSelected(jint item) {
00179       return functions->isSelected(this, item);
00180    }
00181 
00182    void setMultipleMode(jboolean multiple) {
00183       functions->setMultipleMode(this, multiple);
00184    }
00185 
00186    jboolean isMultipleMode() {
00187       return functions->isMultipleMode(this);
00188    }
00189 
00190 #endif
00191 } ListCPP_;
00192 
00193 
00194 void createListC(List_* list, jint rows);
00195 void createListCPP(ListCPP_* list, jint rows);
00196 void deleteListC(List_* list);
00197 void deleteListCPP(ListCPP_* list);
00198 
00199 #ifdef __cplusplus
00200 } /* extern "C" */
00201 #endif
00202 
00203 #endif /* _LIST_H_ */
00204 
00205 /* end of file list.h */

Generated on Sat Nov 19 14:11:11 2005 for GrubC by  doxygen 1.4.4