glCompButton *glCompButtonNew(glCompObj* par,GLfloat x, GLfloat y, GLfloat w, GLfloat h,char *caption)
{
glCompButton *p;
- glCompCommon* parent=&par->common;
+// glCompCommon* parent=&par->common;
p = malloc(sizeof(glCompButton));
glCompInitCommon((glCompObj*)p,par,x,y);
p->objType=glButtonObj;
glCompDrawRectPrism (&(ref.pos),ref.width,ref.height,p->common.borderWidth,0.01,&(ref.color),!p->status);
if (p->label)
p->label->common.functions.draw(p->label);
- if(p->image)
- p->image->common.functions.draw((glCompObj*)p->image);
+ if (p->image)
+ p->image->common.functions.draw(p->image);
if (p->common.callbacks.draw)
p->common.callbacks.draw(p); /*user defined drawing routines are called here.*/
}
else p->status = 0;
}
if (p->common.callbacks.click)
- p->common.callbacks.click(p,x,y,t);
+ p->common.callbacks.click((glCompObj*)p,x,y,t);
}
void glCompButtonDoubleClick(glCompObj * obj,GLfloat x,GLfloat y,glMouseButtonType t)
typedef enum {glTexImage,glTexLabel} glCompTexType;
typedef enum {glPanelObj,glButtonObj,glLabelObj,glImageObj}glObjType;
+typedef struct _glCompButton glCompButton;
+typedef struct _glCompObj glCompObj;
/*call backs for widgets*/
-typedef void (*glcompdrawfunc_t) (void* obj);
-typedef void (*glcompclickfunc_t) (void* obj,GLfloat x,GLfloat y,glMouseButtonType t);
-typedef void (*glcompdoubleclickfunc_t) (void* obj,GLfloat x,GLfloat y,glMouseButtonType t);
-typedef void (*glcompmouseoverfunc_t) (void* obj,GLfloat x,GLfloat y);
-typedef void (*glcompmouseinfunc_t) (void* obj,GLfloat x,GLfloat y);
-typedef void (*glcompmouseoutfunc_t) (void* obj,GLfloat x,GLfloat y);
-typedef void (*glcompmousedownfunc_t) (void* obj,GLfloat x,GLfloat y,glMouseButtonType t);
-typedef void (*glcompmouseupfunc_t) (void* obj,GLfloat x,GLfloat y,glMouseButtonType t);
-typedef void (*glcompmousedragfunct_t) (void* obj,GLfloat dx,GLfloat dy,glMouseButtonType t);
-
-
+typedef void (*glcompdrawfunc_t) (glCompButton* obj);
+typedef void (*glcompclickfunc_t) (glCompObj* obj,GLfloat x,GLfloat y,glMouseButtonType t);
+typedef void (*glcompdoubleclickfunc_t) (glCompObj* obj,GLfloat x,GLfloat y,glMouseButtonType t);
+typedef void (*glcompmouseoverfunc_t) (glCompObj* obj,GLfloat x,GLfloat y);
+typedef void (*glcompmouseinfunc_t) (glCompObj* obj,GLfloat x,GLfloat y);
+typedef void (*glcompmouseoutfunc_t) (glCompObj* obj,GLfloat x,GLfloat y);
+typedef void (*glcompmousedownfunc_t) (glCompObj* obj,GLfloat x,GLfloat y,glMouseButtonType t);
+typedef void (*glcompmouseupfunc_t) (glCompObj* obj,GLfloat x,GLfloat y,glMouseButtonType t);
+typedef void (*glcompmousedragfunct_t) (glCompObj* obj,GLfloat dx,GLfloat dy,glMouseButtonType t);
typedef struct _glCompTex
{
- int id;
+ GLuint id;
char* def;
char* text;
float width;
} glCompLabel;
/*buttons*/
-typedef struct _glCompButton {
+struct _glCompButton
+{
glObjType objType; /*always keep this here for each drawable object*/
glCompCommon common;
GLfloat width, height;
void *customptr; //general purpose void pointer to pass to call back
int data;
-} glCompButton;
+};
/*texture based image*/
}fontset_t;
/*object prototype*/
-typedef struct {
+struct _glCompObj
+{
glObjType objType;
glCompCommon common;
-}glCompObj;
+};
typedef struct _glCompMouse
{
GLfloat width, char *bf, int usez)
{
- GLfloat size = font->size;
- GLfloat x = xpos;
- GLfloat y = ypos;
+// GLfloat size = font->size;
+// GLfloat x = xpos;
+// GLfloat y = ypos;
//set the color
glColor4f(font->color.R, font->color.G, font->color.B, font->color.A);
GLfloat x,y,z,w,h;
if (!f->tex)
return ;
+ x=0;
+ y=0;
w=f->tex->width;
h=f->tex->height;
ref=parentObj->common;
if(data != NULL) /*valid image data*/
{
glCompDeleteTexture(i->texture);
- if(i->texture=glCompSetAddNewTexImage(i->common.compset,width,height,data,1))
+ i->texture=glCompSetAddNewTexImage(i->common.compset,width,height,data,1);
+ if(i->texture)
{
i->common.width=width;
i->common.height=height;
{
glCompImage* p;
static glCompCommon ref;
- static GLfloat w,h,d;
+// static GLfloat w,h,d;
p=(glCompImage*)obj;
ref=p->common;
glCompCalcWidget((glCompCommon*)p->common.parent,&p->common,&ref);
glCompLabel *glCompLabelNew(glCompObj* par,GLfloat x, GLfloat y,char *text)
{
glCompLabel *p;
- glCompCommon* parent=&par->common;
+// glCompCommon* parent=&par->common;
p = malloc(sizeof(glCompLabel));
glCompInitCommon((glCompObj*)p,par,x,y);
p->objType=glLabelObj;
glCompPanel *glCompPanelNew(glCompObj* parentObj,GLfloat x, GLfloat y, GLfloat w, GLfloat h)
{
glCompPanel *p;
- glCompCommon* parent=&parentObj->common;
+// glCompCommon* parent=&parentObj->common;
p = malloc(sizeof(glCompPanel));
glCompInitCommon((glCompObj*)p,parentObj,(GLfloat)x ,(GLfloat)y);
}
}
+
static int glCompPointInObject(glCompObj* p, float x, float y)
{
return ((x > p->common.refPos.x) && (x < p->common.refPos.x + p->common.width) && (y > p->common.refPos.y) && (y < p->common.refPos.y + p->common.height));
}
+
glCompObj* glCompGetObjByMouse(glCompSet* s ,glCompMouse* m,int onlyClickable)
{
- int ind=0;
+ int ind;
glCompObj* rv=NULL;
if (!s || !m)
return NULL;
- for (ind ; ind < s->objcnt ; ind ++)
+ for (ind=0 ; ind < s->objcnt ; ind ++)
{
if ((s->obj[ind]->common.visible)&&(glCompPointInObject(s->obj[ind],m->pos.x,m->pos.y)))
{
s->obj[s->objcnt - 1] = obj;
obj->common.compset=s;
}
+
+#if 0
+// compiler reports this function is not used.
+
//converts screen location to opengl coordinates
static void glCompSetGetPos(int x, int y, float *X, float *Y, float *Z)
{
*Y = (float) posY;
*Z = (float) posZ;
}
+#endif
void glCompDrawBegin(void) //pushes a gl stack
{
glCompTex* glCompSetAddNewTexLabel(glCompSet* s, char* def,int fs,char* text,int is2D)
{
int ind,Er,width,height;
- int ind2=0;
+// int ind2=0;
glCompTex* t;
cairo_surface_t *surface=NULL;
unsigned char* data;
unsigned char* create_pango_texture(char *fontdescription,int fontsize,char* txt,cairo_surface_t *surface,int* w,int* h)
{
- char buf[] = " ";
- int ncolumns = 16;
- int counter = 0;
- int X = 0;
- int Y = 0;
+// char buf[] = " ";
+// int ncolumns = 16;
+// int counter = 0;
+// int X = 0;
+// int Y = 0;
cairo_t *cr;
PangoLayout *layout;
double width, height;
ref->width=parent->width-2*borderWidth;;
ref->height=parent->height-2*borderWidth;
break;
+ case glAlignCenter:
+ case glAlignNone:
+ break;
}
if(child->align == glAlignNone) // No alignment , chekc anchors
{
child->width=ref->width;
child->height=ref->height;
}
+
+#if 0
+// compiler reports this function is not used
+
static void glCompVertex(glCompPoint* p)
{
glVertex3f(p->x,p->y,p->z);
}
+#endif
+
static void glCompQuadVertex(glCompPoint* p0,glCompPoint* p1,glCompPoint* p2,glCompPoint* p3)
{
glVertex3f(p0->x,p0->y,p0->z);