示例#1
0
文件: screen.c 项目: base698/ProQCC
void 
ScrollText(void)
{
#ifdef UNIX
    register int i;

    /*
     * Ugh, is this dirty.
     * A better approach would be to use subwin() and
     * scroll the subwindow, but this doesn't work
     * very well in some versions of ncurses.
     */
//    for (i = 5; i < ScrnHeight - 2; i++)
    /* This is actually ncurses/curses dependant */
//#if defined(linux) || defined(_linux)
//	memcpy(stdscr->_line[i].text, stdscr->_line[i+1].text,
//#else
//	memcpy(stdscr->_line[i], stdscr->_line[i + 1],
//#endif
//		42 * sizeof(chtype));
    touchline(stdscr, 5, ScrnHeight - 2);
    SetColor();
    FillBox(1, ScrnHeight - 2, 42, 1, ' ');
    refresh();
#else
    CopyText(2, 8, 42, ScrnHeight - 9, 2, 7);
    FillBox(1, ScrnHeight - 2, 42, 1, ' ');
#endif
}
示例#2
0
文件: button.c 项目: VVillwin/minigui
static void fill_corner(HDC hdc, int left, int top,
                 int right, int bottom, int corner, gal_pixel fillc)
{
    SetBrushColor(hdc, fillc);
    FillBox(hdc, left, top, corner, corner);
    FillBox(hdc, right-corner, top, corner, corner);
    FillBox(hdc, right-corner, bottom-corner, corner, corner);
    FillBox(hdc, left, bottom-corner, corner, corner);
}
示例#3
0
/*
 *                       
 *         
 *                                  ¨x¨x¨x¨x¨x¨x¨xtop_line(dark)
 *                                   ---------top_line(light)
 *                                ¨† ¨‡        ¨‡¨†
 *        left_line(dark+light)   ¨† ¨‡        ¨‡¨†right_line(light+dark)
 *                                ¨† ¨‡        ¨‡¨†
 *    base_line_left ¨{¨{¨{¨{¨{¨{¨{                ¨{¨{¨{¨{¨{¨{¨{ base_line_right
 */
static void draw_hilight_box (HWND hWnd, HDC hdc, COOL_INDICATOR_ITEMDATA* item)
{
    int  l,r,t,b; 
    WINDOWINFO *info = (WINDOWINFO*)GetWindowInfo (hWnd);
    DWORD color;
    DWORD mainc = GetWindowElementAttr (hWnd, WE_FGC_THREED_BODY);	//UI@hilight_box_color
    
	if(item == NULL)
		return;

    l = item->RcTitle.left;
    t = item->RcTitle.top + 2;
    r = item->RcTitle.right + 1;
    b = item->RcTitle.bottom + 1;

    color = info->we_rdr->calc_3dbox_color (mainc, LFRDR_3DBOX_COLOR_DARKER);
    SetPenColor (hdc, RGBA2Pixel (hdc, GetRValue (color), GetGValue (color), GetBValue (color), GetAValue (color)));
    MoveTo (hdc, l, t);
    LineTo (hdc, l, b);	//left_line_dark
    MoveTo (hdc, r, t);
    LineTo (hdc, r, b);	//right_line_dark

	MoveTo (hdc, l, t);
	LineTo (hdc, r, t);	//top_line_dark

    color = info->we_rdr->calc_3dbox_color (mainc, LFRDR_3DBOX_COLOR_LIGHTER);
    SetPenColor (hdc, RGBA2Pixel (hdc, GetRValue (color), GetGValue (color), GetBValue (color), GetAValue (color)));
    MoveTo (hdc, l + 1, t);
    LineTo (hdc, l + 1, b);	//left_line_light
    MoveTo (hdc, r - 1, t);
    LineTo (hdc, r - 1, b);	//right_line_light

	MoveTo (hdc, l, t+1);
	LineTo (hdc, r, t+1);	//top_line_light

	mainc = GetWindowElementPixelEx(hWnd, hdc, WE_FGC_THREED_BODY);	//to avoid hdc use the color as ARGB
	SetBrushColor(hdc, mainc);	//base line color

	RECT rP;
	GetWindowRect(GetParent(hWnd), &rP);
	int x, y, w, h;
	x = 0;
	y = item->RcTitle.bottom + 2;
	w = item->RcTitle.left + 2;
	h = 4;
	FillBox(hdc, x, y, w, h);	//base_line_left
	x = item->RcTitle.right + 1;
	y = item->RcTitle.bottom + 2;
	w = RECTW(rP) - x;
	h = 4;
	FillBox(hdc, x, y, w, h);	//base_line_right
}
示例#4
0
static void setup_anim_mem_dc (HWND hwnd, ANIMATIONINFO* anim_info)
{
    gal_pixel bk_pixel;
    HDC hdc;

    if (!anim_info->anim)
        return;

    if (anim_info->mem_dc)
        DeleteCompatibleDC (anim_info->mem_dc);
    hdc = GetClientDC (hwnd);
#ifdef _USE_NEWGAL
    anim_info->mem_dc = CreateCompatibleDCEx (hdc,
                    anim_info->anim->width, anim_info->anim->height);
#else
    anim_info->mem_dc = CreateCompatibleDC (hdc);
#endif

    if (GetWindowExStyle (hwnd) & WS_EX_TRANSPARENT)
        bk_pixel = GetWindowBkColor (GetParent (hwnd));
    else
        bk_pixel = GetWindowBkColor (hwnd);

    SetBkColor (anim_info->mem_dc, bk_pixel);
    SetBrushColor (anim_info->mem_dc, bk_pixel);
    FillBox (anim_info->mem_dc, 0, 0,
            GetGDCapability (hdc, GDCAP_MAXX)+1,
            GetGDCapability (hdc, GDCAP_MAXY)+1);

    ReleaseDC (hdc);
}
示例#5
0
static int DrawYSpace ( HDC hdc, int x, int y, int w, int h, PSCOLORDIA scld)
{
    int i;
    Uint8 r, g, b;
    HDC mdc;
    
    mdc = CreateCompatibleDCEx (hdc, scld->ysp_w, 256);
    for (i = 0; i < 256; i ++) {
        HSV2RGB (scld->clrh, scld->clrs, i, &r, &g, &b );
        SetPenColor (mdc, RGB2Pixel(mdc, r, g, b));
        MoveTo (mdc, 0, i);
        LineTo (mdc, 20 * scld->SCALE_W, i);
    }
    SetBrushColor (mdc, PIXEL_lightgray);
    FillBox (mdc, 21 * scld->SCALE_W, 0, scld->ysp_w * scld->SCALE_W, 256);
    scld->pz = scld->clrv ;
    SetPenColor (mdc, RGB2Pixel(mdc, 0, 0, 0));
    MoveTo ( mdc, 21 * scld->SCALE_W, scld->pz);
    LineTo ( mdc, 28 * scld->SCALE_W, scld->pz-3);
    MoveTo ( mdc, 21 * scld->SCALE_W, scld->pz);
    LineTo ( mdc, 28 * scld->SCALE_W, scld->pz+3);
    StretchBlt (mdc, 0, 0, scld->ysp_w, 256, hdc, x, y, w, h, 0);
    DeleteMemDC (mdc);
    return 0;
}
void DrawPathfinderMap(string mapFile) {
	SetPenColor("White");
	FillBox(0, 0, WINDOW_WIDTH, WINDOW_HEIGHT);
	SetPenColor("Black");
	if (mapFile != "") {
		MovePen(0, 0);
		DrawNamedPicture(mapFile);
	}
}
示例#7
0
/* 
 * Function: EraseOldScore
 * ------------------------
 * I used to do this with SetEraseMode, but that left cruft behind, so instead
 * paint an opaque white box over the old score
 */
