static void iMatrixDrawFrameRectTitle(Ihandle* ih, int lin, int col, int x1, int x2, int y1, int y2, long framecolor, char* str) { /* avoid drawing over the frame of the next cell */ x2 -= IMAT_FRAME_W/2; y2 -= IMAT_FRAME_H/2; /* right line */ iMatrixDrawFrameVertLineCell(ih, lin, col, x2, y1, y2, framecolor, str); if (col==0) { /* left line */ cdCanvasForeground(ih->data->cddbuffer, framecolor); iupMATRIX_LINE(ih, x1, y1, x1, y2); x1++; } else if (col==1 && ih->data->columns.sizes[0] == 0) { /* If does not have line titles then draw the >> left line << of the cell frame */ iMatrixDrawFrameVertLineCell(ih, lin, col-1, x1, y1, y2-1, framecolor, str); x1++; } /* Titles have a white line near the frame, at left */ cdCanvasForeground(ih->data->cddbuffer, CD_WHITE); iupMATRIX_LINE(ih, x1, y1+1, x1, y2-1); /* bottom line */ iMatrixDrawFrameHorizLineCell(ih, lin, col, x1, x2, y2, framecolor, str); if (lin==0) { /* top line */ cdCanvasForeground(ih->data->cddbuffer, framecolor); iupMATRIX_LINE(ih, x1, y1, x2, y1); y1++; } else if (lin==1 && ih->data->lines.sizes[0] == 0) { /* If does not have column titles then draw the >> top line << of the cell frame */ iMatrixDrawFrameHorizLineCell(ih, lin-1, col, x1, x2-1, y1, framecolor, str); y1++; } /* Titles have a white line near the frame, at top */ cdCanvasForeground(ih->data->cddbuffer, CD_WHITE); iupMATRIX_LINE(ih, x1, y1, x2-1, y1); }
static int iMatrixDrawFrameVertLineCell(Ihandle* ih, int lin, int col, int x, int y1, int y2, long framecolor) { int transp = iMatrixDrawGetFrameVertColor(ih, lin, col, &framecolor); if (transp) return 1; cdCanvasForeground(ih->data->cd_canvas, framecolor); iupMATRIX_LINE(ih, x, y1, x, y2); /* right vertical line */ return 0; }
static int iMatrixDrawFrameHorizLineCell(Ihandle* ih, int lin, int col, int x1, int x2, int y, long framecolor) { int transp = iMatrixDrawGetFrameHorizColor(ih, lin, col, &framecolor); if (transp) return 1; cdCanvasForeground(ih->data->cd_canvas, framecolor); iupMATRIX_LINE(ih, x1, y, x2, y); /* bottom horizontal line */ return 0; }
static int iMatrixDrawFrameHorizLineHighlight(Ihandle* ih, int lin, int col, int x1, int x2, int y, long framecolor) { if (lin > 0) { int transp = iMatrixDrawGetFrameHorizColor(ih, lin-1, col, &framecolor); if (transp) return 1; } cdCanvasForeground(ih->data->cd_canvas, CD_WHITE); iupMATRIX_LINE(ih, x1, y, x2, y); return 0; }
static int iMatrixDrawFrameVertLineHighlight(Ihandle* ih, int lin, int col, int x, int y1, int y2, long framecolor) { if (col > 0) { int transp = iMatrixDrawGetFrameVertColor(ih, lin, col-1, &framecolor); if (transp) return 1; } cdCanvasForeground(ih->data->cd_canvas, CD_WHITE); iupMATRIX_LINE(ih, x, y1, x, y2); return 0; }
static void iMatrixDrawFrameVertLineCell(Ihandle* ih, int lin, int col, int x, int y1, int y2, long framecolor, char* str) { if (ih->data->checkframecolor && (ih->data->callback_mode || ih->data->cells[lin][col].flags & IMAT_HAS_FRAMEVCOLOR || ih->data->columns.flags[col] & IMAT_HAS_FRAMEVCOLOR)) { char* color; unsigned char r,g,b; sprintf(str, "FRAMEVERTCOLOR%d:%d", lin, col); color = iupAttribGet(ih, str); if (!color) { sprintf(str, "FRAMEVERTCOLOR*:%d", col); color = iupAttribGet(ih, str); } if (iupStrEqual(color, "BGCOLOR")) return; if (iupStrToRGB(color, &r, &g, &b)) framecolor = cdEncodeColor(r, g, b); } cdCanvasForeground(ih->data->cddbuffer, framecolor); iupMATRIX_LINE(ih, x, y1, x, y2); /* right vertical line */ }
static void iMatrixDrawFrameHorizLineCell(Ihandle* ih, int lin, int col, int x1, int x2, int y, long framecolor, char* str) { if (ih->data->checkframecolor && (ih->data->callback_mode || ih->data->cells[lin][col].flags & IMAT_HAS_FRAMEHCOLOR || ih->data->lines.flags[col] & IMAT_HAS_FRAMEHCOLOR)) { char* color; unsigned char r,g,b; sprintf(str, "FRAMEHORIZCOLOR%d:%d", lin, col); color = iupAttribGet(ih, str); if (!color) { sprintf(str, "FRAMEHORIZCOLOR%d:*", lin); color = iupAttribGet(ih, str); } if (iupStrEqual(color, "BGCOLOR")) return; if (iupStrToRGB(color, &r, &g, &b)) framecolor = cdEncodeColor(r, g, b); } cdCanvasForeground(ih->data->cddbuffer, framecolor); iupMATRIX_LINE(ih, x1, y, x2, y); /* bottom horizontal line */ }
static void iMatrixDrawToggle(Ihandle* ih, int x2, int y1, int y2, int lin, int col, int marked, int active) { int x1; long bgcolor = ih->data->bgcolor_cd; /* toggle area */ iupMatrixDrawSetToggleArea(&x1, &y1, &x2, &y2); /* toggle background */ if (marked) { unsigned char bg_r, bg_g, bg_b; cdDecodeColor(bgcolor, &bg_r, &bg_g, &bg_b); bg_r = IMAT_ATENUATION(bg_r); bg_g = IMAT_ATENUATION(bg_g); bg_b = IMAT_ATENUATION(bg_b); bgcolor = cdEncodeColor(bg_r, bg_g, bg_b); } cdCanvasForeground(ih->data->cd_canvas, bgcolor); iupMATRIX_BOX(ih, x1, x2, y1, y2); /* toggle frame */ iMatrixDrawSetFgColor(ih, lin, col, marked, active); iupMATRIX_RECT(ih, x1, x2, y1, y2); /* toggle check */ if (iupAttribGetIntId2(ih, "TOGGLEVALUE", lin, col)) { int half = IMAT_TOGGLE_SIZE/2; iupMATRIX_LINE(ih, x1 + half - 2, y2 - 2, x1 + half - 2 + 6, y2 - 2 - 6); iupMATRIX_LINE(ih, x1 + half - 2, y2 - 3, x1 + half - 2 + 6, y2 - 3 - 6); iupMATRIX_LINE(ih, x1 + half - 2, y2 - 4, x1 + half - 2 + 5, y2 - 4 - 5); iupMATRIX_LINE(ih, x1 + half - 2, y2 - 2, x1 + half - 2 - 2, y2 - 2 - 2); iupMATRIX_LINE(ih, x1 + half - 2, y2 - 3, x1 + half - 2 - 2, y2 - 3 - 2); iupMATRIX_LINE(ih, x1 + half - 2, y2 - 4, x1 + half - 2 - 1, y2 - 4 - 1); } }