00001
00011 #ifndef _PANEL_H_
00012 #define _PANEL_H_
00013
00014 #include "../jnilib.h"
00015 #include "listeners.h"
00016
00017 #ifdef __cplusplus
00018 extern "C" {
00019 #endif
00020
00022 #define CLS_PANEL "java/awt/Panel"
00023
00024 struct Panel_;
00025
00026 struct PanelCPP_;
00027
00028 #ifdef __cplusplus
00029 typedef PanelCPP_ Panel;
00030 #define createPanel createPanelCPP
00031 #define deletePanel deletePanelCPP
00032 #else
00033 typedef struct Panel_ Panel;
00034 #define createPanel createPanelC
00035 #define deletePanel deletePanelC
00036 #endif
00037
00041 typedef struct PanelData {
00042 jclass clspanel;
00043 jobject panel;
00044 } PanelData;
00045
00049 typedef struct Panel_ {
00050 PanelData panel;
00051 jobject (*getObject)(Panel* panel);
00052 void (*setSize)(Panel* panel, jint width, jint height);
00053 jint (*getHeight)(Panel* panel);
00054 jint (*getWidth)(Panel* panel);
00055 void (*setLocation)(Panel* panel, jint x, jint y);
00056 jint (*getX)(Panel* panel);
00057 jint (*getY)(Panel* panel);
00058 void (*setForegroundColor)(Panel* panel, Color c);
00059 Color (*getForegroundColor)(Panel* panel);
00060 void (*setBackgroundColor)(Panel* panel, Color c);
00061 Color (*getBackgroundColor)(Panel* panel);
00062
00063 MouseListener (*addMouseListener)(Panel* panel, void (*func)(jint, Component, jint, jint, jint, jint));
00064 void (*removeMouseListener)(Panel* panel, MouseListener ml);
00065 ComponentListener (*addComponentListener)(Panel* panel, void (*func)(jint, Component));
00066 void (*removeComponentListener)(Panel* panel, ComponentListener cl);
00067
00068 void (*setLayout)(Panel* panel, jobject layoutmanager);
00069 void (*addComponent)(Panel* panel, jobject comp);
00070 void (*addComponentWithConstraint)(Panel* panel, jobject comp, jobject constraint);
00071 } Panel_;
00072
00076 typedef struct PanelCPP_ {
00077 PanelData panel;
00078 struct Panel_ *functions;
00079
00080 #ifdef __cplusplus
00081 jobject getObject() {
00082 return functions->getObject(this);
00083 }
00084
00085 void setSize(jint width, jint height) {
00086 functions->setSize(this, width, height);
00087 }
00088
00089 jint getHeight() {
00090 return functions->getHeight(this);
00091 }
00092
00093 jint getWidth() {
00094 return functions->getWidth(this);
00095 }
00096
00097 void setLocation(jint x, jint y) {
00098 functions->setLocation(this, x, y);
00099 }
00100
00101 jint getX() {
00102 return functions->getX(this);
00103 }
00104
00105 jint getY() {
00106 return functions->getY(this);
00107 }
00108
00109 void setForegroundColor(Color c) {
00110 functions->setForegroundColor(this, c);
00111 }
00112
00113 Color getForegroundColor() {
00114 return functions->getForegroundColor(this);
00115 }
00116
00117 void setBackgroundColor(Color c) {
00118 functions->setBackgroundColor(this, c);
00119 }
00120
00121 Color getBackgroundColor() {
00122 return functions->getBackgroundColor(this);
00123 }
00124
00125 MouseListener addMouseListener(void (*func)(jint, Component, jint, jint, jint, jint)) {
00126 return functions->addMouseListener(this, func);
00127 }
00128
00129 void removeMouseListener(MouseListener ml) {
00130 functions->removeMouseListener(this, ml);
00131 }
00132
00133 ComponentListener addComponentListener(void (*func)(jint, Component)) {
00134 return functions->addComponentListener(this, func);
00135 }
00136
00137 void removeComponentListener(ComponentListener cl) {
00138 functions->removeComponentListener(this, cl);
00139 }
00140
00141 void setLayout(jobject layoutmanager) {
00142 functions->setLayout(this, layoutmanager);
00143 }
00144
00145 void addComponent(jobject comp) {
00146 functions->addComponent(this, comp);
00147 }
00148
00149 void addComponentWithConstraint(jobject comp, jobject constraint) {
00150 functions->addComponentWithConstraint(this, comp, constraint);
00151 }
00152 #endif
00153
00154 } PanelCPP_;
00155
00156
00157 void createPanelC(Panel_* panel);
00158 void createPanelCPP(PanelCPP_* panel);
00159 void deletePanelC(Panel_* panel);
00160 void deletePanelCPP(PanelCPP_* panel);
00161
00162 #ifdef __cplusplus
00163 }
00164 #endif
00165
00166 #endif
00167
00168