button.h

Go to the documentation of this file.
00001 
00012 #ifndef _BUTTON_H_
00013 #define _BUTTON_H_
00014 
00015 #include "../jnilib.h"
00016 #include "listeners.h"
00017 
00018 #ifdef __cplusplus
00019 extern "C" {
00020 #endif
00021 
00023 #define CLS_BUTTON "java/awt/Button"
00024 
00025 struct Button_;
00026 
00027 struct ButtonCPP_;
00028 
00029 #ifdef __cplusplus
00030    typedef ButtonCPP_ Button; 
00031    #define createButton createButtonCPP 
00032    #define deleteButton deleteButtonCPP 
00033 #else
00034    typedef struct Button_ Button; 
00035    #define createButton createButtonC 
00036    #define deleteButton deleteButtonC 
00037 #endif
00038 
00042 typedef struct ButtonData {
00043    jclass clsbutton; 
00044    jobject button; 
00045    jmethodID msetLabel; 
00046    jmethodID mgetLabel; 
00047 } ButtonData;
00048 
00052 typedef struct Button_ {
00053    ButtonData button;
00054    jobject (*getObject)(Button* button);
00055    void (*setLabel)(Button* button, const char* label);
00056    char* (*getLabel)(Button* button);
00057    void (*setSize)(Button* button, jint width, jint height);
00058    jint (*getHeight)(Button* button);
00059    jint (*getWidth)(Button* button);
00060    void (*setLocation)(Button* button, jint x, jint y);
00061    jint (*getX)(Button* button);
00062    jint (*getY)(Button* button);
00063    ActionListener (*addActionListener)(Button* button, void (*func)(Component));
00064    void (*removeActionListener)(Button* button, ActionListener al);
00065 } Button_;
00066 
00070 typedef struct ButtonCPP_ {
00071    ButtonData button;
00072    struct Button_ *functions;
00073 
00074 #ifdef __cplusplus
00075    jobject getObject() {
00076       return functions->getObject(this);
00077    }
00078 
00079    void setLabel(const char* label) {
00080       functions->setLabel(this, label);
00081    }
00082 
00083    char* getLabel() {
00084       return functions->getLabel(this);
00085    }
00086 
00087    void setSize(jint width, jint height) {
00088       functions->setSize(this, width, height);
00089    }
00090 
00091    jint getHeight() {
00092       return functions->getHeight(this);
00093    }
00094 
00095    jint getWidth() {
00096       return functions->getWidth(this);
00097    }
00098 
00099    void setLocation(jint x, jint y) {
00100       functions->setLocation(this, x, y);
00101    }
00102 
00103    jint getX() {
00104       return functions->getX(this);
00105    }
00106 
00107    jint getY() {
00108       return functions->getY(this);
00109    }
00110 
00111    ActionListener addActionListener(void (*func)(Component)) {
00112       return functions->addActionListener(this, func);
00113    }
00114 
00115    void removeActionListener(ActionListener al) {
00116       functions->removeActionListener(this, al);
00117    }
00118 
00119 #endif
00120 } ButtonCPP_;
00121 
00122 
00123 void createButtonC(Button_* button);
00124 void createButtonCPP(ButtonCPP_* button);
00125 void deleteButtonC(Button_* button);
00126 void deleteButtonCPP(ButtonCPP_* button);
00127 
00128 #ifdef __cplusplus
00129 } /* extern "C" */
00130 #endif
00131 
00132 #endif /* _BUTTON_H_ */
00133 
00134 /* end of file button.h */

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