static void EraseOldScore(playerT playerNum, int value)
{   
    SetFont(SCORE_FONT);
    SetPointSize(SCORE_FONT_SIZE);
    string str = IntegerToString(value);
    FillBox(gState.scoreBox[playerNum].x + gState.scoreBox[playerNum].w - TextStringWidth(str), 
	    gState.scoreBox[playerNum].y + GetFontDescent(),
	    TextStringWidth(str), GetFontAscent(), 1.0, "blue");
}
static void this_paint_desktop(void* context, HDC dc_desktop, const RECT* inv_rc)
{
    PBITMAP bg_bmp = NULL;
	int i = 0;
    DSPITEM* item;

    if(((Context *)context)->bg)
        bg_bmp = ((Context *)context)->bg;

    SelectClipRect (dc_desktop, inv_rc);
    if (bg_bmp) {
        FillBoxWithBitmap (dc_desktop, 0, 0,
                g_rcDesktop.right, g_rcDesktop.bottom, bg_bmp);
    }else {
        SetBrushColor (dc_desktop, PIXEL_blue);
        FillBox(dc_desktop, g_rcDesktop.left, g_rcDesktop.top,
                RECTW(g_rcDesktop), RECTH(g_rcDesktop));
    }
    
    item = icon_info.app_items;
    for(i = 0; i < icon_info.nr_apps; i++, item++)
	{
        if(i == icon_info.focus)
        {
            SetBrushColor (dc_desktop, PIXEL_darkblue);
            FillBox(dc_desktop, item->hot_spot_rc.left, 
                    item->hot_spot_rc.top,
                    RECTW(item->hot_spot_rc), 
                    RECTH(item->hot_spot_rc));
        }
        FillBoxWithBitmap (dc_desktop,
                item->hot_spot_rc.left,
                item->hot_spot_rc.top,
                RECTW(item->hot_spot_rc),
                RECTH(item->hot_spot_rc), 
                &item->bmp);
        SetBkMode(dc_desktop, BM_TRANSPARENT);
        TextOut(dc_desktop, 
                item->text_rc.left, item->text_rc.top, item->name);
	}
}
void RemoveButton(string name) {
	for (int i = 0; i < buttons.size(); i++) {
		if (buttons[i].name == name) {
			SetPenColor("CONTROL_STRIP");
			FillBox(buttons[i].x - BUTTON_SEP, buttons[i].y - BUTTON_SEP, 
				buttons[i].width + 2*BUTTON_SEP, buttons[i].height + 2*BUTTON_SEP);
			buttons.removeAt(i);
			UpdateDisplay();
			return;
		}
	}
}
示例#10
0
void WindowClearAll (PCONINFO con, int color)
{
    HDC hdc;
    RECT rcClient;
    
    GetClientRect (con->hWnd, &rcClient);

    hdc = GetPrivateClientDC (con->hWnd);
    SetBrushColor (hdc, SysColorIndex [color_map (color)]);
    FillBox (hdc, rcClient.left, rcClient.top,
                  RECTW (rcClient), RECTH (rcClient));
}
示例#11
0
static void drawButton(HWND hDlg, HDC IDCButton, unsigned int flag)
{
	HWND hWnd;
	RECT rect;
	MBPrivData* privData;
	DWORD old_bkmode;
	gal_pixel old_color;
	HDC hdc;
	char* text;

	privData = (MBPrivData*)GetWindowAdditionalData(hDlg);
	hWnd = GetDlgItem(hDlg, IDCButton);
	GetClientRect(hWnd, &rect);

	hdc = GetDC(hWnd);

	if(flag == BUTTON_SELECTED) {
		old_color = SetBrushColor(hdc, gp_hilite_bgc);
		old_bkmode = SetBkMode(hdc, BM_TRANSPARENT);
		FillBox(hdc, rect.left, rect.top, RECTW(rect), RECTH(rect));
		SetTextColor(hdc, gp_hilite_fgc);
		text = (char*)GetWindowAdditionalData2(hWnd);
		DrawText(hdc, text, -1, &rect, DT_CENTER | DT_VCENTER | DT_SINGLELINE);

		SetBrushColor(hdc, old_color);
		SetBkMode(hdc, old_bkmode);
	} else if(flag == BUTTON_UNSELECTED) {
		old_color = SetBrushColor(hdc, gp_normal_bgc);
		old_bkmode = SetBkMode(hdc, BM_TRANSPARENT);
		FillBox(hdc, rect.left, rect.top, RECTW(rect), RECTH(rect));
		SetTextColor (hdc, gp_normal_fgc);
		text = (char*)GetWindowAdditionalData2(hWnd);
		DrawText(hdc, text, -1, &rect, DT_CENTER | DT_VCENTER | DT_SINGLELINE);

		SetBrushColor(hdc, old_color);
		SetBkMode(hdc, old_bkmode);
	}

	ReleaseDC(hdc);
}
示例#12
0
static int DrawSelSpace (HDC hdc, int x, int y, int w, int h, PSCOLORDIA scld)
{
    Uint8 r, g, b;
    HDC mdc;
    
    mdc = CreateCompatibleDCEx (hdc, w, h);
    HSV2RGB (scld->clrh, scld->clrs, scld->clrv, &r, &g, &b);
    SetBrushColor (mdc, RGB2Pixel(mdc, r, g, b));
    FillBox (mdc, 0, 0, w, h);
    BitBlt (mdc, 0, 0, w, h, hdc, x, y, 0);
    DeleteMemDC (mdc);
    return 0;
}
示例#13
0
static void draw_scroll_button (HWND hWnd, HDC hdc, RECT *title_rc, PPROPSHEETDATA propsheet, DWORD style)
{
    RECT btn_rect = {0, 0, 0, 0};
    int l, r, t, b;

    btn_rect.top = ((style & 0xf0L) == PSS_BOTTOM) ? title_rc->top + 1 : title_rc->top;
    btn_rect.right = GetMainWinMetrics (MWM_SB_WIDTH) - 4;
    btn_rect.bottom = ((style & 0xf0L) == PSS_BOTTOM) ? title_rc->bottom + 2: title_rc->bottom - 2;
        
    t = btn_rect.top + 5;
    r = btn_rect.right;
    b = ((style & 0xf0L) == PSS_BOTTOM) ? btn_rect.bottom - 7 : btn_rect.bottom - 4;

    SelectClipRect (hdc, &btn_rect);
    SetBrushColor (hdc, GetWindowBkColor (hWnd));
    FillBox (hdc, btn_rect.left, btn_rect.top, btn_rect.right + 3, btn_rect.bottom); 
    SetPenColor (hdc, GetWindowElementColorEx (hWnd, WEC_3DBOX_DARK));
    for ( ; t <= b; r--, t++, b--) {
        MoveTo (hdc, r, t);
        LineTo (hdc, r, b);
    }
    
    btn_rect.left = propsheet->head_rc.right - GetMainWinMetrics(MWM_SB_WIDTH);
    //btn_rect.top = ((style & 0xf0L) == PSS_BOTTOM) ? btn_rect.top - 1 : btn_rect.top;
    l = ((style & 0xf0L) == PSS_BOTTOM) ? btn_rect.left + 5 : btn_rect.left + 4;
    r = btn_rect.right = propsheet->head_rc.right;
    b = ((style & 0xf0L) == PSS_BOTTOM) ? btn_rect.bottom - 8 : btn_rect.bottom - 5;
    t = btn_rect.top + 6;
    SelectClipRect (hdc, &btn_rect);
    SetBrushColor (hdc, GetWindowBkColor (hWnd));
    FillBox (hdc, btn_rect.left, btn_rect.top, btn_rect.right, btn_rect.bottom);
    SetPenColor (hdc, GetWindowElementColorEx (hWnd, WEC_3DBOX_DARK));
    for ( ; t <= b; l++, t++, b--) {
        MoveTo (hdc, l, t);
        LineTo (hdc, l, b);
    }

}
示例#14
0
/* 
 * Function: DrawBoard
 * -------------------
 * Exported function to draw a new board.  Sets up named colors, draws the yellow
 * border, draws the empty cubes, the labels on the scoreboard, and resets scores
 * to zero and words lists to empty.
 */
