static void iMatrixDrawComboFeedback(Ihandle* ih, int x2, int y1, int y2, int active, long framecolor) { int xh2, yh2, x1; /* feedback area */ x2 -= IMAT_PADDING_W/2 + IMAT_FRAME_W/2; x1 = x2 - IMAT_COMBOBOX_W; y1 += IMAT_PADDING_H/2 + IMAT_FRAME_H/2; y2 -= IMAT_PADDING_H/2 + IMAT_FRAME_H/2; /* feedback background */ iMatrixDrawSetBgColor(ih, 0, 0, 0, active); iupMATRIX_BOX(ih, x1, x2, y1, y2); /* feedback frame */ cdCanvasForeground(ih->data->cddbuffer, framecolor); iupMATRIX_RECT(ih, x1, x2, y1, y2); /* feedback arrow */ xh2 = x2 - IMAT_COMBOBOX_W / 2; yh2 = y2 - (y2 - y1) / 2; cdCanvasBegin(ih->data->cddbuffer, CD_FILL); iupMATRIX_VERTEX(ih, xh2, yh2 + 3); iupMATRIX_VERTEX(ih, xh2 + 4, yh2 - 1); iupMATRIX_VERTEX(ih, xh2 - 4, yh2 - 1); cdCanvasEnd(ih->data->cddbuffer); }
static void iMatrixDrawDropFeedback(Ihandle* ih, int x2, int y1, int y2, int active, long framecolor) { int xh2, yh2, x1; /* feedback area */ iupMatrixDrawSetDropFeedbackArea(&x1, &y1, &x2, &y2); /* feedback background */ iMatrixDrawSetBgColor(ih, 0, 0, 0, active); iupMATRIX_BOX(ih, x1, x2, y1, y2); /* feedback frame */ cdCanvasForeground(ih->data->cd_canvas, framecolor); iupMATRIX_RECT(ih, x1, x2, y1, y2); /* feedback arrow */ xh2 = x2 - IMAT_DROPBOX_W/2; yh2 = y2 - (y2 - y1)/2; cdCanvasBegin(ih->data->cd_canvas, CD_FILL); iupMATRIX_VERTEX(ih, xh2, yh2 + 3); iupMATRIX_VERTEX(ih, xh2 + 4, yh2 - 1); iupMATRIX_VERTEX(ih, xh2 - 4, yh2 - 1); cdCanvasEnd(ih->data->cd_canvas); }
static void iMatrixDrawColor(Ihandle* ih, int x1, int x2, int y1, int y2, int marked, int active, const char* color, long framecolor) { x1 += IMAT_PADDING_W/2 + IMAT_FRAME_H/2; x2 -= IMAT_PADDING_W/2 + IMAT_FRAME_W/2; y1 += IMAT_PADDING_H/2 + IMAT_FRAME_H/2; y2 -= IMAT_PADDING_H/2 + IMAT_FRAME_H/2; /* Fill the box with the color */ iMatrixDrawSetTypeColor(ih, color, marked, active); iupMATRIX_BOX(ih, x1, x2, y1, y2); /* Draw the frame */ cdCanvasForeground(ih->data->cd_canvas, framecolor); iupMATRIX_RECT(ih, x1, x2, y1, y2); }
static void iMatrixDrawFill(Ihandle* ih, int x1, int x2, int y1, int y2, int marked, int active, int lin, int col, const char* value, long framecolor) { int empty, fill=0; iupStrToInt(value, &fill); if (fill < 0) fill = 0; if (fill > 100) fill = 100; /* Create an space between text and cell frame */ x1 += IMAT_PADDING_W/2; x2 -= IMAT_PADDING_W/2; y1 += IMAT_PADDING_H/2; y2 -= IMAT_PADDING_H/2; empty = ((x2-x1)*(100-fill))/100; /* Fill the box with the color */ iMatrixDrawSetFgColor(ih, lin, col, marked, active); iupMATRIX_BOX(ih, x1, x2 - empty, y1, y2); if (ih->data->show_fill_value) { int y = (int)((y1 + y2) / 2.0 - 0.5); int empty1 = ((x2-x1)*fill)/100; char text[50]; sprintf(text, "%d%%", fill); IupCdSetFont(ih, ih->data->cd_canvas, iupMatrixGetFont(ih, lin, col)); cdCanvasTextAlignment(ih->data->cd_canvas, CD_CENTER); iMatrixDrawSetCellClipping(ih, x1 + empty1, x2, y1, y2); iupMATRIX_TEXT(ih, (x1 + x2) / 2, y, text); iMatrixDrawResetCellClipping(ih); iMatrixDrawSetBgColor(ih, lin, col, marked, active); iMatrixDrawSetCellClipping(ih, x1, x2 - empty, y1, y2); iupMATRIX_TEXT(ih, (x1 + x2) / 2, y, text); iMatrixDrawResetCellClipping(ih); } /* Draw the frame */ cdCanvasForeground(ih->data->cd_canvas, framecolor); iupMATRIX_RECT(ih, x1, x2, y1, y2); }
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); } }