Example #1
0
static void DrawSpinBoxHorz (HDC hdc, SPININFO* spinfo , SPINDATA* psd, DWORD dwStyle)
{
    BOOL flag = !(dwStyle & SPS_AUTOSCROLL);
    int x = 0;

    if ((dwStyle & SPS_TYPE_MASK) == SPS_TYPE_NORMAL
            || (dwStyle & SPS_TYPE_MASK) == SPS_TYPE_UPARROW) {
        if (spinfo->cur > spinfo->min || (flag && psd->canup)) {
            FillBoxWithBitmapPart (hdc, 0, 0, SPINBOX_HORZ_WIDTH, SPINBOX_HORZ_HEIGHT, 0, 0,
                    bmp_spinbox_h, 0, 0);
        }
        else {
            FillBoxWithBitmapPart (hdc, 0, 0, SPINBOX_HORZ_WIDTH, SPINBOX_HORZ_HEIGHT, 0, 0,
                    bmp_spinbox_h, SPINBOX_HORZ_WIDTH, 0);
        }

        x = SPINBOX_HORZ_WIDTH + 2;
    }

    if ((dwStyle & SPS_TYPE_MASK) == SPS_TYPE_NORMAL
            || (dwStyle & SPS_TYPE_MASK) == SPS_TYPE_DOWNARROW) {
        if (spinfo->cur < spinfo->max || (flag && psd->candown)) {
            FillBoxWithBitmapPart (hdc, x, 0, SPINBOX_HORZ_WIDTH, SPINBOX_HORZ_HEIGHT, 0, 0,
                    bmp_spinbox_h, SPINBOX_HORZ_WIDTH*2, 0);
        }
        else {
            FillBoxWithBitmapPart (hdc, x, 0, SPINBOX_HORZ_WIDTH, SPINBOX_HORZ_HEIGHT, 0, 0,
                    bmp_spinbox_h, SPINBOX_HORZ_WIDTH*3, 0);
        }
    }
}
Example #2
0
static void DrawSpinBoxVert (HDC hdc, SPININFO* spinfo , SPINDATA* psd, DWORD dwStyle)
{
    BOOL flag = !(dwStyle & SPS_AUTOSCROLL);
    int y = 0;

    if ((dwStyle & SPS_TYPE_MASK) == SPS_TYPE_NORMAL
            || (dwStyle & SPS_TYPE_MASK) == SPS_TYPE_UPARROW) {
        if (spinfo->cur > spinfo->min || (flag && psd->canup)) {
            FillBoxWithBitmapPart (hdc, 0, 0, SPINBOX_VERT_WIDTH, SPINBOX_VERT_HEIGHT, 0, 0,
                    bmp_spinbox_v, 0, 0);
        }
        else {
            FillBoxWithBitmapPart (hdc, 0, 0, SPINBOX_VERT_WIDTH, SPINBOX_VERT_HEIGHT, 0, 0,
                    bmp_spinbox_v, 0, SPINBOX_VERT_HEIGHT);
        }

        y = SPINBOX_VERT_HEIGHT + 2;
    }

    if ((dwStyle & SPS_TYPE_MASK) == SPS_TYPE_NORMAL
            || (dwStyle & SPS_TYPE_MASK) == SPS_TYPE_DOWNARROW) {
        if (spinfo->cur < spinfo->max || (flag && psd->candown)) {
            FillBoxWithBitmapPart (hdc, 0, y, SPINBOX_VERT_WIDTH, SPINBOX_VERT_HEIGHT, 0, 0,
                    bmp_spinbox_v, 0, SPINBOX_VERT_HEIGHT*2);
        }
        else {
            FillBoxWithBitmapPart (hdc, 0, y, SPINBOX_VERT_WIDTH, SPINBOX_VERT_HEIGHT, 0, 0,
                    bmp_spinbox_v, 0, SPINBOX_VERT_HEIGHT*3);
        }
    }
}
Example #3
0
static void button_draw_bg (HDC hdc, skin_item_t *item)
{
	const BITMAP* bmp = &item->hostskin->bmps[item->bmp_index];
	int w = bmp->bmWidth / (item->style & SI_CMDBUTTON_2STATE?2:4);
	int h = bmp->bmHeight;
	int style_no = 0;

	if (item->style & SI_STATUS_HILIGHTED) {
        if (item->style & SI_CMDBUTTON_2STATE) 
		    style_no = 0;
        else
		    style_no = 1;
    }

	if (item->style & SI_BTNSTATUS_CLICKED)
		style_no = 2;

	if (item->style & SI_STATUS_DISABLED) {
        if (item->style & SI_CMDBUTTON_2STATE) 
		    style_no = 0;
        else
		    style_no = 3;
    }

	FillBoxWithBitmapPart (hdc,	item->x, item->y, w, h, 0, 0, bmp, style_no*w, 0);
}
Example #4
0
static void slider_draw_attached (HDC hdc, skin_item_t* item)
{
	int pos_min, pos_max, x, y, w, h;
    si_nrmslider_t* slider = (si_nrmslider_t*) item->type_data;
	double percent;
    
    if ( slider->slider_info.cur_pos < slider->slider_info.min_pos ) 
        slider->slider_info.cur_pos = slider->slider_info.min_pos;
	if ( slider->slider_info.cur_pos > slider->slider_info.max_pos )
        slider->slider_info.cur_pos = slider->slider_info.max_pos;

    percent = (slider->slider_info.cur_pos - slider->slider_info.min_pos) * 1. /
					 (slider->slider_info.max_pos - slider->slider_info.min_pos);
					 
	if (item->style & SI_NRMSLIDER_HORZ) {	/* - */
		pos_min = item->rc_hittest.left;
		pos_max = item->rc_hittest.right - BMP(item, slider->thumb_bmp_index).bmWidth;
		x = pos_min + (pos_max - pos_min) * percent; 
		y = item->rc_hittest.top;
		// pbar
		w = RECTW(item->rc_hittest) * percent;
		h = RECTH(item->rc_hittest);

        h = h < BMP(item, slider->thumb_bmp_index).bmHeight ? 
            h : BMP(item, slider->thumb_bmp_index).bmHeight; 
	}
	else{	/* | */
		pos_min = item->rc_hittest.top;
		pos_max = item->rc_hittest.bottom - BMP(item, slider->thumb_bmp_index).bmHeight;
		y = pos_min + (pos_max - pos_min) * percent;
		x = item->rc_hittest.left;
		// pbar
		h = RECTH(item->rc_hittest) * percent;
		w = RECTW(item->rc_hittest);

        w = w < BMP(item, slider->thumb_bmp_index).bmWidth? 
            w : BMP(item, slider->thumb_bmp_index).bmWidth; 
	}
	if ( item->style & SI_NRMSLIDER_STATIC )
		FillBoxWithBitmap ( hdc, item->rc_hittest.left, item->rc_hittest.top, 
							w, h, &BMP(item, slider->thumb_bmp_index) );
	else
    	FillBoxWithBitmapPart ( hdc, x, y, 
								BMP(item, slider->thumb_bmp_index).bmWidth,
								BMP(item, slider->thumb_bmp_index).bmHeight,
								0, 0, 
								&BMP(item, slider->thumb_bmp_index),
								0, 0);
}
static void
draw_ball (HDC hdc, int x, int y)
{
    int bx, by;

    if (field [x][y].color){
        by = STONE_SIZE * (field [x][y].color - 1);
        bx = STONE_SIZE * (field [x][y].frame);
        
        FillBoxWithBitmapPart (hdc, x * STONE_SIZE, y * STONE_SIZE, 
                 STONE_SIZE, STONE_SIZE, 0, 0, &stones,
                 bx, by);
    } else {
        SetBrushColor (hdc, PIXEL_black);
        FillBox (hdc, x * STONE_SIZE, y * STONE_SIZE,
                       STONE_SIZE, STONE_SIZE);
    }
}