void DrawBoard(int numRows, int numCols)
{
    if (numRows < 0 || numRows > MAX_DIMENSION || numCols < 0 || numCols > MAX_DIMENSION)
	Error("DrawBoard called with invalid dimensions.");
		
    SetWindowTitle("Welcome to Boggle!");
    InitColors();
    CalculateGeometry(numRows, numCols);
	
    // Draws a filled rect underneath cubes in the oh-so-familiar yellow color
    FillBox(gState.board.x, gState.board.y, gState.board.w, gState.board.h, 0.5, "Board Color");
    DrawEmptyCubes();
    DrawPlayerLabel(Human, "Me");
    DrawPlayerLabel(Computer, "Computer");
}
示例#15
0
void UI_Out_640_480_Show_Info_ByColor(char *pszInfo, unsigned int  bc,unsigned int  tc)
{
	HDC hDC;
	RECT rt;	
	hDC = GetDC(From_Handl); 
	rt.left = rec9.left+16;
	rt.top = rec9.top+16;
	rt.right = rec9.right-16;
	rt.bottom = rec9.bottom-16;
	SetBrushColor(hDC, bc); 
	FillBox(hDC, rt.left, rt.top, rt.right-rt.left, rt.bottom-rt.top);  
	SetBkMode(hDC, BM_TRANSPARENT); 
	SetTextColor(hDC,  tc); 
	DrawText(hDC , pszInfo, -1, &rt, DT_WORDBREAK | DT_LEFT | DT_VCENTER);  
	ReleaseDC(hDC); 
}
示例#16
0
void GUIAPI Draw3DDownThinFrame (HDC hDC, int l, int t, int r, int b, gal_pixel fillc)
{
    SetPenColor(hDC, GetWindowElementColor (WEC_3DFRAME_LEFT));
    MoveTo(hDC, l, b);
    LineTo(hDC, r, b);
    LineTo(hDC, r, t);
    SetPenColor(hDC, GetWindowElementColor (WEC_3DFRAME_RIGHT));
    MoveTo(hDC, l, b);
    LineTo(hDC, l, t);
    LineTo(hDC, r, t);

    if (fillc != 0) {
         SetBrushColor(hDC, fillc);
         FillBox(hDC, l + 1, t + 1, r - l - 2, b - t - 2);
    }
}
示例#17
0
void UI_Out_640_480_Set_Help_Info(char *pszInfo)
{
	HDC hDC;
	RECT rt;
	hDC = GetDC(From_Handl); 
	rt.left = rec9.left+5;
	rt.top = rec9.bottom-17;
	rt.right = rec9.right-5;
	rt.bottom = rec9.bottom-1;
	SetBrushColor(hDC, TISHI_BACK_COLOR);   
	FillBox(hDC, rt.left, rt.top, rt.right-rt.left, rt.bottom-rt.top);  
	SetBkMode(hDC, BM_TRANSPARENT); 
	SetTextColor(hDC, RGB(255, 255, 0));    
	DrawText(hDC , pszInfo, -1, &rt, DT_WORDBREAK | DT_LEFT | DT_VCENTER);  
	ReleaseDC(hDC); 
	
}
static void myDrawItem (HWND hWnd, HSVITEM hsvi, HDC hdc, RECT *rcDraw)
{
    const char *name = (const char*)scrollview_get_item_adddata (hsvi);

    SetBkMode (hdc, BM_TRANSPARENT);
    SetTextColor (hdc, PIXEL_black);

    if (scrollview_is_item_hilight(hWnd, hsvi)) {
        SetBrushColor (hdc, PIXEL_blue);
        FillBox (hdc, rcDraw->left+1, rcDraw->top+1, RECTWP(rcDraw)-2, RECTHP(rcDraw)-1);
        SetBkColor (hdc, PIXEL_blue);
        SetTextColor (hdc, PIXEL_lightwhite);
    }

    Rectangle (hdc, rcDraw->left, rcDraw->top, rcDraw->right - 1, rcDraw->bottom);
    TextOut (hdc, rcDraw->left + 3, rcDraw->top + 2, name);
}
void InitPuzzleGraphics() {
	SetCoordinateSystem("screen");
	SetWindowSize(WINDOW_WIDTH, WINDOW_HEIGHT + CONTROL_STRIP_HEIGHT);
	InitGraphics();
	DefineColor("CONTROL_STRIP", 0.90, 0.90, 0.90);
	DefineColor("STANDARD_BACKGROUND", 0.80, 0.80, 0.80);
	DefineColor("STANDARD_HIGHLIGHT", 1.00, 1.00, 1.00);
	DefineColor("STANDARD_INNERSHADE", 0.72, 0.72, 0.72);
	DefineColor("STANDARD_OUTERSHADE", 0.43, 0.43, 0.43);
	DefineColor("ACTIVATED_BACKGROUND", 0.00, 0.00, 1.00);
	DefineColor("ACTIVATED_BORDER", 0.00, 0.00, 0.90);
	DefineColor("ACTIVATED_INNERSHADE", 0.00, 0.00, 0.80);
	DefineColor("ACTIVATED_TEXT", 1.00, 1.00, 1.00);
	SetPenColor("CONTROL_STRIP");
	FillBox(0, WINDOW_HEIGHT, WINDOW_WIDTH, CONTROL_STRIP_HEIGHT);
	SetPenColor("Black");
	SetWindowTitle("Triangle Puzzle Solver");
}
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);
    }
}
示例#21
0
void UI_Out_640_480_Show_Edit(int nEditAt, char *pszInfo)
{

	HDC hDC;
	RECT rt;

	hDC = GetDC(From_Handl); 
	rt.left = rtEdit[nEditAt].left+2;
	rt.top = rtEdit[nEditAt].top+2;
	rt.right = rtEdit[nEditAt].right-2;
	rt.bottom = rtEdit[nEditAt].bottom-2;
	SetBrushColor(hDC, EDIT_BACK_COLOR);    
	FillBox(hDC, rt.left, rt.top, rt.right-rt.left, rt.bottom-rt.top);  
	SetBkMode(hDC, BM_TRANSPARENT); 
	SetTextColor(hDC, EDIT_FRONT_COLOR);    
	DrawText(hDC , pszInfo, -1, &rt, DT_SINGLELINE | DT_LEFT | DT_VCENTER); 
	ReleaseDC(hDC); 

}
示例#22
0
void UI_Out_640_480_Set_From_Title(HWND hWnd, char* sTitle)
{
	HDC hdc;
	RECT recttitle;
	RECT rectParent; 
	GetClientRect(hWnd, &rectParent);
	hdc = BeginPaint (hWnd); 
	recttitle.left=rectParent.left + 1;
	recttitle.top=rectParent.top + 2;
	recttitle.right=rectParent.right - 3;
	recttitle.bottom=rectParent.top + 21;
	SetBrushColor (hdc, SUBTITLECOLOR); 
	FillBox (hdc, recttitle.left, recttitle.top, recttitle.right-recttitle.left, recttitle.bottom-recttitle.top);   
	SetBkColor(hdc,SUBTITLECOLOR);  
	SetTextColor(hdc,TITLE_TEXT_COLOR); 
	DrawText (hdc, sTitle, -1, &recttitle,
		DT_SINGLELINE | DT_CENTER | DT_VCENTER);   
	SetPenColor (hdc, SEPLINECOLOR2 );	//里层SEPLINECOLOR2
	MoveTo (hdc,rectParent.left + 1, rectParent.top +1);    
	LineTo (hdc, rectParent.right -1,rectParent.top + 1);   
	MoveTo (hdc, rectParent.left +1,rectParent.top +1); 
	LineTo (hdc, rectParent.left +1, rectParent.bottom -1); 
	SetPenColor (hdc, LTFRAMECOLOR );	//外层LTFRAMECOLOR
	MoveTo (hdc, rectParent.left , rectParent.top); 
	LineTo (hdc, rectParent.right, rectParent.top); 
	MoveTo (hdc, rectParent.left , rectParent.top); 
	LineTo (hdc, rectParent.left , rectParent.bottom);  
	//画窗体右下两对边框线
	SetPenColor (hdc, SEPLINECOLOR1 );	//里层SEPLINECOLOR1
	MoveTo (hdc, rectParent.right-2, rectParent.top+1); 
	LineTo (hdc, rectParent.right-2, rectParent.bottom-2);  
	MoveTo (hdc, rectParent.left+1 ,rectParent.bottom -2);  
	LineTo (hdc, rectParent.right-2 , rectParent.bottom -2);    
	SetPenColor (hdc, RBFRAMECOLOR );	//外层RBFRAMECOLOR
	MoveTo (hdc, rectParent.right-1, rectParent.top);   
	LineTo (hdc, rectParent.right-1, rectParent.bottom-1);  
	MoveTo (hdc, rectParent.left, rectParent.bottom-1); 
	LineTo (hdc, rectParent.right-1, rectParent.bottom-1);  
	EndPaint (hWnd, hdc);   
}
示例#23
0
BOOL CSelectVectorDlg::OnInitDialog() 
{
	CPropertyPage::OnInitDialog();
	
	// TODO: Add extra initialization here
	
	m_ctrl_ToColor.SubclassDlgItem(IDC_COLOR,this);
	m_ctrlStatic.SubclassDlgItem(IDC_VECTOR,this);

	FillBox();
	if(!m_vector.IsEmpty())
     m_list.SelectString(0,m_vector);

	OnSelchangeList1();

	m_ctrl_ToColor.m_Color=m_ToColor;
	m_ctrl_ToColor.Invalidate();


	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}
