Ignore:
Timestamp:
Oct 9, 1999, 6:28:25 PM (26 years ago)
Author:
cbratschi
Message:

merged with WINE, button: gray text for radio/checkbox, more to do

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/user32/uitools.cpp

    r1143 r1229  
    1 /* $Id: uitools.cpp,v 1.10 1999-10-05 18:23:49 sandervl Exp $ */
     1/* $Id: uitools.cpp,v 1.11 1999-10-09 16:28:25 cbratschi Exp $ */
    22/*
    33 * User Interface Functions
     
    88 * Copyright 1999 Christoph Bratschi
    99 * Copyright 1999 Rene Pronk
     10 *
     11 * WINE version: 990923
    1012 */
    1113
     
    617619
    618620
     621static void UITOOLS_DrawCheckedRect( HDC dc, LPRECT rect )
     622{
     623    if(GetSysColor(COLOR_BTNHIGHLIGHT) == RGB(255, 255, 255))
     624    {
     625      HBITMAP hbm = CreateBitmap(8, 8, 1, 1, wPattern_AA55);
     626      HBRUSH hbsave;
     627      HBRUSH hb = CreatePatternBrush(hbm);
     628      COLORREF bg;
     629
     630      FillRect(dc, rect, GetSysColorBrush(COLOR_BTNFACE));
     631      bg = SetBkColor(dc, RGB(255, 255, 255));
     632      hbsave = (HBRUSH)SelectObject(dc, hb);
     633      PatBlt(dc, rect->left, rect->top, rect->right-rect->left, rect->bottom-rect->top, 0x00FA0089);
     634      SelectObject(dc, hbsave);
     635      SetBkColor(dc, bg);
     636      DeleteObject(hb);
     637      DeleteObject(hbm);
     638    }
     639    else
     640    {
     641        FillRect(dc, rect, GetSysColorBrush(COLOR_BTNHIGHLIGHT));
     642    }
     643}
     644
    619645/************************************************************************
    620646 *      UITOOLS_DFC_ButtonPush
     
    643669            UITOOLS95_DrawRectEdge(dc, &myr, edge, (uFlags&DFCS_FLAT)|BF_RECT|BF_SOFT|BF_ADJUST);
    644670
    645         if(GetSysColor(COLOR_BTNHIGHLIGHT) == RGB(255, 255, 255))
    646         {
    647             HBITMAP hbm = CreateBitmap(8, 8, 1, 1, wPattern_AA55);
    648             HBRUSH hbsave;
    649             HBRUSH hb = CreatePatternBrush(hbm);
    650 
    651             FillRect(dc, &myr, GetSysColorBrush(COLOR_BTNFACE));
    652             hbsave = (HBRUSH)SelectObject(dc, hb);
    653             PatBlt(dc, myr.left, myr.top, myr.right-myr.left, myr.bottom-myr.top, 0x00FA0089);
    654             SelectObject(dc, hbsave);
    655             DeleteObject(hb);
    656             DeleteObject(hbm);
     671        UITOOLS_DrawCheckedRect( dc, &myr );
    657672        }
    658673        else
    659674        {
    660             FillRect(dc, &myr, GetSysColorBrush(COLOR_BTNHIGHLIGHT));
    661         }
    662     }
    663     else
    664     {
    665675        if(uFlags & DFCS_MONO)
    666676        {
     
    688698
    689699/************************************************************************
    690  *      UITOOLS_DFC_ButtonChcek
     700 *      UITOOLS_DFC_ButtonCheck
    691701 *
    692702 * Draw a check/3state button coming from DrawFrameControl()
     
    702712    RECT myr;
    703713    int SmallDiam = UITOOLS_MakeSquareRect(r, &myr);
    704     int BorderShrink = SmallDiam / 16;
    705 
    706     if(BorderShrink < 1) BorderShrink = 1;
    707 
    708     /* FIXME: The FillRect() sequence doesn't work for sizes less than */
    709     /* 4 pixels in diameter. Not really a problem but it isn't M$'s */
    710     /* 100% equivalent. */
    711     if(uFlags & (DFCS_FLAT|DFCS_MONO))
    712     {
    713         FillRect(dc, &myr, GetSysColorBrush(COLOR_WINDOWFRAME));
    714         myr.left   += 2 * BorderShrink;
    715         myr.right  -= 2 * BorderShrink;
    716         myr.top    += 2 * BorderShrink;
    717         myr.bottom -= 2 * BorderShrink;
    718     }
    719     else
    720     {
    721         FillRect(dc, &myr, GetSysColorBrush(COLOR_BTNHIGHLIGHT));
    722         myr.right  -= BorderShrink;
    723         myr.bottom -= BorderShrink;
    724         FillRect(dc, &myr, GetSysColorBrush(COLOR_BTNSHADOW));
    725         myr.left   += BorderShrink;
    726         myr.top    += BorderShrink;
    727         FillRect(dc, &myr, GetSysColorBrush(COLOR_3DLIGHT));
    728         myr.right  -= BorderShrink;
    729         myr.bottom -= BorderShrink;
    730         FillRect(dc, &myr, GetSysColorBrush(COLOR_3DDKSHADOW));
    731         myr.left   += BorderShrink;
    732         myr.top    += BorderShrink;
    733     }
     714    UINT flags = BF_RECT | BF_ADJUST;
     715
     716    if(uFlags & DFCS_FLAT) flags |= BF_FLAT;
     717    else if(uFlags & DFCS_MONO) flags |= BF_MONO;
     718
     719    UITOOLS95_DrawRectEdge( dc, &myr, EDGE_SUNKEN, flags );
    734720
    735721    if(uFlags & (DFCS_INACTIVE|DFCS_PUSHED))
    736     {
    737722        FillRect(dc, &myr, GetSysColorBrush(COLOR_BTNFACE));
    738     }
    739     else if(uFlags & DFCS_CHECKED)
    740     {
    741         if(GetSysColor(COLOR_BTNHIGHLIGHT) == RGB(255, 255, 255))
    742         {
    743             HBITMAP hbm = CreateBitmap(8, 8, 1, 1, wPattern_AA55);
    744             HBRUSH hbsave;
    745             HBRUSH hb = CreatePatternBrush(hbm);
    746 
    747             FillRect(dc, &myr, GetSysColorBrush(COLOR_BTNFACE));
    748             hbsave = (HBRUSH)SelectObject(dc, hb);
    749             PatBlt(dc, myr.left, myr.top, myr.right-myr.left, myr.bottom-myr.top, 0x00FA0089);
    750             SelectObject(dc, hbsave);
    751             DeleteObject(hb);
    752             DeleteObject(hbm);
    753         }
    754         else
    755         {
    756             FillRect(dc, &myr, GetSysColorBrush(COLOR_BTNHIGHLIGHT));
    757         }
    758     }
     723    else if( (uFlags & DFCS_BUTTON3STATE) && (uFlags & DFCS_CHECKED) )
     724        UITOOLS_DrawCheckedRect( dc, &myr );
    759725    else
    760726    {
     
    11391105    int tri = 290*SmallDiam/1000 -1;
    11401106    int d46, d93;
     1107
     1108    /*
     1109     * This fixes a problem with really tiny "scroll" buttons. In particular
     1110     * with the updown control.
     1111     * Making sure that the arrow is as least 3 pixels wide (or high).
     1112     */
     1113    if (tri == 0)
     1114      tri = 1;
    11411115
    11421116    switch(uFlags & 0xff)
Note: See TracChangeset for help on using the changeset viewer.