Exemple #1
0
/*
 * InventoryBoxCreate:  Create the inventory list box.
 */
void InventoryBoxCreate(HWND hParent)
{
    BITMAPINFOHEADER *ptr;
    LOGBRUSH logbrush;

    hwndInvDialog = CreateDialog(hInst, MAKEINTRESOURCE(IDD_INVENTORY),
                                 hParent, InventoryDialogProc);

    hwndInv = CreateWindow("button", NULL,
                           WS_CHILD | WS_VISIBLE | BS_OWNERDRAW,
                           0, 0, 0, 0,
                           hwndInvDialog, (HMENU) IDC_INVENTORY, hInst, NULL);
    lpfnDefProc = SubclassWindow(hwndInv, InventoryProc);

    hwndInvScroll = CreateWindow("scrollbar", NULL,
                                 WS_CHILD | SBS_VERT,
                                 0, 0, 100, 100,  /* Make sure scrollbar drawn ok */
                                 hwndInvDialog, (HMENU) IDC_INVSCROLL, hInst, NULL);

    inventory_scrollbar_width = GetSystemMetrics(SM_CXVSCROLL);
    num_items = 0;
    top_row = 0;
    cursor_row = cursor_col = -1;
    items = NULL;
    capture = False;

    // Get bitmaps for cursor and in-use highlight
    ptr = GetBitmapResource(hInst, IDB_INVCURSOR);
    if (ptr == NULL)
        cursor_bits = NULL;
    else cursor_bits = ((BYTE *) ptr) + sizeof(BITMAPINFOHEADER) + NUM_COLORS * sizeof(RGBQUAD);

    ptr = GetBitmapResource(hInst, IDB_INVINUSE);
    if (ptr == NULL)
        inuse_bits = NULL;
    else inuse_bits = ((BYTE *) ptr) + sizeof(BITMAPINFOHEADER) + NUM_COLORS * sizeof(RGBQUAD);

    ptr = GetBitmapResource(hInst, IDB_SELFTRGT);
    if (ptr == NULL)
        selftrgt_bits = NULL;
    else selftrgt_bits = ((BYTE *) ptr) + sizeof(BITMAPINFOHEADER) + NUM_COLORS * sizeof(RGBQUAD);

    if (!GetBitmapResourceInfo(hInst, IDB_INVBKGND, &inventory_bkgnd))
        debug(("InventoryBoxCreate couldn't load inventory background bitmap\n"));

    //	ajw begin...
//	hbmpScrollBack = GetHBitmapFromResource( hInst, IDB_INVBKGND );
//	if( !hbmpScrollBack )
//		debug(("InventoryBoxCreate couldn't create hbmpScrollBack\n"));
    if( !( ptr = GetBitmapResource( hInst, IDB_INVBKGND ) ) )
        debug(("InventoryBoxCreate couldn't load inventory scroll bar texture bitmap\n"));

//	logbrush.lbStyle = BS_DIBPATTERN;
//	logbrush.lbColor = DIB_RGB_COLORS;
//	logbrush.lbHatch = hbmpScrollBack;
    logbrush.lbStyle = BS_DIBPATTERNPT;
    logbrush.lbColor = DIB_RGB_COLORS;
    logbrush.lbHatch = (long)ptr;

    hbrushScrollBack = CreateBrushIndirect( &logbrush );
    //	ajw end...

    // Compute background palette index
    inventory_bg_index = GetClosestPaletteIndex(RGB(84, 40, 0));

    InventoryResetFont();
    InventoryChangeColor();
    InventoryDisplayScrollbar();
}
Exemple #2
0
void InterfaceColorChanged(WORD color_id, COLORREF color)
{
   InventoryChangeColor();   
   StatsChangeColor();
   StatsMainChangeColor();
}