Esempio n. 1
0
BOOL RegisterButtonControl (void)
{
    WNDCLASS WndClass;

    if (!LoadSystemBitmap (&bmp_button, SYSBMP_BUTTON))
        return FALSE;

    WndClass.spClassName = CTRL_BUTTON;
    WndClass.dwStyle     = WS_NONE;
    WndClass.dwExStyle   = WS_EX_NONE;
    WndClass.hCursor     = GetSystemCursor (IDC_ARROW);
    WndClass.iBkColor    = GetWindowElementColor (BKC_CONTROL_DEF);
    WndClass.WinProc     = ButtonCtrlProc;

    return AddNewControlClass (&WndClass) == ERR_OK;
}
Esempio n. 2
0
/***************************Bitmap Support***************************/
static BOOL LoadBitmapRes (void)
{
    int i, nBmpNr, size;
    char *temp;
    BITMAP bmp;
    char szValue [12];

    if (GetMgEtcValue ("bitmapinfo", "bitmapnumber", szValue, 10) < 0)
        return FALSE;

    nBmpNr = atoi(szValue);
    if (nBmpNr <= 0) return FALSE;
    nBmpNr = nBmpNr < SYSBMP_ITEM_NUMBER ? nBmpNr : SYSBMP_ITEM_NUMBER;

    ((PG_RES)mgSharedRes)->bmpnum    = nBmpNr;
    ((PG_RES)mgSharedRes)->bmpoffset = mgSizeRes;

    for (i = 0; i < nBmpNr; i++) {
        sprintf (szValue, "bitmap%d", i);
        if (!LoadSystemBitmap (&bmp, szValue))
            return FALSE;

#ifdef _USE_NEWGAL
        size = bmp.bmHeight * bmp.bmPitch;
#else
        size = bmp.bmHeight * bmp.bmWidth * BYTESPERPHYPIXEL;
#endif
        if ((mgSharedRes = realloc (mgSharedRes, mgSizeRes + size + sizeof (BITMAP))) == NULL) {
            UnloadBitmap (&bmp);
            perror ("realloc shared memory for system bitmap");
            return FALSE;
        }

        temp= (char*)mgSharedRes + mgSizeRes;
        memcpy (temp, &bmp, sizeof(BITMAP));
        temp += sizeof (BITMAP);
        memcpy (temp, bmp.bmBits, size);

        mgSizeRes += size;
        mgSizeRes += sizeof (BITMAP);

        UnloadBitmap (&bmp);
    }

    return TRUE;
}
Esempio n. 3
0
int WINAPI
MwRegisterListboxControl(HINSTANCE hInstance)
{
	WNDCLASS wc;
#if 0
	static BITMAP sg_bmpCheckMark;
	if (!LoadSystemBitmap(&sg_bmpCheckMark, "checkmark")) {
		DPRINTF( "Load ListBox Check Mark Bitmap failure!\n");
		return FALSE;
	}
#endif
	wc.style = CS_HREDRAW | CS_VREDRAW | CS_DBLCLKS | CS_GLOBALCLASS;
	wc.lpfnWndProc = (WNDPROC) ListboxCtrlProc;
	wc.cbClsExtra = 0;
	wc.cbWndExtra = 4;	// WM_SETFONT
	wc.hInstance = hInstance;
	wc.hIcon = NULL;
	wc.hCursor = 0;		/*LoadCursor(NULL, IDC_ARROW); */
	wc.hbrBackground = GetStockObject(WHITE_BRUSH);
	wc.lpszMenuName = NULL;
	wc.lpszClassName = "LISTBOX";

	return RegisterClass(&wc);
}