示例#24
0
/****************************** Drawing Helpers *******************************/
void GUIAPI Draw3DUpFrame(HDC hDC, int l, int t, int r, int b, gal_pixel fillc)
{
    r--;
    b--;

    SetPenColor(hDC, GetWindowElementColor (WEC_3DFRAME_RIGHT_INNER));
    Rectangle(hDC, l, t, r, b);
    SetPenColor(hDC, GetWindowElementColor (WEC_3DFRAME_LEFT_INNER));
    Rectangle(hDC, l, t, r - 1, b - 1);
    SetPenColor(hDC, GetWindowElementColor (WEC_3DFRAME_LEFT_OUTER));
    MoveTo(hDC, l, b);
    LineTo(hDC, r, b);
    LineTo(hDC, r, t);
    SetPenColor(hDC, GetWindowElementColor (WEC_3DFRAME_RIGHT_OUTER));
    MoveTo(hDC, l + 1, b - 1);
    LineTo(hDC, l + 1, t + 1);
    LineTo(hDC, r - 1, t + 1); 

    if (fillc != 0) {
         SetBrushColor(hDC, fillc);
         FillBox(hDC, l + 2, t + 2, r - l - 3, b - t - 3);
    }
}
示例#25
0
static void anim_treat_frame_disposal (ANIMATIONINFO* anim_info,
                                       ANIMATIONFRAME* frame)
{
    int disposal = -1;

    if (frame)
        disposal = frame->disposal;
    else {
        SetBrushColor (anim_info->mem_dc, GetBkColor(anim_info->mem_dc));
        FillBox (anim_info->mem_dc, anim_info->anim->frames->off_x, anim_info->anim->frames->off_y,
                 anim_info->anim->frames->width, anim_info->anim->frames->height);
    }

    switch (disposal) {
    case 2:
        restore_bk_color (anim_info, frame);
        break;
    case 3:
        restore_prev_frame (anim_info, frame->prev);
        break;
    default:
        break;
    }
}
示例#26
0
void UI_Out_800_600_SetMainFromColor ( int nBkColor )
{

	HDC hDC  = GetClientDC ( UI_Out_800_600_Get_From_Handl() ) ;
	SetBrushColor ( hDC , nBkColor ) ;
	FillBox ( hDC , 0 , 0 , 800 , 2 ) ;
	FillBox ( hDC , 0 , 24 , 800 , 1 ) ;
	FillBox ( hDC , 0 , 48+3 , 800 , 3 ) ;
	FillBox ( hDC , 0 , 149+3 , 800 , 3 ) ;
	FillBox ( hDC , 0 , 171+6 , 800 , 9-6 ) ;
	FillBox ( hDC , 0 , 204 , 800 , 4 ) ;
	FillBox ( hDC , 0 , 306 , 360 , 2 ) ;
	FillBox ( hDC , 360 , 482 , 325 , 2 ) ;
	FillBox ( hDC , 360 , 507 , 440 , 2 ) ;
	FillBox ( hDC , 0 , 597 , 800 , 3 ) ;
	FillBox ( hDC , 0 , 0 , 1 , 24 ) ;
	FillBox ( hDC , 799 , 0 , 1 , 24 ) ;
	FillBox ( hDC , 0 , 24 , 4 , 600 - 24 ) ;
	FillBox ( hDC , 796 , 24 , 4 , 600 - 24 ) ;
	FillBox ( hDC , 168 , 24 , 3 , 180 - 24 ) ;
	FillBox ( hDC , 339 , 24 , 3 , 180 - 24 ) ;
	FillBox ( hDC , 460 , 24 , 3 , 180 - 24 ) ;
	FillBox ( hDC , 581 , 24 , 3 , 180 - 24 ) ;
	FillBox ( hDC , 357 , 171+6 , 3 , 600 - 171-6 ) ;
	FillBox ( hDC , 683 , 149+6 , 3 , 509 - 149-6 ) ;
	FillBox ( hDC , 621 , 149+6 , 3 , 180 - 149-6 ) ;
	FillBox ( hDC , 530 , 171+6 , 3 , 208 - 171-6 ) ;
	ReleaseDC ( hDC ) ;

}
static int
SpinProc (HWND hDlg, int message, WPARAM wParam, LPARAM lParam)
{
    HWND hSpin;
    SPININFO spinfo;

    hSpin = GetDlgItem (hDlg, IDC_SPIN);

    switch (message)
    {

    case MSG_INITDIALOG:
    {
        spinfo.min = 0;
        spinfo.max = 10;
        spinfo.cur = 0;
        SendMessage (hSpin, SPM_SETTARGET, 0, (LPARAM)hDlg);
        SendMessage (hSpin, SPM_SETINFO, 0, (LPARAM)&spinfo);
    }
    break;

    case MSG_KEYDOWN:
    {
        if (wParam == SCANCODE_CURSORBLOCKUP || 
                        wParam == SCANCODE_CURSORBLOCKDOWN) {
            if (!(lParam & KS_SPINPOST)) {
                int cur;
                cur = SendMessage (hSpin, SPM_GETCUR, 0, 0);
                printf ("cur pos: %d\n", cur);
                if (wParam == SCANCODE_CURSORBLOCKUP)
                    cur --;
                else
                    cur ++;
                SendMessage (hSpin, SPM_SETCUR, cur, 0);
                printf ("set pos: %d\n", cur);
            }
            InvalidateRect (hDlg, NULL, TRUE);
        }
        else if (wParam == SCANCODE_PAGEDOWN || 
                        wParam == SCANCODE_PAGEUP) {
            if (!(lParam & KS_SPINPOST)) {
                int cur;
                cur = SendMessage (hSpin, SPM_GETCUR, 0, 0);
                if (wParam == SCANCODE_PAGEUP)
                    cur -= 4;
                else
                    cur += 4;
                if (cur < 0) cur = 0;
                else if (cur > 10) cur = 10;
                SendMessage (hSpin, SPM_SETCUR, cur, 0);
            }
            InvalidateRect (hDlg, NULL, TRUE);
        }
    }
    break;

    case MSG_PAINT:
    {
        HDC hdc;
        int x, y, w, h;
        int cur;

        cur = SendMessage (hSpin, SPM_GETCUR, 0, (LPARAM)&spinfo);
        x = 10;
        y = cur*10 + 10;
        w = 60;
        h = 10;

        if (y < 10)
            y = 10;
        else if (y > 110)
            y = 110;

        hdc = BeginPaint (hDlg);
        MoveTo (hdc, 2, 10);
        LineTo (hdc, 100, 10);
        Rectangle (hdc, x, y, x+w, y+h);
        SetBrushColor (hdc, PIXEL_black);
        FillBox (hdc, x, y, w, h);
        MoveTo (hdc, 2, 120);
        LineTo (hdc, 100, 120);
        EndPaint (hDlg, hdc);
    }
    return 0;

    case MSG_CLOSE:
    {
        EndDialog (hDlg, 0);
    }
    break;

    }

    return DefaultDialogProc (hDlg, message, wParam, lParam);
}
static int ScrollbarProc(HWND hwnd, int message, WPARAM wParam, LPARAM lParam)
{
    /** IDC of SCROLLBAR control */
    static int _my_scroll_idc = 100;

    /** scrollbar handle of main window  */
    static HWND hwnd_sb_main;

    /** scrollbar handle of control */
    HWND hwnd_sb_ctrl;

    switch (message)
    {
        case MSG_CREATE:
            {
                _rect_invalid.left   = SEP;
                _rect_invalid.top    = 0;
                _rect_invalid.right  = g_rcScr.right;
                _rect_invalid.bottom = g_rcScr.bottom;

                SCROLLINFO scinfo = {0};
                scinfo.fMask = SIF_ALL;
                scinfo.nMin = SB_MIN;
                scinfo.nMax = SB_MAX;
                scinfo.nPage = SB_PAGE;
                scinfo.nPos = SB_MIN;

                calc_circle_pos (scinfo.nPos);
                calc_box_pos (scinfo.nPos);

                /** classic VSCROLL with SBS_NOTNOTIFYPARENT */

                hwnd_sb_main = CreateWindowEx2 (CTRL_SCROLLBAR, "",
                        WS_VISIBLE |
                        SBS_VERT | SBS_LEFTALIGN
                        | SBS_NOTNOTIFYPARENT
                       ,
                        0,
                        ++_my_scroll_idc,
                        20, 50, 20, 150, hwnd, 
                        "classic", 0,
                        0);

                SendMessage (hwnd_sb_main, SBM_SETSCROLLINFO, (WPARAM)&scinfo, TRUE);
                SendMessage (hwnd_sb_main, MSG_SETFOCUS, 0, 0);

                /** flat VSCROLL */

                hwnd_sb_ctrl = CreateWindowEx2 (CTRL_SCROLLBAR, "",
                        WS_VISIBLE |
                        SBS_VERT | SBS_LEFTALIGN
                       ,
                        0,
                        ++_my_scroll_idc,
                        43, 50, 20, 150, hwnd, 
                        "flat", 0,
                        0);

                SendMessage (hwnd_sb_ctrl, SBM_SETSCROLLINFO, (WPARAM)&scinfo, TRUE);
                SendMessage (hwnd_sb_ctrl, MSG_SETFOCUS, 0, 0);

                /** fashion VSCROLL */

                hwnd_sb_ctrl = CreateWindowEx2 (CTRL_SCROLLBAR, "",
                        WS_VISIBLE |
                        SBS_VERT | SBS_LEFTALIGN
                       ,
                        0,
                        ++_my_scroll_idc,
                        66, 50, 20, 150, hwnd, 
                        "fashion", 0,
                        0);

                SendMessage (hwnd_sb_ctrl, SBM_SETSCROLLINFO, (WPARAM)&scinfo, TRUE);
                SendMessage (hwnd_sb_ctrl, MSG_SETFOCUS, 0, 0);

                /** tiny VSCROLL */

                hwnd_sb_ctrl = CreateWindowEx2 (CTRL_SCROLLBAR, "",
                        WS_VISIBLE |
                        SBS_VERT | SBS_LEFTALIGN
                       ,
                        0,
                        ++_my_scroll_idc,
                        92, 50, 20, 150, hwnd, 
                        "tiny", 0,
                        0);

                SendMessage (hwnd_sb_ctrl, SBM_SETSCROLLINFO, (WPARAM)&scinfo, TRUE);
                SendMessage (hwnd_sb_ctrl, MSG_SETFOCUS, 0, 0);

                /** classic NOSHAFT VSCROLL */

                hwnd_sb_ctrl = CreateWindowEx2 (CTRL_SCROLLBAR, "",
                        WS_VISIBLE | SBS_VERT | SBS_NOSHAFT | SBS_LEFTALIGN 
                       ,
                        0,
                        ++_my_scroll_idc,
                        120, 50, 20, 34, hwnd, 
                        "classic", 0,
                        0);

                SendMessage (hwnd_sb_ctrl, SBM_SETSCROLLINFO, (WPARAM)&scinfo, TRUE);
                SendMessage (hwnd_sb_ctrl, MSG_SETFOCUS, 0, 0);

                /** flat NOSHAFT VSCROLL */

                hwnd_sb_ctrl = CreateWindowEx2 (CTRL_SCROLLBAR, "",
                        WS_VISIBLE | SBS_VERT | SBS_NOSHAFT | SBS_LEFTALIGN 
                       ,
                        0,
                        ++_my_scroll_idc,
                        140, 50, 20, 34, hwnd, 
                        "flat", 0,
                        0);

                SendMessage (hwnd_sb_ctrl, SBM_SETSCROLLINFO, (WPARAM)&scinfo, TRUE);
                SendMessage (hwnd_sb_ctrl, MSG_SETFOCUS, 0, 0);

                /** fashion NOSHAFT VSCROLL */

                hwnd_sb_ctrl = CreateWindowEx2 (CTRL_SCROLLBAR, "",
                        WS_VISIBLE | SBS_VERT | SBS_NOSHAFT | SBS_LEFTALIGN 
                       ,
                        0,
                        ++_my_scroll_idc,
                        160, 50, 20, 34, hwnd, 
                        "fashion", 0,
                        0);

                SendMessage (hwnd_sb_ctrl, SBM_SETSCROLLINFO, (WPARAM)&scinfo, TRUE);
                SendMessage (hwnd_sb_ctrl, MSG_SETFOCUS, 0, 0);

                /** tiny NOSHAFT VSCROLL */

                hwnd_sb_ctrl = CreateWindowEx2 (CTRL_SCROLLBAR, "",
                        WS_VISIBLE | SBS_VERT | SBS_NOSHAFT | SBS_LEFTALIGN 
                       ,
                        0,
                        ++_my_scroll_idc,
                        184, 50, 20, 34, hwnd, 
                        "tiny", 0,
                        0);

                SendMessage (hwnd_sb_ctrl, SBM_SETSCROLLINFO, (WPARAM)&scinfo, TRUE);
                SendMessage (hwnd_sb_ctrl, MSG_SETFOCUS, 0, 0);

                /** classic NOARROW VSCROLL */

                hwnd_sb_ctrl = CreateWindowEx2 (CTRL_SCROLLBAR, "",
                        WS_VISIBLE | SBS_VERT | SBS_NOARROW | SBS_LEFTALIGN 
                       ,
                        0,
                        ++_my_scroll_idc,
                        210, 50, 20, 150, hwnd, 
                        "classic", 0,
                        0);

                SendMessage (hwnd_sb_ctrl, SBM_SETSCROLLINFO, (WPARAM)&scinfo, TRUE);
                SendMessage (hwnd_sb_ctrl, MSG_SETFOCUS, 0, 0);

                /** flat NOARROW VSCROLL */

                hwnd_sb_ctrl = CreateWindowEx2 (CTRL_SCROLLBAR, "",
                        WS_VISIBLE | SBS_VERT | SBS_NOARROW | SBS_LEFTALIGN 
                       ,
                        0,
                        ++_my_scroll_idc,
                        232, 50, 20, 150, hwnd, 
                        "flat", 0,
                        0);

                SendMessage (hwnd_sb_ctrl, SBM_SETSCROLLINFO, (WPARAM)&scinfo, TRUE);
                SendMessage (hwnd_sb_ctrl, MSG_SETFOCUS, 0, 0);

                /** fashion NOARROW VSCROLL */

                hwnd_sb_ctrl = CreateWindowEx2 (CTRL_SCROLLBAR, "",
                        WS_VISIBLE | SBS_VERT | SBS_NOARROW | SBS_LEFTALIGN 
                       ,
                        0,
                        ++_my_scroll_idc,
                        254, 50, 20, 150, hwnd, 
                        "fashion", 0,
                        0);

                SendMessage (hwnd_sb_ctrl, SBM_SETSCROLLINFO, (WPARAM)&scinfo, TRUE);
                SendMessage (hwnd_sb_ctrl, MSG_SETFOCUS, 0, 0);

                /** tiny NOARROW VSCROLL */

                hwnd_sb_ctrl = CreateWindowEx2 (CTRL_SCROLLBAR, "",
                        WS_VISIBLE | SBS_VERT | SBS_NOARROW | SBS_LEFTALIGN 
                       ,
                        0,
                        ++_my_scroll_idc,
                        276, 50, 20, 150, hwnd, 
                        "tiny", 0,
                        0);

                SendMessage (hwnd_sb_ctrl, SBM_SETSCROLLINFO, (WPARAM)&scinfo, TRUE);
                SendMessage (hwnd_sb_ctrl, MSG_SETFOCUS, 0, 0);

                /** classic HSCROLL */

                hwnd_sb_ctrl = CreateWindowEx2 (CTRL_SCROLLBAR, "",
                        WS_VISIBLE | SBS_HORZ 
                        | SBS_TOPALIGN
                       ,
                        0,
                        ++_my_scroll_idc,
                        20, 220, 150, 20, hwnd, 
                        "classic", 0,
                        0);

                SendMessage (hwnd_sb_ctrl, SBM_SETSCROLLINFO, (WPARAM)&scinfo, TRUE);
                SendMessage (hwnd_sb_ctrl, MSG_SETFOCUS, 0, 0);

                /** flat HSCROLL */

                hwnd_sb_ctrl = CreateWindowEx2 (CTRL_SCROLLBAR, "",
                        WS_VISIBLE | SBS_HORZ 
                        | SBS_TOPALIGN
                       ,
                        0,
                        ++_my_scroll_idc,
                        20, 240, 150, 20, hwnd, 
                        "flat", 0,
                        0);

                SendMessage (hwnd_sb_ctrl, SBM_SETSCROLLINFO, (WPARAM)&scinfo, TRUE);
                SendMessage (hwnd_sb_ctrl, MSG_SETFOCUS, 0, 0);

                /** fashion HSCROLL */

                hwnd_sb_ctrl = CreateWindowEx2 (CTRL_SCROLLBAR, "",
                        WS_VISIBLE | SBS_HORZ 
                        | SBS_TOPALIGN
                       ,
                        0,
                        ++_my_scroll_idc,
                        20, 260, 150, 20, hwnd, 
                        "fashion", 0,
                        0);

                SendMessage (hwnd_sb_ctrl, SBM_SETSCROLLINFO, (WPARAM)&scinfo, TRUE);
                SendMessage (hwnd_sb_ctrl, MSG_SETFOCUS, 0, 0);

                /** tiny HSCROLL */

                hwnd_sb_ctrl = CreateWindowEx2 (CTRL_SCROLLBAR, "",
                        WS_VISIBLE | SBS_HORZ 
                        | SBS_TOPALIGN
                       ,
                        0,
                        ++_my_scroll_idc,
                        20, 280, 150, 20, hwnd, 
                        "tiny", 0,
                        0);

                SendMessage (hwnd_sb_ctrl, SBM_SETSCROLLINFO, (WPARAM)&scinfo, TRUE);
                SendMessage (hwnd_sb_ctrl, MSG_SETFOCUS, 0, 0);
            }
            break;

        case MSG_COMMAND:
            {
                int code = HIWORD(wParam);
                HWND scroll = (HWND)lParam;
                int pos = 0;

                switch (code) 
                {
                    case SB_LINELEFT:
                        {
                            pos = SendMessage (scroll, SBM_GETPOS, 0, 0);

                            SendMessage (scroll, SBM_SETPOS, --pos, TRUE);
                        }

                        break;

                    case SB_LINERIGHT:
                        {
                            pos = SendMessage (scroll, SBM_GETPOS, 0, 0);

                            SendMessage (scroll, SBM_SETPOS, ++pos, TRUE);
                        }
                        break;

                    case SB_PAGELEFT:
                        {
                            pos = SendMessage (scroll, SBM_GETPOS, 0, 0);

                            pos -= SB_PAGE;
                            SendMessage (scroll, SBM_SETPOS, pos, TRUE);
                        }
                        break;

                    case SB_PAGERIGHT:
                        {
                            pos = SendMessage (scroll, SBM_GETPOS, 0, 0);

                            pos += SB_PAGE;
                            SendMessage (scroll, SBM_SETPOS, pos, TRUE);
                        }
                        break;

                    case SB_LINEUP:
                        {
                            pos = SendMessage (scroll, SBM_GETPOS, 0, 0);

                            SendMessage (scroll, SBM_SETPOS, --pos, TRUE);
                        }

                        break;

                    case SB_LINEDOWN:
                        {
                            pos = SendMessage (scroll, SBM_GETPOS, 0, 0);

                            SendMessage (scroll, SBM_SETPOS, ++pos, TRUE);
                        }
                        break;

                    case SB_PAGEUP:
                        {
                            pos = SendMessage (scroll, SBM_GETPOS, 0, 0);

                            pos -= SB_PAGE;
                            SendMessage (scroll, SBM_SETPOS, pos, TRUE);
                        }
                        break;

                    case SB_PAGEDOWN:
                        {
                            pos = SendMessage (scroll, SBM_GETPOS, 0, 0);

                            pos += SB_PAGE;
                            SendMessage (scroll, SBM_SETPOS, pos, TRUE);
                        }
                        break;

                    case SB_THUMBPOSITION:
                        {
                            pos = SendMessage (scroll, SBM_GETPOS, 0, 0);
                        }
                        break;

                    case SB_THUMBTRACK:
                        {
                            pos = SendMessage (scroll, SBM_GETPOS, 0, 0);
                        }
                        break;

                    case SB_TOP:
                        {
                            pos = SB_MIN;
                        }
                        break;

                    case SB_BOTTOM:
                        {
                            pos = SB_MAX;
                        }
                        break;

                    default:
                        break;
                }

                draw_shape (hwnd, pos);
            }
            break;

        case MSG_HSCROLL:
            {
                int pos = 0;
                switch (wParam)
                {
                    case SB_LINELEFT:
                        {
                            pos = SendMessage (hwnd_sb_main, SBM_GETPOS, 0, 0);

                            SendMessage (hwnd_sb_main, SBM_SETPOS, --pos, TRUE);
                        }

                        break;

                    case SB_LINERIGHT:
                        {
                            pos = SendMessage (hwnd_sb_main, SBM_GETPOS, 0, 0);

                            SendMessage (hwnd_sb_main, SBM_SETPOS, ++pos, TRUE);
                        }
                        break;

                    case SB_PAGELEFT:
                        {
                            pos = SendMessage (hwnd_sb_main, SBM_GETPOS, 0, 0);

                            pos -= SB_PAGE;
                            SendMessage (hwnd_sb_main, SBM_SETPOS, pos, TRUE);
                        }
                        break;

                    case SB_PAGERIGHT:
                        {
                            pos = SendMessage (hwnd_sb_main, SBM_GETPOS, 0, 0);

                            pos += SB_PAGE;
                            SendMessage (hwnd_sb_main, SBM_SETPOS, pos, TRUE);
                        }
                        break;
                    case SB_THUMBPOSITION:
                        {
                            pos = (int)lParam;
                        }
                        break;

                    case SB_THUMBTRACK:
                        {
                            pos = (int)lParam;
                        }
                        break;

                    case SB_TOP:
                        {
                            pos = SB_MIN;
                        }
                        break;

                    case SB_BOTTOM:
                        {
                            pos = SB_MAX;
                        }
                        break;

                    default:
                        break;
                }
                draw_shape (hwnd, pos);
            }
            break;

        case MSG_VSCROLL:
            {
                int pos = 0;
                switch (wParam)
                {
                    case SB_LINEUP:
                        {
                            pos = SendMessage (hwnd_sb_main, SBM_GETPOS, 0, 0);

                            SendMessage (hwnd_sb_main, SBM_SETPOS, --pos, TRUE);
                            
                        }

                        break;

                    case SB_LINEDOWN:
                        {
                            pos = SendMessage (hwnd_sb_main, SBM_GETPOS, 0, 0);

                            SendMessage (hwnd_sb_main, SBM_SETPOS, ++pos, TRUE);
                        }
                        break;

                    case SB_PAGEUP:
                        {
                            pos = SendMessage (hwnd_sb_main, SBM_GETPOS, 0, 0);

                            pos -= SB_PAGE;
                            SendMessage (hwnd_sb_main, SBM_SETPOS, pos, TRUE);
                        }
                        break;

                    case SB_PAGEDOWN:
                        {
                            pos = SendMessage (hwnd_sb_main, SBM_GETPOS, 0, 0);

                            pos += SB_PAGE;
                            SendMessage (hwnd_sb_main, SBM_SETPOS, pos, TRUE);
                        }
                        break;
                    case SB_THUMBPOSITION:
                        {
                            pos = (int)lParam;
                        }
                        break;

                    case SB_THUMBTRACK:
                        {
                            pos = (int)lParam;
                        }
                        break;

                    case SB_TOP:
                        {
                            pos = SB_MIN;
                        }
                        break;

                    case SB_BOTTOM:
                        {
                            pos = SB_MAX;
                        }
                        break;
                    default:
                        break;
                }
                draw_shape (hwnd, pos);
            }
            break;

        case MSG_PAINT:
            {
                HDC hdc = BeginPaint(hwnd); 

                /** separator */
                MoveTo (hdc, SEP, 0);
                LineTo (hdc, SEP, g_rcScr.bottom);

                /** circle */
                Circle (hdc, CC_CENTER_X, CC_CENTER_Y, _radius);

                /** top and bottom line of box */
                MoveTo (hdc, SEP + 20, BOX_Y_MIN);
                LineTo (hdc, SEP + 20 + BOX_WIDTH + 40, BOX_Y_MIN);

                MoveTo (hdc, SEP + 20, BOX_Y_MAX);
                LineTo (hdc, SEP + 20 + BOX_WIDTH + 40, BOX_Y_MAX);

                /** box */
                SetBrushColor (hdc, PIXEL_black);
                FillBox (hdc, SEP + 40, _box_pos_y, BOX_WIDTH, BOX_HEIGHT);

                EndPaint (hwnd, hdc);
            }
            break;

        case MSG_CLOSE:
            {
                DestroyMainWindow (hwnd);
                PostQuitMessage (hwnd);
                return 0;
            }
    }

    return DefaultMainWinProc(hwnd, message, wParam, lParam);
}
示例#29
0
void ptGCGDI::Clear(const bbUINT col)
{
    FillBox(0, 0, GetWidth(), GetHeight(), col);
}
示例#30
0
static int FaceEnrollWinProc(HWND hWnd, int message, WPARAM wParam, LPARAM lParam)
{
	HDC hdc;
	int ret=0;
	RECT rect={142,221,180,240};

	switch (message) 
	{
		case MSG_CREATE:
			UpdateFaceRegWindow( hWnd, hdc);
			InitShowFaceImage();
			FaceRegState=FACE_REG_PREPARE;

			SetTimer(hWnd, IDC_FACE_TIMER1, IDC_TIMER_NUM);
			break;
		case MSG_ERASEBKGND:
                {
                        HDC hdc = (HDC)wParam;
                        const RECT* clip = (const RECT*)lParam;
                        BOOL fGetDC = FALSE;
                        RECT rcTemp;
                        if(hdc == 0)
                        {
                                hdc = GetClientDC(hWnd);
                                fGetDC = TRUE;
                        }

                        if(clip)
                        {
                                rcTemp = *clip;
                                ScreenToClient(hWnd, &rcTemp.left, &rcTemp.top);
                                ScreenToClient(hWnd,&rcTemp.right, &rcTemp.bottom);
                                IncludeClipRect(hdc, &rcTemp);
                        }
			UpdateFaceRegWindow(hWnd,hdc);

                        if(fGetDC) ReleaseDC (hdc);
                        	return 0;
                }
			return 0;
		
                case MSG_PAINT:
		{
			char buf[20];
                        hdc = BeginPaint(hWnd);
			SelectFont(hdc,gfont);
			SetTextColor(hdc,PIXEL_lightwhite);
       	 		SetBkMode(hdc,BM_TRANSPARENT);
                        SetPenColor(hdc,PIXEL_black);
    			SetBrushColor(hdc,PIXEL_lightgray);
			SetPenWidth(hdc, 2);
			LineEx(hdc,-1,221,322,222);
			FillBox(hdc,-1,223,322,20);
			if(RegBegin == REG_PREPARE)
			{
				sprintf(buf,"0%%");
				TextOut(hdc,145,225,buf);
			}
			else
			{
                        	SetBrushColor (hdc, PIXEL_blue);
                        	if(FaceCount>=FACE_NUM)  // 0,220,320,20
                        	{
                        	        FillBox(hdc,1,223,318,17);
					sprintf(buf,"100%%");
					TextOut(hdc,145,225,buf);
                        	}
                        	else if(FaceCount>0)
                        	{
                        	        FillBox(hdc,1,223,320*FaceCount/FACE_NUM,17);
					sprintf(buf,"%d%%",100*FaceCount/FACE_NUM);
					TextOut(hdc,145,225,buf);
                        	}
				else
				{
					sprintf(buf,"0%%");
					TextOut(hdc,145,225,buf);
				}
			}
                        EndPaint(hWnd,hdc);
		}
		return 0;
		case MSG_KEYDOWN:
			SetMenuTimeOut(time(NULL));
                        if (gOptions.KeyPadBeep)
                                ExKeyBeep();

			if(LOWORD(wParam) == SCANCODE_ESCAPE)
				PostMessage (hWnd, MSG_CLOSE, 0, 0);
			break;

		case MSG_TIMER:
			if (wParam == IDC_FACE_TIMER1)
			{
				KillTimer(hWnd, IDC_FACE_TIMER1);
				if(ismenutimeout)
				{
					PostMessage(hWnd, MSG_CLOSE, 0, 0);
					return 0;
				}
				hdc=GetClientDC(hWnd);
				if(FaceCount==0 && RegCnt==0 && RegBegin<= REG_PREPARE && gOptions.VoiceOn)
				{
					RegCnt=1;
					FaceRegState=FACE_REG_PREPARE;
					ShowFaceHint(hWnd , FACE_REG_PREPARE , hdc, &fvbg,1);
					if(gOptions.VoiceOn)
						ExPlayVoice(VOICE_FACE_START); //start...
					DelayMS(1000);
				}
				if(ShowCaptureFace( hWnd,HDC_SCREEN ,1)) //Extract face template ok
				{

					SetMenuTimeOut(time(NULL));
					ret=RegFaceTmpProc(f_pin);

					if(RET_SUCCESS==ret) //register success
					{
						SendMessage (hWnd, MSG_PAINT, FACE_NUM, 0) ;
						regok=1;
						if(gOptions.VoiceOn)
                                			ExPlayVoice(VOICE_THANK); 
						DelayMS(500);
						PostMessage (hWnd, MSG_CLOSE, 0, 0);
					}
					else if(RET_FAILED==ret) // register failed
					{
						PostMessage (hWnd, MSG_CLOSE, 0, 0);
					}
					else if(RET_SAME==ret && RegBegin != REG_PREPARE) // move face
					{
						ShowFaceHint(hWnd , HINT_FCHG ,hdc, &fvbg,1);
					}
					else if(RET_CONTINUE==ret)
					{
						if(RegBegin != REG_PREPARE)
						{
							SendMessage (hWnd, MSG_PAINT , FaceCount, 0) ;
							if(FaceCount == 0)
							{
								FaceRegState=FACE_REG_FRONT;
								ShowFaceHint(hWnd , FACE_REG_FRONT , hdc, &fvbg,1);
								if(gOptions.VoiceOn)
                                					ExPlayVoice(VOICE_FACE_FRONT); 
								DelayMS(600);
							}
							else if(FaceCount == 3)
							{
								FaceRegState=FACE_REG_SCREEN;
								ShowFaceHint(hWnd , FACE_REG_SCREEN ,hdc, &fvbg,1);
								if(gOptions.VoiceOn)
                                					ExPlayVoice(VOICE_FACE_SCREEN); 
								DelayMS(600);
							}
							else if(FaceCount == 6)
							{
								FaceRegState=FACE_REG_LEFT;
								ShowFaceHint(hWnd , FACE_REG_LEFT ,hdc, &fvbg,1);
								if(gOptions.VoiceOn)
                                					ExPlayVoice(VOICE_FACE_LEFT); 
								DelayMS(600);
							}
							else if(FaceCount == 9)
							{
								FaceRegState=FACE_REG_RIGHT;
								ShowFaceHint(hWnd , FACE_REG_RIGHT ,hdc, &fvbg,1);
								if(gOptions.VoiceOn)
                                					ExPlayVoice(VOICE_FACE_RIGHT); 
								DelayMS(600);
							}
							else if(FaceCount == 12)
							{
								FaceRegState=FACE_REG_CAMERA;
								ShowFaceHint(hWnd ,FACE_REG_CAMERA ,hdc, &fvbg,1);
								if(gOptions.VoiceOn)
                                					ExPlayVoice(VOICE_FACE_CAMERA); 
								DelayMS(600);
							}
							else
							{
			                        		ExBeep(1);
							}
						}
						else
						{
			                        	ExBeep(1);
						}
					}
				}
				ReleaseDC(hdc);
				SetTimer(hWnd, IDC_FACE_TIMER1,IDC_TIMER_NUM );
			}
			break;

		case MSG_IDLE:
			if(FaceCount==0 && RegCnt==0 && RegBegin<= REG_PREPARE && gOptions.VoiceOn)
 		        {
                        	RegCnt=1;
				FaceRegState=FACE_REG_PREPARE;
				hdc=GetClientDC(hWnd);
				ShowFaceHint(hWnd , FACE_REG_PREPARE ,hdc, &fvbg,1);
				if(gOptions.VoiceOn)
                			ExPlayVoice(VOICE_FACE_START); //start...
				DelayMS(1000);
				ReleaseDC(hdc);
                        }
			break;

		case MSG_CLOSE:
			KillTimer(hWnd, IDC_FACE_TIMER1);


         		// MainWindowCleanup(hWnd);
                        DestroyMainWindow(hWnd);
		        return 0;
        
	}
    
	return DefaultMainWinProc(hWnd, message, wParam, lParam);
}