Changeset 2852 for trunk/src


Ignore:
Timestamp:
Feb 21, 2000, 6:25:33 PM (26 years ago)
Author:
cbratschi
Message:

merged with Corel WINE 20000212, added WS_EX_CONTEXTHELP

Location:
trunk/src/user32
Files:
11 edited

Legend:

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

    r2834 r2852  
    1 /* $Id: edit.cpp,v 1.34 2000-02-20 18:28:31 cbratschi Exp $ */
     1/* $Id: edit.cpp,v 1.35 2000-02-21 17:25:26 cbratschi Exp $ */
    22/*
    33 *      Edit control
     
    99 *      Copyright  1999 Christoph Bratschi
    1010 *
     11 * Corel version: 20000212
    1112 * WINE version: 991212
    1213 *
     
    257258static void     EDIT_WM_Timer(HWND hwnd, EDITSTATE *es, INT id, TIMERPROC timer_proc);
    258259static LRESULT  EDIT_WM_VScroll(HWND hwnd, EDITSTATE *es, INT action, INT pos, HWND scroll_bar);
    259 
     260static LRESULT EDIT_WM_MouseWheel(HWND hwnd,EDITSTATE *es,WPARAM wParam,LPARAM lParam);
    260261
    261262/*********************************************************************
     
    290291{
    291292        EDIT_EM_ReplaceSel(hwnd, es, TRUE, "");
     293        if (es->flags & EF_UPDATE) {
     294                es->flags &= ~EF_UPDATE;
     295                EDIT_NOTIFY_PARENT(hwnd, EN_CHANGE);
     296        }
    292297}
    293298
     
    693698                 */
    694699                //DPRINTF_EDIT_MSG32("WM_MOUSEACTIVATE");
    695                 SetFocus(hwnd);
    696700                result = MA_ACTIVATE;
    697701                break;
     
    748752                //DPRINTF_EDIT_MSG32("WM_VSCROLL");
    749753                result = EDIT_WM_VScroll(hwnd, es, LOWORD(wParam), SHIWORD(wParam), (HWND)(lParam));
     754                break;
     755
     756        case WM_MOUSEWHEEL:
     757                result = EDIT_WM_MouseWheel(hwnd,es,wParam,lParam);
    750758                break;
    751759
     
    24362444        es->flags |= EF_UPDATE;
    24372445        EDIT_EM_ScrollCaret(hwnd, es);
    2438         EDIT_NOTIFY_PARENT(hwnd,EN_UPDATE);
     2446
    24392447        /* FIXME: really inefficient */
    24402448        EDIT_Refresh(hwnd,es,TRUE);
     
    28752883        //                es->undo_insert_count, es->undo_text);
    28762884
     2885        if (es->flags & EF_UPDATE) {
     2886                es->flags &= ~EF_UPDATE;
     2887                EDIT_NOTIFY_PARENT(hwnd, EN_CHANGE);
     2888        }
     2889
    28772890        return TRUE;
    28782891}
     
    29172930                                EDIT_MoveDown_ML(hwnd, es, FALSE);
    29182931                        } else
     2932                        {
    29192933                                EDIT_EM_ReplaceSel(hwnd, es, TRUE, "\r\n");
     2934                                if (es->flags & EF_UPDATE) {
     2935                                        es->flags &= ~EF_UPDATE;
     2936                                        EDIT_NOTIFY_PARENT(hwnd, EN_CHANGE);
     2937                                }
     2938                        }
    29202939                }
    29212940                break;
    29222941        case '\t':
    29232942                if ((es->style & ES_MULTILINE) && !(es->style & ES_READONLY))
     2943                {
    29242944                        EDIT_EM_ReplaceSel(hwnd, es, TRUE, "\t");
     2945                        if (es->flags & EF_UPDATE) {
     2946                                es->flags &= ~EF_UPDATE;
     2947                                EDIT_NOTIFY_PARENT(hwnd, EN_CHANGE);
     2948                        }
     2949                }
    29252950                break;
    29262951        case VK_BACK:
     
    29362961                }
    29372962                break;
     2963//CB: are these three keys documented or Linux style???
     2964        case 0x03: /* ^C */
     2965                SendMessageA(hwnd, WM_COPY, 0, 0);
     2966                break;
     2967        case 0x16: /* ^V */
     2968                SendMessageA(hwnd, WM_PASTE, 0, 0);
     2969                break;
     2970        case 0x18: /* ^X */
     2971                SendMessageA(hwnd, WM_CUT, 0, 0);
     2972                break;
     2973
    29382974        default:
    29392975                if (!(es->style & ES_READONLY) && ((BYTE)c >= ' ') && (c != 127))
     
    29492985                  str[1] = '\0';
    29502986                  EDIT_EM_ReplaceSel(hwnd, es, TRUE, str);
     2987                  if (es->flags & EF_UPDATE)
     2988                  {
     2989                    es->flags &= ~EF_UPDATE;
     2990                    EDIT_NOTIFY_PARENT(hwnd, EN_CHANGE);
     2991                  }
    29512992                } else MessageBeep(MB_ICONEXCLAMATION);
    29522993                break;
     
    30853126           es->selection_start = es->selection_end = 0;
    30863127           EDIT_EM_ScrollCaret(hwnd, es);
     3128           if (es->flags & EF_UPDATE) {
     3129                es->flags &= ~EF_UPDATE;
     3130                EDIT_NOTIFY_PARENT(hwnd, EN_CHANGE);
     3131           }
    30873132       }
    30883133       return 0;
     
    30973142static void EDIT_WM_Destroy(HWND hwnd, EDITSTATE *es)
    30983143{
     3144        if (!es) /* Protect against multiple destroy messages */
     3145            return;
     3146
    30993147        if (es->hloc) {
    31003148                while (LocalUnlock(es->hloc)) ;
     
    33113359        HWND hLBox;
    33123360
     3361        /********************************************************************
     3362         * This if statement used to check to see if the parent of the
     3363         * edit control was a 'combobox' by comparing the ATOM of the parent
     3364         * to a table of internal window control ATOMs.  However, this check
     3365         * would fail if the parent was a superclassed combobox (Although
     3366         * having the same basic functionality of a combobox, it has a
     3367         * different name and ATOM, thus defeating this check.)
     3368         *
     3369         * The safe way to determine if the parent is a combobox is to send it
     3370         * a message only a combo box would understand.  I send it a message
     3371         * CB_GETCOUNT, if I get 0 then the parent is not a combobox -
     3372         * return FALSE.  If I get > 0, then the parent IS a combobox
     3373         * (or sub/super classed derrivative thereof)
     3374         ********************************************************************/
     3375#if 0 //CB: our code
    33133376        if (GetClassWord(GetParent(hwnd),GCW_ATOM) ==  GlobalFindAtomA(COMBOBOXCLASSNAME) &&
    3314                         (hLBox = COMBO_GetLBWindow(GetParent(hwnd)))) {
     3377                        (hLBox = COMBO_GetLBWindow(GetParent(hwnd))))
     3378#else   
     3379        if (
     3380             ((SendMessageA(GetParent(hwnd), CB_GETCOUNT, 0, 0)) > 0) &&
     3381             (hLBox = COMBO_GetLBWindow(GetParent(hwnd)))
     3382           )
     3383#endif
     3384        {
    33153385                HWND hCombo = GetParent(hwnd);
    33163386                BOOL bUIFlip = TRUE;
     
    35213591
    35223592        if (!(es->flags & EF_FOCUSED))
    3523                 return 0;
     3593          SetFocus(hwnd);
    35243594
    35253595        es->bCaptureState = TRUE;
     
    37593829
    37603830  ShowCaret(hwnd);
     3831}
     3832
     3833static VOID EDIT_Refresh(HWND hwnd,EDITSTATE *es,BOOL useCache)
     3834{
     3835  HDC hdc,hdcCompatible;
     3836  HBITMAP bitmap,oldbmp;
     3837  RECT rect;
    37613838
    37623839  if (es->flags & EF_UPDATE)
    37633840  {
    37643841    es->flags &= ~EF_UPDATE;
    3765     EDIT_NOTIFY_PARENT(hwnd, EN_CHANGE);
     3842    EDIT_NOTIFY_PARENT(hwnd,EN_UPDATE);
    37663843  }
    3767 }
    3768 
    3769 static VOID EDIT_Refresh(HWND hwnd,EDITSTATE *es,BOOL useCache)
    3770 {
    3771   HDC hdc,hdcCompatible;
    3772   HBITMAP bitmap,oldbmp;
    3773   RECT rect;
    37743844
    37753845  if (!IsWindowVisible(hwnd)) return;
     
    38333903                EDIT_EM_ReplaceSel(hwnd, es, TRUE, src);
    38343904                GlobalUnlock(hsrc);
     3905
     3906                if (es->flags & EF_UPDATE) {
     3907                        es->flags &= ~EF_UPDATE;
     3908                        EDIT_NOTIFY_PARENT(hwnd, EN_CHANGE);
     3909                }
    38353910        }
    38363911        CloseClipboard();
     
    39233998static void EDIT_WM_SetText(HWND hwnd, EDITSTATE *es, LPCSTR text)
    39243999{
    3925         EDIT_EM_SetSel(hwnd, es, 0, -1, FALSE);
     4000        es->selection_start = 0;
     4001        es->selection_end = lstrlenA(es->text);
     4002        if (es->flags & EF_FOCUSED)
     4003          EDIT_SetCaretPos(hwnd, es, es->selection_end, FALSE);
     4004
    39264005        if (text) {
    39274006                //TRACE_(edit)("\t'%s'\n", text);
     
    39414020        EDIT_EM_ScrollCaret(hwnd, es);
    39424021        EDIT_UpdateScrollBars(hwnd,es,TRUE,TRUE);
    3943         if (es->flags & EF_UPDATE) EDIT_NOTIFY_PARENT(hwnd,EN_UPDATE);
     4022        if (es->flags & EF_UPDATE)
     4023        {
     4024          EDIT_NOTIFY_PARENT(hwnd,EN_UPDATE);
     4025          /* EN_CHANGE notification need to be sent too
     4026             Windows doc says it's only done after the display,
     4027             the doc is WRONG. EN_CHANGE notification is sent
     4028             while processing WM_SETTEXT */
     4029          EDIT_NOTIFY_PARENT(hwnd, EN_CHANGE);
     4030          es->flags &= EF_UPDATE;
     4031        }
    39444032}
    39454033
     
    41174205}
    41184206
     4207static LRESULT EDIT_WM_MouseWheel(HWND hwnd,EDITSTATE *es,WPARAM wParam,LPARAM lParam)
     4208{
     4209  short gcWheelDelta = 0;
     4210  UINT pulScrollLines = 3;
     4211  SystemParametersInfoW(SPI_GETWHEELSCROLLLINES,0, &pulScrollLines, 0);
     4212
     4213  if (wParam & (MK_SHIFT | MK_CONTROL))
     4214    return DefWindowProcA(hwnd,WM_MOUSEWHEEL, wParam, lParam);
     4215  gcWheelDelta -= (short) HIWORD(wParam);
     4216  if (abs(gcWheelDelta) >= WHEEL_DELTA && pulScrollLines)
     4217  {
     4218    int cLineScroll= (int) min((UINT) es->line_count, pulScrollLines);
     4219
     4220    cLineScroll *= (gcWheelDelta / WHEEL_DELTA);
     4221    return EDIT_EM_LineScroll(hwnd, es, 0, cLineScroll);
     4222  }
     4223
     4224  return 0;
     4225}
     4226
    41194227BOOL EDIT_Register()
    41204228{
  • trunk/src/user32/listbox.cpp

    r2804 r2852  
    1 /* $Id: listbox.cpp,v 1.19 2000-02-16 14:34:20 sandervl Exp $ */
     1/* $Id: listbox.cpp,v 1.20 2000-02-21 17:25:27 cbratschi Exp $ */
    22/*
    33 * Listbox controls
     
    66 * Copyright 1999 Christoph Bratschi (ported from WINE)
    77 *
     8 * Corel version: 20000212
    89 * WINE version: 991212
    910 */
     
    1819#include <misc.h>
    1920
    20 #define DBG_LOCALLOG    DBG_listbox
     21#define DBG_LOCALLOG    DBG_listbox
    2122#include "dbglocal.h"
    2223
     
    8182    BOOL        caret_on;       /* Is caret on? */
    8283    BOOL        captured;       /* Is mouse captured? */
     84    BOOL        in_focus;
    8385    HFONT       font;           /* Current font */
    8486    LCID          locale;         /* Current locale for string comparisons */
     
    172174    SCROLLINFO info;
    173175
    174     if (!(descr->style & WS_VSCROLL)) return;
     176    /* Check the listbox scroll bar flags individually before we call
     177       SetScrollInfo otherwise when the listbox style is WS_HSCROLL and
     178       no WS_VSCROLL, we end up with an uninitialized, visible horizontal
     179       scroll bar when we do not need one.
     180              if (!(descr->style & WS_VSCROLL)) return;
     181          */
     182
    175183    /*   It is important that we check descr->style, and not wnd->dwStyle,
    176184       for WS_VSCROLL, as the former is exactly the one passed in
     
    194202        if (descr->style & LBS_DISABLENOSCROLL)
    195203            info.fMask |= SIF_DISABLENOSCROLL;
    196         SetScrollInfo( hwnd, SB_HORZ, &info, TRUE );
     204        if (descr->style & WS_HSCROLL)
     205          SetScrollInfo( hwnd, SB_HORZ, &info, TRUE );
    197206        info.nMax = 0;
    198207        info.fMask = SIF_RANGE;
    199         SetScrollInfo( hwnd, SB_VERT, &info, TRUE );
     208        if (descr->style & WS_VSCROLL)
     209          SetScrollInfo( hwnd, SB_VERT, &info, TRUE );
    200210    }
    201211    else
     
    208218        if (descr->style & LBS_DISABLENOSCROLL)
    209219            info.fMask |= SIF_DISABLENOSCROLL;
    210 
    211         SetScrollInfo( hwnd, SB_VERT, &info, TRUE );
     220        if (descr->style & WS_VSCROLL)
     221          SetScrollInfo( hwnd, SB_VERT, &info, TRUE );
    212222
    213223        if (descr->horz_extent)
     
    220230            if (descr->style & LBS_DISABLENOSCROLL)
    221231                info.fMask |= SIF_DISABLENOSCROLL;
    222             SetScrollInfo( hwnd, SB_HORZ, &info, TRUE );
     232            if (descr->style & WS_HSCROLL)
     233              SetScrollInfo( hwnd, SB_HORZ, &info, TRUE );
    223234        }
    224235    }
     
    314325
    315326    GetWindowRect( hwnd, &rectWindow );
    316     OffsetRect(&rectWindow, -rectWindow.left, -rectWindow.top);
    317327    GetClientRect( hwnd, &rect );
    318328
     329    //CB: todo: doesn't works in ShellAbout dialog
    319330    descr->width  = rect.right - rect.left;
    320331    descr->height = rect.bottom - rect.top;
     
    479490        if ((descr->focus_item == index) &&
    480491            (descr->caret_on) &&
    481             (GetFocus() == hwnd)) dis.itemState |= ODS_FOCUS;
     492            (descr->in_focus)) dis.itemState |= ODS_FOCUS;
    482493        if (dwStyle & WS_DISABLED) dis.itemState |= ODS_DISABLED;
    483494        dis.itemData     = item ? item->data : 0;
     
    532543        if ((descr->focus_item == index) &&
    533544            (descr->caret_on) &&
    534             (GetFocus() == hwnd)) DrawFocusRect( hdc, rect );
     545            (descr->in_focus)) DrawFocusRect( hdc, rect );
    535546    }
    536547}
     
    878889
    879890    if (!descr->nb_items && (descr->focus_item != -1) && descr->caret_on &&
    880         (GetFocus() == hwnd))
     891        (descr->in_focus))
    881892    {
    882893        /* Special case for empty listbox: paint focus rect */
     
    10711082static LRESULT LISTBOX_SetColumnWidth( HWND hwnd, LB_DESCR *descr, UINT width)
    10721083{
    1073     width += 2;  /* For left and right margin */
    10741084    if (width == descr->column_width) return LB_OKAY;
    10751085    //TRACE("[%04x]: new column width = %d\n",
     
    12031213    if (index == oldfocus) return LB_OKAY;
    12041214    descr->focus_item = index;
    1205     if ((oldfocus != -1) && descr->caret_on && (GetFocus() == hwnd))
     1215    if ((oldfocus != -1) && descr->caret_on && (descr->in_focus))
    12061216        LISTBOX_RepaintItem( hwnd, descr, oldfocus, ODA_FOCUS );
    12071217
    12081218    LISTBOX_MakeItemVisible( hwnd, descr, index, fully_visible );
    1209     if (descr->caret_on && (GetFocus() == hwnd))
     1219    if (descr->caret_on && (descr->in_focus))
    12101220        LISTBOX_RepaintItem( hwnd, descr, index, ODA_FOCUS );
    12111221
     
    12351245        if (index != -1) descr->items[index].selected = TRUE;
    12361246        descr->selected_item = index;
    1237         if (oldsel != -1) LISTBOX_RepaintItem( hwnd, descr, oldsel, 0);
     1247        if (oldsel != -1) LISTBOX_RepaintItem( hwnd, descr, oldsel, ODA_SELECT);
    12381248        if (index != -1) LISTBOX_RepaintItem( hwnd, descr, index, ODA_SELECT );
    12391249        if (send_notify && descr->nb_items) SEND_NOTIFICATION( hwnd, descr,
     
    14401450    if (index == -1) index = descr->nb_items - 1;
    14411451    else if ((index < 0) || (index >= descr->nb_items)) return LB_ERR;
     1452
     1453    /* We need to Invalidate the original rect intead of the updated one. */
     1454    LISTBOX_InvalidateItems( hwnd, descr, index );
     1455
    14421456    LISTBOX_DeleteItem( hwnd, descr, index );
    14431457
     
    14801494      }
    14811495    }
    1482     LISTBOX_InvalidateItems( hwnd, descr, index );
     1496
    14831497    if (descr->focus_item >= descr->nb_items)
    14841498    {
     
    17331747}
    17341748
     1749static LRESULT LISTBOX_HandleMouseWheel(HWND hwnd, LB_DESCR *descr,WPARAM wParam, LPARAM lParam )
     1750{
     1751    short gcWheelDelta = 0;
     1752    UINT pulScrollLines = 3;
     1753
     1754    SystemParametersInfoW(SPI_GETWHEELSCROLLLINES,0, &pulScrollLines, 0);
     1755
     1756    gcWheelDelta -= (short) HIWORD(wParam);
     1757
     1758    if (abs(gcWheelDelta) >= WHEEL_DELTA && pulScrollLines)
     1759    {
     1760        int cLineScroll = (int) min((UINT) descr->page_size, pulScrollLines);
     1761        cLineScroll *= (gcWheelDelta / WHEEL_DELTA);
     1762        LISTBOX_SetTopItem( hwnd, descr, descr->top_item + cLineScroll, TRUE );
     1763    }
     1764    return 0;
     1765}
    17351766
    17361767/***********************************************************************
     
    17431774    //TRACE("[%04x]: lbuttondown %d,%d item %d\n",
    17441775    //             wnd->hwndSelf, x, y, index );
    1745     if (!descr->caret_on && (GetFocus() == hwnd)) return 0;
     1776    if (!descr->caret_on && (descr->in_focus)) return 0;
    17461777    if (index != -1)
    17471778    {
     
    17681799    }
    17691800
    1770     if( !descr->lphc ) SetFocus( hwnd );
    1771     else SetFocus( (descr->lphc->hWndEdit) ? descr->lphc->hWndEdit
     1801    if (!descr->in_focus)
     1802    {
     1803      if( !descr->lphc ) SetFocus( hwnd );
     1804      else SetFocus( (descr->lphc->hWndEdit) ? descr->lphc->hWndEdit
    17721805                                             : descr->lphc->hwndself ) ;
     1806    }
    17731807
    17741808    descr->captured = TRUE;
     
    21912225    descr->tabs          = NULL;
    21922226    descr->caret_on      = TRUE;
     2227    descr->in_focus      = FALSE;
    21932228    descr->captured      = FALSE;
    21942229    descr->font          = 0;
     
    24832518            return LB_OKAY;
    24842519        descr->caret_on = TRUE;
    2485         if ((descr->focus_item != -1) && (GetFocus() == hwnd))
     2520        if ((descr->focus_item != -1) && (descr->in_focus))
    24862521            LISTBOX_RepaintItem( hwnd, descr, descr->focus_item, ODA_FOCUS );
    24872522        return LB_OKAY;
     
    24912526            return LB_OKAY;
    24922527        descr->caret_on = FALSE;
    2493         if ((descr->focus_item != -1) && (GetFocus() == hwnd))
     2528        if ((descr->focus_item != -1) && (descr->in_focus))
    24942529            LISTBOX_RepaintItem( hwnd, descr, descr->focus_item, ODA_FOCUS );
    24952530        return LB_OKAY;
     
    25282563        return 0;
    25292564    case WM_SETFOCUS:
     2565        descr->in_focus = TRUE;
    25302566        descr->caret_on = TRUE;
    25312567        if (descr->focus_item != -1)
     
    25342570        return 0;
    25352571    case WM_KILLFOCUS:
     2572        descr->in_focus = FALSE;
    25362573        if ((descr->focus_item != -1) && descr->caret_on)
    25372574            LISTBOX_RepaintItem( hwnd, descr, descr->focus_item, ODA_FOCUS );
     
    25422579    case WM_VSCROLL:
    25432580        return LISTBOX_HandleVScroll( hwnd, descr, wParam, lParam );
     2581    case WM_MOUSEACTIVATE:
     2582        return MA_NOACTIVATE;
     2583    case WM_MOUSEWHEEL:
     2584        if (wParam & (MK_SHIFT | MK_CONTROL))
     2585            return DefWindowProcA( hwnd, msg, wParam, lParam );
     2586        return LISTBOX_HandleMouseWheel( hwnd, descr, wParam, lParam );
    25442587    case WM_LBUTTONDOWN:
    25452588        return LISTBOX_HandleLButtonDown( hwnd, descr, wParam,
     
    26502693                 return LISTBOX_Create( hwnd, lphc );
    26512694            case WM_MOUSEMOVE:
    2652                  if (CB_GETTYPE(lphc) != CBS_SIMPLE)
     2695                 if (lphc && (CB_GETTYPE(lphc) != CBS_SIMPLE))
    26532696                 {
    26542697                   POINT   mousePos;
     
    26912734                 }
    26922735            case WM_LBUTTONUP:
     2736            if (lphc)
     2737            {
    26932738                 POINT mousePos;
    26942739                 RECT  clientRect;
     
    27192764                 }
    27202765                 return LISTBOX_HandleLButtonUp( hwnd, descr );
     2766            }
    27212767            case WM_LBUTTONDOWN:
    27222768                 return LISTBOX_HandleLButtonDownCombo( hwnd, descr, wParam,
     
    27272773                 return FALSE;
    27282774            case WM_KEYDOWN:
    2729                  if( CB_GETTYPE(lphc) != CBS_SIMPLE )
     2775                 if(lphc && (CB_GETTYPE(lphc) != CBS_SIMPLE))
    27302776                 {
    27312777                     /* for some reason(?) Windows makes it possible to
     
    27462792                 return lRet;
    27472793            case WM_NCDESTROY:
    2748                  if( CB_GETTYPE(lphc) != CBS_SIMPLE )
     2794                 if(lphc && (CB_GETTYPE(lphc) != CBS_SIMPLE))
    27492795                     lphc->hWndLBox = 0;
    27502796                 /* fall through */
  • trunk/src/user32/menu.cpp

    r2804 r2852  
    1 /* $Id: menu.cpp,v 1.17 2000-02-16 14:34:22 sandervl Exp $*/
     1/* $Id: menu.cpp,v 1.18 2000-02-21 17:25:28 cbratschi Exp $*/
    22/*
    33 * Menu functions
     
    99 * Copyright 1999 Christoph Bratschi
    1010 *
     11 * Corel version: 20000212
    1112 * WINE version: 20000130
    1213 *
     
    3031#include "menu.h"
    3132
    32 #define DBG_LOCALLOG    DBG_menu
     33#define DBG_LOCALLOG    DBG_menu
    3334#include "dbglocal.h"
    3435
    3536//DEFAULT_DEBUG_CHANNEL(menu)
     37//DECLARE_DEBUG_CHANNEL(winhelp)
    3638
    3739
     
    129131
    130132#define IS_STRING_ITEM(flags) (MENU_ITEM_TYPE ((flags)) == MF_STRING)
     133#define IS_SEPARATOR_ITEM(flags) (MENU_ITEM_TYPE ((flags)) == MF_SEPARATOR)
    131134#define IS_BITMAP_ITEM(flags) (MENU_ITEM_TYPE ((flags)) == MF_BITMAP)
    132135
     
    175178static BOOL fEndMenu = FALSE;
    176179
     180/*
     181   The following variables and defines are used to keep track of which
     182   menu item the mouse is currently over. (Used to implement a pause before
     183   popup menus are displayed. )
     184
     185   See: MENU_MouseMove()
     186        MENU_TrackMenu()
     187*/
     188#define     SUBMENU_POPUP_TIMERID    100
     189#define     POPUP_MENU_DELAY         500
     190static UINT mouseOverMenuID          = -1;
     191static BOOL isTimerSet               = FALSE;
    177192
    178193/***********************************************************************
     
    10841099    rect = lpitem->rect;
    10851100
     1101    //CB: todo: does Win98 use DrawEdge for menubars?
     1102
    10861103    if ((lpitem->fState & MF_HILITE) && !(IS_BITMAP_ITEM(lpitem->fType)))
    10871104            FillRect( hdc, &rect, GetSysColorBrush(COLOR_HIGHLIGHT) );
     
    11231140        if (lpitem->fState & MF_GRAYED)
    11241141            SetTextColor( hdc, GetSysColor( COLOR_GRAYTEXT ) );
     1142#if 1 //CB: WINE's Win98 menubar -> to check
     1143
    11251144        else
    11261145            SetTextColor( hdc, GetSysColor( COLOR_HIGHLIGHTTEXT ) );
     1146#else
     1147        else
     1148        {
     1149          if (menuBar)
     1150            SetTextColor(hdc,GetSysColor(COLOR_MENUTEXT));
     1151          else
     1152            SetTextColor( hdc, GetSysColor( COLOR_HIGHLIGHTTEXT ) );
     1153        }
     1154#endif
    11271155        SetBkColor( hdc, GetSysColor( COLOR_HIGHLIGHT ) );
    11281156    }
     
    17611789    {
    17621790        POPUPMENU *menu = MENU_GetMenu((UINT)id);
    1763         if (menu) menu->wFlags |= MF_POPUP;
     1791        if (IS_A_MENU(menu)) menu->wFlags |= MF_POPUP;
    17641792        else
    17651793        {
     
    21022130
    21032131            GetWindowRect(menu->hWnd,&rectWindow);
    2104             rect.left = rectWindow.left + item->rect.right-arrow_bitmap_width;
     2132            rect.left = rectWindow.left + item->rect.right;
    21052133            rect.top = rectWindow.top + item->rect.top;
    2106             rect.right = item->rect.left - item->rect.right + 2*arrow_bitmap_width;
     2134            rect.right = item->rect.left - item->rect.right;
    21072135            rect.bottom = item->rect.top - item->rect.bottom;
    21082136        }
     
    23392367    else if( ptmenu->FocusedItem != id )
    23402368    {
    2341             MENU_SwitchTracking( pmt, hPtMenu, id );
    2342             pmt->hCurrentMenu = MENU_ShowSubPopup(pmt->hOwnerWnd, hPtMenu, FALSE, wFlags,&pmt->pt);
     2369       POPUPMENU *menu;
     2370       MENUITEM *item;
     2371
     2372            MENU_SwitchTracking( pmt, hPtMenu, id );
     2373
     2374
     2375       /*
     2376          Test to see if we are trying to popup a submenu or not.
     2377          If we aren't, don't change the current menu pointer
     2378          and return.
     2379       */
     2380       if (!(menu = (POPUPMENU *)MENU_GetMenu( hPtMenu )))
     2381       {
     2382          pmt->hCurrentMenu = hPtMenu;
     2383          return TRUE;
     2384       }
     2385
     2386       if (!IsWindow( menu->hWnd ) ||
     2387           (menu->FocusedItem == NO_SELECTED_ITEM))
     2388       {
     2389          pmt->hCurrentMenu = hPtMenu;
     2390          return TRUE;
     2391       }
     2392
     2393       item = &menu->items[menu->FocusedItem];
     2394       if (!(item->fType & MF_POPUP) ||
     2395           (item->fState & (MF_GRAYED | MF_DISABLED)))
     2396       {
     2397          pmt->hCurrentMenu =  hPtMenu;
     2398          return TRUE;
     2399       }
     2400
     2401
     2402       /*
     2403         If we made it this far, we want to pop up a submenu.  Before we pop it up,
     2404         we want a slight delay.  This is implemented by remembering the ID of the menu
     2405         where the mouse is currently positioned, and setting up a timer.  When the
     2406         timer fires (handled in MENU_TrackMenu() ), if the mouse is over the same
     2407         submenu item, we popup it up.  Otherwise, we do nothing.
     2408       */
     2409       KillTimer (pmt->hOwnerWnd, SUBMENU_POPUP_TIMERID); /* Just in case another timer was set up and not fired yet... */
     2410       if ( (SetTimer (pmt->hOwnerWnd, SUBMENU_POPUP_TIMERID, POPUP_MENU_DELAY, NULL)) != SUBMENU_POPUP_TIMERID)
     2411       {
     2412          /*
     2413            For some reason the timer wasn't set up properly... Revert to old
     2414            functionality.
     2415          */
     2416       
     2417          pmt->hCurrentMenu = MENU_ShowSubPopup(pmt->hOwnerWnd, hPtMenu, FALSE, wFlags,&pmt->pt);
     2418          return TRUE;
     2419    }
     2420
     2421       mouseOverMenuID = id;
     2422       isTimerSet = TRUE;
    23432423    }
    23442424    return TRUE;
     
    27112791            } /* switch(msg.message) - mouse */
    27122792        }
     2793        else if (msg.message == WM_TIMER)
     2794        {
     2795           UINT id = -1;
     2796           POPUPMENU *ptmenu = NULL;
     2797
     2798           if (isTimerSet)
     2799           {
     2800              /*
     2801                If we get here, an attempt was made to pop up a submenu.
     2802                (See MENU_MouseMove() )
     2803              */
     2804
     2805              /* Get the ID of the menu item the mouse is over now. */
     2806              if( hmenu )
     2807              {
     2808                 ptmenu = (POPUPMENU *)MENU_GetMenu( hmenu );
     2809                 if( IS_SYSTEM_MENU(ptmenu) )
     2810                   id = 0;
     2811                 else
     2812                   MENU_FindItemByCoords( ptmenu, mt.pt, &id );
     2813              }
     2814       
     2815              /* If it is over the same item that set up the timer
     2816                 originally .... */
     2817              if (mouseOverMenuID == id)
     2818              {
     2819                 /* .... Pop up the menu */
     2820                 mt.hCurrentMenu = MENU_ShowSubPopup(mt.hOwnerWnd, hmenu, FALSE, wFlags,&mt.pt);
     2821              }
     2822       
     2823              /* Reset the timer so it doesn't fire again. (So we are ready for the next
     2824                 attempt to popup a submenu... ) */
     2825              KillTimer (mt.hOwnerWnd, 100);
     2826              isTimerSet = FALSE;
     2827           }
     2828        }
    27132829        else if ((msg.message >= WM_KEYFIRST) && (msg.message <= WM_KEYLAST))
    27142830        {
     
    27502866                    break;
    27512867
     2868                case VK_F1:
     2869                    {
     2870                        HELPINFO hi;
     2871                        hi.cbSize = sizeof(HELPINFO);
     2872                        hi.iContextType = HELPINFO_MENUITEM;
     2873                        if (menu->FocusedItem == NO_SELECTED_ITEM)
     2874                            hi.iCtrlId = 0;
     2875                        else   
     2876                            hi.iCtrlId = menu->items[menu->FocusedItem].wID;
     2877                        hi.hItemHandle = hmenu;
     2878                        hi.dwContextId = menu->dwContextHelpID;
     2879                        hi.MousePos = msg.pt;
     2880                        //TRACE_(winhelp)("Sending HELPINFO_MENUITEM to 0x%08x\n", hwnd);
     2881                        SendMessageA(hwnd, WM_HELP, 0, (LPARAM)&hi);
     2882                        break;
     2883                    }
     2884
    27522885                default:
    27532886                    break;
     
    28893022}
    28903023
     3024MENUITEM  *MENU_HighlightedItem=NULL;
     3025UINT       MENU_HighlightedItemID=NO_SELECTED_ITEM;
     3026POPUPMENU *MENU_HighlightedMenu=NULL;
     3027
     3028void MENU_TrackMouseMenuBar_MouseMove(HWND hwnd,POINT pt,BOOL OnMenu)
     3029{
     3030    HMENU hMenu = getMenu(hwnd);
     3031    MENUITEM *item = NULL;
     3032    RECT rect;
     3033    HDC hdc;
     3034    BOOL UnHighlight = (OnMenu==TRUE)?FALSE:TRUE;
     3035    POPUPMENU *ptmenu = NULL;
     3036    UINT id = NO_SELECTED_ITEM;
     3037
     3038    if (OnMenu == TRUE && IsMenu(hMenu)) {
     3039
     3040        ptmenu=(POPUPMENU *)MENU_GetMenu( hMenu );
     3041
     3042        item=MENU_FindItemByCoords( ptmenu, pt, &id );
     3043
     3044        if(!item) {
     3045            /* No item selected, perhaps we are on the blank spot? */
     3046            UnHighlight = TRUE;
     3047            /* Paranoid setting */
     3048            item=NULL;
     3049        } else if(id == MENU_HighlightedItemID) {
     3050            /* If it's already highlighted, don't do it again */
     3051            return;
     3052        } else if(item->fState & MF_MOUSESELECT) {
     3053            /* If it's dropped, we let the DrawMenuItem draw the sunken border */
     3054            return;
     3055        } else if(item->fType & MF_BITMAP) {
     3056            UnHighlight = TRUE;
     3057            /* (Required) Paranoid setting */
     3058            item=NULL;
     3059        } else {
     3060            hdc = GetDCEx( ptmenu->hWnd, 0, DCX_CACHE | DCX_WINDOW);
     3061            rect = item->rect;
     3062            DrawEdge(hdc, &rect, BDR_RAISEDINNER, BF_RECT);
     3063            ReleaseDC( ptmenu->hWnd, hdc );
     3064
     3065            UnHighlight = TRUE;
     3066        }
     3067    }
     3068
     3069    if(UnHighlight == TRUE) {
     3070        if(MENU_HighlightedItem) {
     3071            if(!(MENU_HighlightedItem->fState & MF_MOUSESELECT)) {
     3072                hdc = GetDCEx( MENU_HighlightedMenu->hWnd, 0, DCX_CACHE | DCX_WINDOW);
     3073                rect = MENU_HighlightedItem->rect;
     3074
     3075                FrameRect(hdc, &rect, GetSysColorBrush(COLOR_MENU));
     3076                ReleaseDC( MENU_HighlightedMenu->hWnd, hdc );
     3077            }
     3078        }
     3079
     3080        /* Sets to NULL, NO_SELECTED_ITEM, NULL, unless it found a new
     3081            item, then it will be filled in with the proper values */
     3082        MENU_HighlightedItem = item;
     3083        MENU_HighlightedItemID = id;
     3084        MENU_HighlightedMenu= ptmenu;
     3085    }
     3086}
    28913087
    28923088/***********************************************************************
     
    33333529    dprintf(("USER32: GetMenuItemCount"));
    33343530
    3335     if (!menu) return -1;
     3531    if (!IS_A_MENU(menu)) return -1;
    33363532    //TRACE("(%04x) returning %d\n",
    33373533    //              hMenu, menu->nItems );
     
    33483544    dprintf(("USER32: GetMenuItemID"));
    33493545
    3350     if (!(lpmi = MENU_FindItem(&hMenu,(UINT*)&nPos,MF_BYPOSITION))) return 0;
    3351     if (lpmi->fType & MF_POPUP) return -1;
     3546    if (!(lpmi = MENU_FindItem(&hMenu,(UINT*)&nPos,MF_BYPOSITION))) return 0xFFFFFFFF;
     3547    if (lpmi->fType & MF_POPUP) return 0xFFFFFFFF;
    33523548    return lpmi->wID;
    33533549
     
    35443740
    35453741    if (!(hmenu = CreateMenu())) return 0;
    3546     menu = (POPUPMENU*)hmenu;
     3742    menu = MENU_GetMenu(hmenu);
    35473743    menu->wFlags |= MF_POPUP;
    35483744    menu->bTimeToHide = FALSE;
     
    36333829          SetWindowLongA(pTPWnd,0,0);
    36343830
    3635         if (!IS_A_MENU(lppop)) lppop = NULL;
    3636         if (lppop)
     3831        if (IS_A_MENU(lppop))
    36373832        {
    36383833            lppop->wMagic = 0;  /* Mark it as destroyed */
     
    39454140BOOL WINAPI IsMenu(HMENU hmenu)
    39464141{
    3947     LPPOPUPMENU menu = (LPPOPUPMENU)hmenu;
     4142    LPPOPUPMENU menu = MENU_GetMenu(hmenu);
    39484143
    39494144    dprintf(("USER32: IsMenu"));
     
    41124307        if (menu->hSubMenu) {
    41134308            POPUPMENU *subMenu = MENU_GetMenu((UINT)menu->hSubMenu);
    4114             if (subMenu) {
     4309            if (IS_A_MENU(subMenu)) {
    41154310                subMenu->wFlags |= MF_POPUP;
    41164311                menu->fType |= MF_POPUP;
     
    44654660
    44664661    dprintf(("USER32: GetMenuContextHelpId"));
    4467     //TRACE("(0x%04x)\n", hMenu);
    44684662
    44694663    menu = MENU_GetMenu(hMenu);
     
    44814675{
    44824676    dprintf(("USER32: MenuItemFromPoint not implemented!"));
    4483     //FIXME("(0x%04x,0x%04x,(%ld,%ld)):stub\n",
    4484     //      hWnd, hMenu, ptScreen.x, ptScreen.y);
     4677
    44854678    return 0;
     4679}
     4680
     4681/**********************************************************************
     4682 *         IsMenuActive    (Internal)
     4683 */
     4684BOOL IsMenuActive()
     4685{
     4686    return pTopPopupWnd &&  (GetWindowLongA(pTopPopupWnd,GWL_STYLE) & WS_VISIBLE);
    44864687}
    44874688
  • trunk/src/user32/static.cpp

    r2804 r2852  
    1 /* $Id: static.cpp,v 1.17 2000-02-16 14:34:34 sandervl Exp $ */
     1/* $Id: static.cpp,v 1.18 2000-02-21 17:25:29 cbratschi Exp $ */
    22/*
    33 * Static control
     
    77 * Copyright  David W. Metcalfe, 1993
    88 *
     9 * Corel version: 20000212
    910 * WINE version: 990923
    1011 *
     
    1920#include "static.h"
    2021
    21 #define DBG_LOCALLOG    DBG_static
     22#define DBG_LOCALLOG    DBG_static
    2223#include "dbglocal.h"
    2324
     
    718719    FillRect( hdc, &rc, hbrush );
    719720
    720     if (infoPtr->hIcon) {
     721    if (infoPtr->hIcon)
     722    {
    721723        BITMAP bm;
    722         SIZE sz;
    723 
    724         if(GetObjectType(infoPtr->hIcon) != OBJ_BITMAP)
    725             return;
     724
     725        if(GetObjectType(infoPtr->hIcon) != OBJ_BITMAP) return;
    726726        if (!(hMemDC = CreateCompatibleDC( hdc ))) return;
    727         GetObjectA(infoPtr->hIcon, sizeof(bm), &bm);
    728         GetBitmapDimensionEx(infoPtr->hIcon, &sz);
    729         oldbitmap = SelectObject(hMemDC, infoPtr->hIcon);
    730         if (dwStyle & SS_CENTERIMAGE)
    731           BitBlt(hdc,sz.cx,sz.cy,bm.bmWidth,bm.bmHeight,hMemDC,(rc.right-bm.bmWidth)/2,(rc.bottom-bm.bmHeight)/2,SRCCOPY);
     727
     728        GetObjectA(infoPtr->hIcon, sizeof(bm), &bm);
     729        oldbitmap = SelectObject(hMemDC, infoPtr->hIcon);
     730
     731        // Paint the image in center area
     732        if(dwStyle & SS_CENTERIMAGE)
     733        {
     734            SIZE szbm;
     735            SIZE szdc;
     736
     737            if(bm.bmWidth > rc.right - rc.left)
     738            {
     739                szdc.cx = 0;
     740                szbm.cx = (bm.bmWidth - (rc.right - rc.left)) / 2;
     741                bm.bmWidth = rc.right - rc.left;
     742            }
     743            else
     744            {
     745                szbm.cx = 0;
     746                szdc.cx = ((rc.right - rc.left) - bm.bmWidth) / 2;
     747            }
     748            if(bm.bmHeight > rc.bottom - rc.top)
     749            {
     750                szdc.cy = 0;
     751                szbm.cy = (bm.bmHeight - (rc.bottom - rc.top)) / 2;
     752                bm.bmWidth = rc.bottom - rc.top;
     753            }
     754            else
     755            {
     756                szbm.cy = 0;
     757                szdc.cy = ((rc.bottom - rc.top) - bm.bmHeight) / 2;
     758            }
     759            BitBlt(hdc, szdc.cx, szdc.cy, bm.bmWidth, bm.bmHeight, hMemDC,
     760                szbm.cx, szbm.cy, SRCCOPY);
     761        }
    732762        else
    733           BitBlt(hdc,sz.cx,sz.cy,bm.bmWidth,bm.bmHeight,hMemDC,0,0,SRCCOPY);
    734         SelectObject(hMemDC, oldbitmap);
    735         DeleteDC(hMemDC);
     763        {
     764            BitBlt(hdc, 0, 0, bm.bmWidth, bm.bmHeight, hMemDC, 0, 0, SRCCOPY);
     765        }
     766
     767        SelectObject(hMemDC, oldbitmap);
     768        DeleteDC(hMemDC);
    736769    }
    737770}
     
    764797  di.itemData   = 0;
    765798
    766   SendMessageA(GetParent(hwnd),WM_DRAWITEM,GetWindowLongA(hwnd,GWL_ID),(LPARAM)&di);
     799  SendMessageA(GetParent(hwnd),WM_CTLCOLORSTATIC,hdc,hwnd);
     800  SendMessageA(GetParent(hwnd),WM_DRAWITEM,di.CtlID,(LPARAM)&di);
    767801}
    768802
  • trunk/src/user32/uitools.cpp

    r2804 r2852  
    1 /* $Id: uitools.cpp,v 1.23 2000-02-16 14:34:37 sandervl Exp $ */
     1/* $Id: uitools.cpp,v 1.24 2000-02-21 17:25:29 cbratschi Exp $ */
    22/*
    33 * User Interface Functions
     
    1616#include "win32wbase.h"
    1717
    18 #define DBG_LOCALLOG    DBG_uitools
     18#define DBG_LOCALLOG    DBG_uitools
    1919#include "dbglocal.h"
    2020
     
    18261826  return (TRUE);
    18271827}
    1828 
    1829 
    1830 /*****************************************************************************
    1831  * Name      : VOID WIN32API DrawCaption
    1832  * Purpose   : The DrawCaption function draws a window caption.
    1833  * Parameters: HDC hdc        handle of device context
    1834  *             LPRECT lprc    address of bounding rectangle coordinates
    1835  *             HFONT hfont    handle of font for caption
    1836  *             HICON hicon    handle of icon in caption
    1837  *             LPSTR lpszText address of caption string
    1838  *             WORD wFlags    drawing options
    1839  * Variables :
    1840  * Result    :
    1841  * Remark    :
    1842  * Status    : UNTESTED STUB
    1843  *
    1844  * Author    : Patrick Haller [Thu, 1998/02/26 11:55]
    1845  *****************************************************************************/
    1846 
    1847 BOOL WIN32API DrawCaption (HWND hwnd,
    1848                            HDC  hdc,
    1849                            const RECT *lprc,
    1850                            UINT wFlags)
    1851 {
    1852   dprintf(("USER32:DrawCaption (%08xh,%08xh,%08xh,%08xh) not implemented.\n",
    1853          hwnd,
    1854          hdc,
    1855          lprc,
    1856          wFlags));
    1857 
    1858   return FALSE;
    1859 }
    1860 /***********************************************************************
    1861  * DrawCaptionTemp32A [USER32.599]
    1862  *
    1863  * PARAMS
    1864  *
    1865  * RETURNS
    1866  *     Success:
    1867  *     Failure:
    1868  */
    1869 
    1870 BOOL WIN32API DrawCaptionTempA(HWND       hwnd,
    1871                                HDC        hdc,
    1872                                const RECT *rect,
    1873                                HFONT      hFont,
    1874                                HICON      hIcon,
    1875                                LPCSTR     str,
    1876                                UINT       uFlags)
    1877 {
    1878   RECT   rc = *rect;
    1879 
    1880   dprintf(("USER32: DrawCaptionTempA(%08xh,%08xh,%08xh,%08xh,%08xh,%08xh,%08xh)\n",
    1881            hwnd,
    1882            hdc,
    1883            rect,
    1884            hFont,
    1885            hIcon,
    1886            str,
    1887            uFlags));
    1888 
    1889   /* drawing background */
    1890   if (uFlags & DC_INBUTTON)
    1891   {
    1892     O32_FillRect (hdc,
    1893                   &rc,
    1894                   GetSysColorBrush (COLOR_3DFACE));
    1895 
    1896     if (uFlags & DC_ACTIVE)
    1897     {
    1898       HBRUSH hbr = O32_SelectObject (hdc,
    1899                                      GetSysColorBrush (COLOR_ACTIVECAPTION));
    1900       O32_PatBlt (hdc,
    1901                   rc.left,
    1902                   rc.top,
    1903                   rc.right - rc.left,
    1904                   rc.bottom - rc.top,
    1905                   0xFA0089);
    1906 
    1907       O32_SelectObject (hdc,
    1908                         hbr);
    1909     }
    1910   }
    1911   else
    1912   {
    1913     O32_FillRect (hdc,
    1914                   &rc,
    1915                   GetSysColorBrush ((uFlags & DC_ACTIVE) ?
    1916                     COLOR_ACTIVECAPTION : COLOR_INACTIVECAPTION));
    1917   }
    1918 
    1919 
    1920   /* drawing icon */
    1921   if ((uFlags & DC_ICON) && !(uFlags & DC_SMALLCAP))
    1922   {
    1923     POINT pt;
    1924 
    1925     pt.x = rc.left + 2;
    1926     pt.y = (rc.bottom + rc.top - O32_GetSystemMetrics(SM_CYSMICON)) / 2;
    1927 
    1928     if (hIcon)
    1929     {
    1930       DrawIconEx (hdc,
    1931                   pt.x,
    1932                   pt.y,
    1933                   hIcon,
    1934                   O32_GetSystemMetrics(SM_CXSMICON),
    1935                   O32_GetSystemMetrics(SM_CYSMICON),
    1936                   0,
    1937                   0,
    1938                   DI_NORMAL);
    1939     }
    1940     else
    1941     {
    1942     /* @@@PH 1999/06/08 not ported yet, just don't draw any icon
    1943       WND *wndPtr = WIN_FindWndPtr(hwnd);
    1944       HICON hAppIcon = 0;
    1945 
    1946       if (wndPtr->class->hIconSm)
    1947         hAppIcon = wndPtr->class->hIconSm;
    1948       else
    1949         if (wndPtr->class->hIcon)
    1950           hAppIcon = wndPtr->class->hIcon;
    1951 
    1952       DrawIconEx (hdc,
    1953                   pt.x,
    1954                   pt.y,
    1955                   hAppIcon,
    1956                   GetSystemMetrics(SM_CXSMICON),
    1957                   GetSystemMetrics(SM_CYSMICON),
    1958                   0,
    1959                   0,
    1960                   DI_NORMAL);
    1961 
    1962       WIN_ReleaseWndPtr(wndPtr);
    1963       */
    1964     }
    1965 
    1966     rc.left += (rc.bottom - rc.top);
    1967   }
    1968 
    1969   /* drawing text */
    1970   if (uFlags & DC_TEXT)
    1971   {
    1972     HFONT hOldFont;
    1973 
    1974     if (uFlags & DC_INBUTTON)
    1975       O32_SetTextColor (hdc,
    1976                         O32_GetSysColor (COLOR_BTNTEXT));
    1977     else
    1978       if (uFlags & DC_ACTIVE)
    1979         O32_SetTextColor (hdc,
    1980                           O32_GetSysColor (COLOR_CAPTIONTEXT));
    1981       else
    1982         O32_SetTextColor (hdc,
    1983                           O32_GetSysColor (COLOR_INACTIVECAPTIONTEXT));
    1984 
    1985     O32_SetBkMode (hdc,
    1986                    TRANSPARENT);
    1987 
    1988     if (hFont)
    1989       hOldFont = O32_SelectObject (hdc,
    1990                                    hFont);
    1991     else
    1992     {
    1993       NONCLIENTMETRICSA nclm;
    1994       HFONT             hNewFont;
    1995 
    1996       nclm.cbSize = sizeof(NONCLIENTMETRICSA);
    1997       O32_SystemParametersInfo (SPI_GETNONCLIENTMETRICS,
    1998                                 0,
    1999                                 &nclm,
    2000                                 0);
    2001       hNewFont = O32_CreateFontIndirect ((uFlags & DC_SMALLCAP) ?
    2002                                  &nclm.lfSmCaptionFont : &nclm.lfCaptionFont);
    2003       hOldFont = O32_SelectObject (hdc,
    2004                                    hNewFont);
    2005     }
    2006 
    2007     if (str)
    2008       DrawTextA (hdc,
    2009                     str,
    2010                     -1,
    2011                     &rc,
    2012                     DT_SINGLELINE | DT_VCENTER | DT_NOPREFIX | DT_LEFT);
    2013     else
    2014     {
    2015       CHAR szText[128];
    2016       INT  nLen;
    2017 
    2018       nLen = O32_GetWindowText (Win32BaseWindow::Win32ToOS2FrameHandle(hwnd),
    2019                                 szText,
    2020                                 128);
    2021 
    2022       DrawTextA (hdc,
    2023                     szText,
    2024                     nLen,
    2025                     &rc,
    2026                     DT_SINGLELINE | DT_VCENTER | DT_NOPREFIX | DT_LEFT);
    2027     }
    2028 
    2029     if (hFont)
    2030       O32_SelectObject (hdc,
    2031                         hOldFont);
    2032     else
    2033       O32_DeleteObject (O32_SelectObject (hdc,
    2034                                           hOldFont));
    2035   }
    2036 
    2037   /* drawing focus ??? */
    2038   if (uFlags & 0x2000)
    2039   {
    2040     dprintf(("USER32: DrawCaptionTempA undocumented flag (0x2000)!\n"));
    2041   }
    2042 
    2043   return 0;
    2044 }
    2045 
    2046 
    2047 /***********************************************************************
    2048  * DrawCaptionTemp32W [USER32.602]
    2049  *
    2050  * PARAMS
    2051  *
    2052  * RETURNS
    2053  *     Success:
    2054  *     Failure:
    2055  */
    2056 
    2057 BOOL WIN32API DrawCaptionTempW (HWND       hwnd,
    2058                                 HDC        hdc,
    2059                                 const RECT *rect,
    2060                                 HFONT      hFont,
    2061                                 HICON      hIcon,
    2062                                 LPCWSTR    str,
    2063                                 UINT       uFlags)
    2064 {
    2065   LPSTR strAscii = UnicodeToAsciiString((LPWSTR)str);
    2066 
    2067   BOOL res = DrawCaptionTempA (hwnd,
    2068                                hdc,
    2069                                rect,
    2070                                hFont,
    2071                                hIcon,
    2072                                strAscii,
    2073                                uFlags);
    2074 
    2075   FreeAsciiString(strAscii);
    2076 
    2077   return res;
    2078 }
    2079 
    20801828//******************************************************************************
    20811829//******************************************************************************
  • trunk/src/user32/user32.cpp

    r2804 r2852  
    1 /* $Id: user32.cpp,v 1.73 2000-02-16 14:34:39 sandervl Exp $ */
     1/* $Id: user32.cpp,v 1.74 2000-02-21 17:25:29 cbratschi Exp $ */
    22
    33/*
     
    4242#include <winuser.h>
    4343
    44 #define DBG_LOCALLOG    DBG_user32
     44#define DBG_LOCALLOG    DBG_user32
    4545#include "dbglocal.h"
    4646
     
    705705
    706706    case SM_CYCAPTION:
    707         rc = OSLibWinQuerySysValue(OSLIB_HWND_DESKTOP,SVOS_CYTITLEBAR);
     707        rc = 19;
     708        //rc = OSLibWinQuerySysValue(OSLIB_HWND_DESKTOP,SVOS_CYTITLEBAR);
    708709        break;
    709710
  • trunk/src/user32/win32wbase.cpp

    r2834 r2852  
    1 /* $Id: win32wbase.cpp,v 1.165 2000-02-20 18:28:34 cbratschi Exp $ */
     1/* $Id: win32wbase.cpp,v 1.166 2000-02-21 17:25:31 cbratschi Exp $ */
    22/*
    33 * Win32 Window Base Class for OS/2
     
    88 *
    99 * Parts based on Wine Windows code (windows\win.c)
     10 *   Corel version: corel20000212
    1011 *
    1112 * Copyright 1993, 1994, 1996 Alexandre Julliard
     
    5354#include "dbglocal.h"
    5455
    55 #define SC_ABOUTWINE            (SC_SCREENSAVE+1)
    56 #define SC_PUTMARK              (SC_SCREENSAVE+2)
    57 
    5856/* bits in the dwKeyData */
    5957#define KEYDATA_ALT         0x2000
     
    138136  windowClass      = 0;
    139137
    140   iconResource       = NULL;
     138  hIcon              = 0;
     139  hIconSm            = 0;
    141140
    142141  EraseBkgndFlag     = TRUE;
     
    581580  fakeWinBase.pWindowClass = windowClass;
    582581
    583   //Set icon from class
    584   if(windowClass->getIcon())
    585         SetIcon(windowClass->getIcon());
     582  //Set icon from window or class
     583  if (hIcon)
     584    OSLibWinSetIcon(OS2HwndFrame,hIcon);
     585  else if (windowClass->getIcon())
     586    OSLibWinSetIcon(OS2HwndFrame,windowClass->getIcon());
     587
    586588  /* Get class or window DC if needed */
    587589  if(windowClass->getStyle() & CS_OWNDC) {
     
    14791481        if( hdc )
    14801482        {
    1481           if( (getStyle() & WS_MINIMIZE) && getWindowClass()->getIcon())
     1483          if( (getStyle() & WS_MINIMIZE) && (getWindowClass()->getIcon() && hIcon))
    14821484          {
    14831485            int x = (rectWindow.right - rectWindow.left - GetSystemMetrics(SM_CXICON))/2;
    14841486            int y = (rectWindow.bottom - rectWindow.top - GetSystemMetrics(SM_CYICON))/2;
    14851487            dprintf(("Painting class icon: vis rect=(%i,%i - %i,%i)\n", ps.rcPaint.left, ps.rcPaint.top, ps.rcPaint.right, ps.rcPaint.bottom ));
    1486             DrawIcon(hdc, x, y, getWindowClass()->getIcon() );
     1488            DrawIcon(hdc, x, y, hIcon ? hIcon:getWindowClass()->getIcon() );
    14871489          }
    14881490          EndPaint(getWindowHandle(), &ps );
     
    15321534    {
    15331535      POINT point;
     1536      LRESULT retvalue;
    15341537
    15351538      point.x = (SHORT)LOWORD(lParam);
    15361539      point.y = (SHORT)HIWORD(lParam);
    15371540
    1538       return HandleNCHitTest(point);
     1541      retvalue = HandleNCHitTest(point);
     1542#if 0 //CB: let the Corel people fix the bugs first
     1543      if(retvalue == HTMENU)
     1544        MENU_TrackMouseMenuBar_MouseMove(Win32Hwnd,point,TRUE);
     1545      else
     1546        MENU_TrackMouseMenuBar_MouseMove(Win32Hwnd,point,FALSE);
     1547#endif
     1548      return retvalue;
    15391549    }
    15401550
     
    16361646        if ((dwStyle & WS_VISIBLE) && wParam) return 0;
    16371647        else if (!(dwStyle & WS_VISIBLE) && !wParam) return 0;
    1638         ShowWindow(wParam ? SW_SHOWNOACTIVATE : SW_HIDE);
     1648        ShowWindow(wParam ? SW_SHOW:SW_HIDE);
    16391649        return 0;
    16401650
     
    16521662    case WM_QUERYDRAGICON:
    16531663        {
    1654             HICON hIcon = windowClass->getCursor();
     1664            HICON hDragIcon = windowClass->getCursor();
    16551665            UINT len;
    16561666
    1657             if(hIcon) return (LRESULT)hIcon;
     1667            if(hDragIcon) return (LRESULT)hDragIcon;
    16581668            for(len = 1; len < 64; len++)
    16591669            {
    1660               hIcon = LoadIconA(hInstance,MAKEINTRESOURCEA(len));
    1661               if(hIcon)
    1662                 return (LRESULT)hIcon;
     1670              hDragIcon = LoadIconA(hInstance,MAKEINTRESOURCEA(len));
     1671              if(hDragIcon)
     1672                return (LRESULT)hDragIcon;
    16631673            }
    16641674            return (LRESULT)LoadIconA(0,IDI_APPLICATIONA);
     
    16741684    case WM_SETICON:
    16751685    case WM_GETICON:
    1676     {
    1677             LRESULT result = 0;
    1678             if (!windowClass) return result;
    1679             int index = GCL_HICON;
    1680 
    1681             if (wParam == ICON_SMALL)
    1682                 index = GCL_HICONSM;
    1683 
    1684             result = windowClass->getClassLongA(index);
    1685 
     1686        {
     1687          LRESULT result = 0;
     1688          if (!windowClass) return result;
     1689          /* Set the appropriate icon members in the window structure. */
     1690          if (wParam == ICON_SMALL)
     1691          {
     1692            result = hIconSm;
    16861693            if (Msg == WM_SETICON)
    1687                 windowClass->setClassLongA(index, lParam);
    1688 
    1689             return result;
    1690     }
     1694              hIconSm = (HICON)lParam;
     1695          }
     1696          else
     1697          {
     1698            result = hIcon;
     1699            if (Msg == WM_SETICON)
     1700            {
     1701              hIcon = (HICON)lParam;
     1702              OSLibWinSetIcon(OS2HwndFrame,hIcon);
     1703            }
     1704          }
     1705          return result;
     1706        }
     1707
     1708    case WM_HELP:
     1709        if (getParent()) getParent()->SendInternalMessageA(Msg,wParam,lParam);
     1710        break;
    16911711
    16921712    case WM_NOTIFY:
     
    19571977        window = parentwindow;
    19581978   }
    1959 }
    1960 //******************************************************************************
    1961 //******************************************************************************
    1962 BOOL Win32BaseWindow::SetIcon(HICON hIcon)
    1963 {
    1964     dprintf(("Win32BaseWindow::SetIcon %x", hIcon));
    1965     if(OSLibWinSetIcon(OS2HwndFrame, hIcon) == TRUE) {
    1966 //TODO: Wine does't send these. Correct?
    1967 //        SendInternalMessageA(WM_SETICON, ICON_BIG, hIcon);
    1968         return TRUE;
    1969     }
    1970     return FALSE;
    19711979}
    19721980//******************************************************************************
  • trunk/src/user32/win32wbase.h

    r2677 r2852  
    1 /* $Id: win32wbase.h,v 1.83 2000-02-07 20:32:43 cbratschi Exp $ */
     1/* $Id: win32wbase.h,v 1.84 2000-02-21 17:25:31 cbratschi Exp $ */
    22/*
    33 * Win32 Window Base Class for OS/2
     
    193193         HMENU  GetSysMenu()                        { return hSysMenu; }
    194194
    195          BOOL   SetIcon(HICON hIcon);
    196          HICON  GetIcon()                           { return (HICON) iconResource; };
     195         HICON  GetIcon()                           { return hIcon; }
     196         HICON  GetSmallIcon()                      { return hIconSm; }
    197197
    198198         void   SetWindowRegion(HRGN hRegion)       { hWindowRegion = hRegion; };
     
    357357
    358358   Win32BaseWindow *owner;
    359      Win32Resource *iconResource;
     359        HICON   hIcon,hIconSm;
    360360
    361361        char   *windowNameA;
  • trunk/src/user32/win32wbasenonclient.cpp

    r2834 r2852  
    1 /* $Id: win32wbasenonclient.cpp,v 1.12 2000-02-20 18:28:35 cbratschi Exp $ */
     1/* $Id: win32wbasenonclient.cpp,v 1.13 2000-02-21 17:25:32 cbratschi Exp $ */
    22/*
    33 * Win32 Window Base Class for OS/2 (non-client methods)
     
    66 *
    77 * Based on Wine code (windows\nonclient.c)
     8 *  Corel Version 20000212
    89 *
    910 * Copyright 1994 Alexandre Julliard
     
    4243#include "dbglocal.h"
    4344
    44 #define SC_ABOUTODIN            (SC_SCREENSAVE+1)
    45 #define SC_PUTMARK              (SC_SCREENSAVE+2)
    46 
    4745/* bits in the dwKeyData */
    4846#define KEYDATA_ALT         0x2000
    4947#define KEYDATA_PREVSTATE   0x4000
    5048
    51 static INT bitmapW = 16,bitmapH = 14; //CB: todo: use these values
     49static INT bitmapW = 16,bitmapH = 14;
    5250static HBITMAP hbitmapClose     = 0;
    5351static HBITMAP hbitmapCloseD    = 0;
     
    479477      {
    480478        /* Check if there is an user icon */
    481         HICON hIcon = (HICON) GetClassLongA(Win32Hwnd, GCL_HICONSM);
    482         if(!hIcon) hIcon = (HICON) GetClassLongA(Win32Hwnd, GCL_HICON);
     479        HICON hSysIcon = hIconSm;
     480        if(!hSysIcon) hSysIcon = (HICON) GetClassLongA(Win32Hwnd,GCL_HICONSM);
    483481
    484482        /* If there is an icon associated with the window OR              */
    485483        /* If there is no hIcon specified and this is not a modal dialog, */
    486484        /* there is a system menu icon.                                   */
    487         if((hIcon != 0) || (!(dwStyle & DS_MODALFRAME)))
    488         rect.left += GetSystemMetrics(SM_CYCAPTION) - 1;
     485        if((hSysIcon != 0) || (!(dwStyle & DS_MODALFRAME)))
     486          rect.left += GetSystemMetrics(SM_CYCAPTION) - 1;
    489487      }
    490488      if (pt.x < rect.left) return HTSYSMENU;
     
    492490      /* Check close button */
    493491      if (dwStyle & WS_SYSMENU)
    494       rect.right -= GetSystemMetrics(SM_CYCAPTION) - 1;
     492        rect.right -= GetSystemMetrics(SM_CYCAPTION) - 1;
    495493      if (pt.x > rect.right) return HTCLOSE;
     494
     495      //Check context help
     496      if (dwExStyle & WS_EX_CONTEXTHELP)
     497        rect.right -= GetSystemMetrics(SM_CXSIZE) + 1;
     498      if (pt.x > rect.right) return HTHELP;
    496499
    497500      /* Check maximize box */
    498501      /* In win95 there is automatically a Maximize button when there is a minimize one*/
    499502      if ((dwStyle & WS_MAXIMIZEBOX)|| (dwStyle & WS_MINIMIZEBOX))
    500       rect.right -= GetSystemMetrics(SM_CXSIZE) + 1;
     503        rect.right -= GetSystemMetrics(SM_CXSIZE) + 1;
    501504      if (pt.x > rect.right) return HTMAXBUTTON;
    502505
     
    548551  }
    549552
    550   /* Should never get here */
    551   return HTERROR;
     553  /* Has to return HTNOWHERE if nothing was found
     554     Could happen when a window has a customized non client area */
     555  return HTNOWHERE;
    552556}
    553557
     
    621625BOOL Win32BaseWindow::DrawSysButton(HDC hdc,RECT *rect)
    622626{
    623   HICON  hIcon;
     627  HICON  hSysIcon;
    624628  RECT r;
    625629
     
    627631  else r = *rect;
    628632
    629   hIcon = (HICON) GetClassLongA(Win32Hwnd, GCL_HICONSM);
    630   if(!hIcon) hIcon = (HICON) GetClassLongA(Win32Hwnd, GCL_HICON);
     633  hSysIcon = hIconSm;
     634
     635  /* if no small icon and no large icon, use class small icon */
     636  if (!hSysIcon && !hIcon)
     637    hSysIcon =  (HICON) GetClassLongA(Win32Hwnd, GCL_HICONSM);
     638
     639  /* otherwise use the large icon */
     640  if (!hSysIcon) hSysIcon = hIcon;
     641
     642  /* if all else fails, use the application icon. */
     643  if(!hSysIcon) hSysIcon = (HICON) GetClassLongA(Win32Hwnd, GCL_HICON);
    631644
    632645  /* If there is no hIcon specified or this is not a modal dialog, */
    633646  /* get the default one.                                          */
    634   if(hIcon == 0)
     647  if(hSysIcon == 0)
    635648    if (!(dwStyle & DS_MODALFRAME))
    636       hIcon = LoadImageA(0, MAKEINTRESOURCEA(OIC_ODINICON), IMAGE_ICON, 0, 0, LR_DEFAULTCOLOR);
     649      hSysIcon = LoadImageA(0, MAKEINTRESOURCEA(OIC_ODINICON), IMAGE_ICON, 0, 0, LR_DEFAULTCOLOR);
    637650//CB: todo: add icons (including Odin icon) to user32.rc
    638   if (hIcon)
    639     DrawIconEx(hdc,r.left+2,r.top+2,hIcon,
     651  if (hSysIcon)
     652    DrawIconEx(hdc,r.left+2,r.top+2,hSysIcon,
    640653               GetSystemMetrics(SM_CXSMICON),
    641654               GetSystemMetrics(SM_CYSMICON),
    642655               0, 0, DI_NORMAL);
    643656
    644   return (hIcon != 0);
     657  return (hSysIcon != 0);
    645658}
    646659//******************************************************************************
     
    701714  else r = *rect;
    702715
    703   hdcMem = CreateCompatibleDC( hdc );
    704   hBmp = down ? hbitmapCloseD : hbitmapClose;
    705   hOldBmp = SelectObject (hdcMem, hBmp);
    706   GetObjectA (hBmp, sizeof(BITMAP), &bmp);
    707 
    708   BitBlt (hdc, r.right - (GetSystemMetrics(SM_CYCAPTION) + 1 + bmp.bmWidth) / 2,
    709           r.top + (GetSystemMetrics(SM_CYCAPTION) - 1 - bmp.bmHeight) / 2,
    710           bmp.bmWidth, bmp.bmHeight, hdcMem, 0, 0, SRCCOPY);
    711 
    712   if(bGrayed)
    713     DrawGrayButton(hdc,r.right - (GetSystemMetrics(SM_CYCAPTION) + 1 + bmp.bmWidth) / 2 + 2,
    714                    r.top + (GetSystemMetrics(SM_CYCAPTION) - 1 - bmp.bmHeight) / 2 + 2);
    715 
    716   SelectObject (hdcMem, hOldBmp);
    717   DeleteDC (hdcMem);
     716  /* A tool window has a smaller Close button */
     717  if (dwExStyle & WS_EX_TOOLWINDOW)
     718  {
     719    RECT toolRect;     
     720    INT iBmpHeight = 11; /* Windows does not use SM_CXSMSIZE and SM_CYSMSIZE   */
     721    INT iBmpWidth = 11;  /* it uses 11x11 for  the close button in tool window */               
     722    INT iCaptionHeight = GetSystemMetrics(SM_CYSMCAPTION);
     723
     724
     725    toolRect.top = r.top + (iCaptionHeight - 1 - iBmpHeight) / 2;
     726    toolRect.left = r.right - (iCaptionHeight + 1 + iBmpWidth) / 2;
     727    toolRect.bottom = toolRect.top + iBmpHeight;
     728    toolRect.right = toolRect.left + iBmpWidth;
     729    DrawFrameControl(hdc,&toolRect,
     730                     DFC_CAPTION,DFCS_CAPTIONCLOSE |
     731                     down ? DFCS_PUSHED : 0 |
     732                     bGrayed ? DFCS_INACTIVE : 0);
     733  } else
     734  {
     735    hdcMem = CreateCompatibleDC( hdc );
     736    hBmp = down ? hbitmapCloseD : hbitmapClose;
     737    hOldBmp = SelectObject (hdcMem, hBmp);
     738    GetObjectA (hBmp, sizeof(BITMAP), &bmp);
     739
     740    BitBlt (hdc, r.right - (GetSystemMetrics(SM_CYCAPTION) + 1 + bmp.bmWidth) / 2,
     741            r.top + (GetSystemMetrics(SM_CYCAPTION) - 1 - bmp.bmHeight) / 2,
     742            bmp.bmWidth, bmp.bmHeight, hdcMem, 0, 0, SRCCOPY);
     743
     744    if(bGrayed)
     745      DrawGrayButton(hdc,r.right - (GetSystemMetrics(SM_CYCAPTION) + 1 + bmp.bmWidth) / 2 + 2,
     746                     r.top + (GetSystemMetrics(SM_CYCAPTION) - 1 - bmp.bmHeight) / 2 + 2);
     747
     748    SelectObject (hdcMem, hOldBmp);
     749    DeleteDC (hdcMem);
     750  }
    718751}
    719752//******************************************************************************
     
    738771    r.right -= GetSystemMetrics(SM_CYCAPTION) + 1;
    739772
     773  if (dwExStyle & WS_EX_CONTEXTHELP)
     774    r.right -= bmp.bmWidth;
     775
    740776  BitBlt( hdc, r.right - (GetSystemMetrics(SM_CXSIZE) + bmp.bmWidth) / 2,
    741777        r.top + (GetSystemMetrics(SM_CYCAPTION) - 1 - bmp.bmHeight) / 2,
     
    769805    r.right -= GetSystemMetrics(SM_CYCAPTION) + 1;
    770806
     807  if (dwExStyle & WS_EX_CONTEXTHELP)
     808    r.right -= bmp.bmWidth;
     809
    771810  /* In win 95 there is always a Maximize box when there is a Minimize one */
    772811  if ((dwStyle & WS_MAXIMIZEBOX) || (dwStyle & WS_MINIMIZEBOX))
     
    796835  if (!rect) GetInsideRect(&r);
    797836  else r = *rect;
    798 #if 0 //CB: todo
    799   hdcMem = CreateCompatibleDC( hdc );
    800   hBmp = down ? hbitmapMinimizeD : hbitmapMinimize;
    801   hOldBmp= SelectObject( hdcMem, hBmp );
    802   GetObjectA (hBmp, sizeof(BITMAP), &bmp);
     837
     838  hdcMem = CreateCompatibleDC(hdc);
     839  hBmp = down ? hbitmapHelpD : hbitmapHelp;
     840  hOldBmp = SelectObject(hdcMem,hBmp);
     841  GetObjectA(hBmp,sizeof(BITMAP),&bmp);
    803842
    804843  if (dwStyle & WS_SYSMENU)
    805     r.right -= GetSystemMetrics(SM_CYCAPTION) + 1;
    806 
    807   /* In win 95 there is always a Maximize box when there is a Minimize one */
    808   if ((dwStyle & WS_MAXIMIZEBOX) || (dwStyle & WS_MINIMIZEBOX))
    809     r.right -= bmp.bmWidth;
     844    r.right -= GetSystemMetrics(SM_CYCAPTION)+1;
    810845
    811846  BitBlt( hdc, r.right - (GetSystemMetrics(SM_CXSIZE) + bmp.bmWidth) / 2,
     
    820855  SelectObject (hdcMem, hOldBmp);
    821856  DeleteDC( hdcMem );
    822 #endif
    823857}
    824858//******************************************************************************
     
    912946    if (dwExStyle & WS_EX_CONTEXTHELP)
    913947    {
    914 #if 0      //CB: todo: integrate help button
    915       DrawHelpButton(memDC,&r2,FALSE);
    916       r.right -= bitmapW;
    917 #endif
     948      DrawHelpButton(memDC,&r2,FALSE,FALSE);
     949      r.right -= GetSystemMetrics(SM_CXSIZE) + 1;
    918950    }
    919951
     
    12881320    return 0;
    12891321}
    1290 //******************************************************************************
    1291 //******************************************************************************
     1322/*****************************************************************************
     1323 * Name      : VOID WIN32API DrawCaption
     1324 * Purpose   : The DrawCaption function draws a window caption.
     1325 * Parameters: HDC hdc        handle of device context
     1326 *             LPRECT lprc    address of bounding rectangle coordinates
     1327 *             HFONT hfont    handle of font for caption
     1328 *             HICON hicon    handle of icon in caption
     1329 *             LPSTR lpszText address of caption string
     1330 *             WORD wFlags    drawing options
     1331 * Variables :
     1332 * Result    :
     1333 * Remark    :
     1334 * Status    : UNTESTED STUB
     1335 *
     1336 * Author    : Patrick Haller [Thu, 1998/02/26 11:55]
     1337 *****************************************************************************/
     1338
     1339BOOL WIN32API DrawCaption (HWND hwnd,
     1340                           HDC  hdc,
     1341                           const RECT *lprc,
     1342                           UINT wFlags)
     1343{
     1344  dprintf(("USER32:DrawCaption (%08xh,%08xh,%08xh,%08xh) not implemented.\n",
     1345         hwnd,
     1346         hdc,
     1347         lprc,
     1348         wFlags));
     1349
     1350  return FALSE;
     1351}
     1352/***********************************************************************
     1353 * DrawCaptionTemp32A [USER32.599]
     1354 *
     1355 * PARAMS
     1356 *
     1357 * RETURNS
     1358 *     Success:
     1359 *     Failure:
     1360 */
     1361
     1362BOOL WIN32API DrawCaptionTempA(HWND       hwnd,
     1363                               HDC        hdc,
     1364                               const RECT *rect,
     1365                               HFONT      hFont,
     1366                               HICON      hIcon,
     1367                               LPCSTR     str,
     1368                               UINT       uFlags)
     1369{
     1370  RECT   rc = *rect;
     1371
     1372  dprintf(("USER32: DrawCaptionTempA(%08xh,%08xh,%08xh,%08xh,%08xh,%08xh,%08xh)\n",
     1373           hwnd,
     1374           hdc,
     1375           rect,
     1376           hFont,
     1377           hIcon,
     1378           str,
     1379           uFlags));
     1380
     1381  /* drawing background */
     1382  if (uFlags & DC_INBUTTON)
     1383  {
     1384    O32_FillRect (hdc,
     1385                  &rc,
     1386                  GetSysColorBrush (COLOR_3DFACE));
     1387
     1388    if (uFlags & DC_ACTIVE)
     1389    {
     1390      HBRUSH hbr = O32_SelectObject (hdc,
     1391                                     GetSysColorBrush (COLOR_ACTIVECAPTION));
     1392      O32_PatBlt (hdc,
     1393                  rc.left,
     1394                  rc.top,
     1395                  rc.right - rc.left,
     1396                  rc.bottom - rc.top,
     1397                  0xFA0089);
     1398
     1399      O32_SelectObject (hdc,
     1400                        hbr);
     1401    }
     1402  }
     1403  else
     1404  {
     1405    O32_FillRect (hdc,
     1406                  &rc,
     1407                  GetSysColorBrush ((uFlags & DC_ACTIVE) ?
     1408                    COLOR_ACTIVECAPTION : COLOR_INACTIVECAPTION));
     1409  }
     1410
     1411
     1412  /* drawing icon */
     1413  if ((uFlags & DC_ICON) && !(uFlags & DC_SMALLCAP))
     1414  {
     1415    POINT pt;
     1416
     1417    pt.x = rc.left + 2;
     1418    pt.y = (rc.bottom + rc.top - O32_GetSystemMetrics(SM_CYSMICON)) / 2;
     1419
     1420    if (hIcon)
     1421    {
     1422      DrawIconEx (hdc,
     1423                  pt.x,
     1424                  pt.y,
     1425                  hIcon,
     1426                  O32_GetSystemMetrics(SM_CXSMICON),
     1427                  O32_GetSystemMetrics(SM_CYSMICON),
     1428                  0,
     1429                  0,
     1430                  DI_NORMAL);
     1431    }
     1432    else
     1433    {
     1434    /* @@@PH 1999/06/08 not ported yet, just don't draw any icon
     1435      WND *wndPtr = WIN_FindWndPtr(hwnd);
     1436      HICON hAppIcon = 0;
     1437
     1438      if (wndPtr->class->hIconSm)
     1439        hAppIcon = wndPtr->class->hIconSm;
     1440      else
     1441        if (wndPtr->class->hIcon)
     1442          hAppIcon = wndPtr->class->hIcon;
     1443
     1444      DrawIconEx (hdc,
     1445                  pt.x,
     1446                  pt.y,
     1447                  hAppIcon,
     1448                  GetSystemMetrics(SM_CXSMICON),
     1449                  GetSystemMetrics(SM_CYSMICON),
     1450                  0,
     1451                  0,
     1452                  DI_NORMAL);
     1453
     1454      WIN_ReleaseWndPtr(wndPtr);
     1455      */
     1456    }
     1457
     1458    rc.left += (rc.bottom - rc.top);
     1459  }
     1460
     1461  /* drawing text */
     1462  if (uFlags & DC_TEXT)
     1463  {
     1464    HFONT hOldFont;
     1465
     1466    if (uFlags & DC_INBUTTON)
     1467      O32_SetTextColor (hdc,
     1468                        O32_GetSysColor (COLOR_BTNTEXT));
     1469    else
     1470      if (uFlags & DC_ACTIVE)
     1471        O32_SetTextColor (hdc,
     1472                          O32_GetSysColor (COLOR_CAPTIONTEXT));
     1473      else
     1474        O32_SetTextColor (hdc,
     1475                          O32_GetSysColor (COLOR_INACTIVECAPTIONTEXT));
     1476
     1477    O32_SetBkMode (hdc,
     1478                   TRANSPARENT);
     1479
     1480    if (hFont)
     1481      hOldFont = O32_SelectObject (hdc,
     1482                                   hFont);
     1483    else
     1484    {
     1485      NONCLIENTMETRICSA nclm;
     1486      HFONT             hNewFont;
     1487
     1488      nclm.cbSize = sizeof(NONCLIENTMETRICSA);
     1489      O32_SystemParametersInfo (SPI_GETNONCLIENTMETRICS,
     1490                                0,
     1491                                &nclm,
     1492                                0);
     1493      hNewFont = O32_CreateFontIndirect ((uFlags & DC_SMALLCAP) ?
     1494                                 &nclm.lfSmCaptionFont : &nclm.lfCaptionFont);
     1495      hOldFont = O32_SelectObject (hdc,
     1496                                   hNewFont);
     1497    }
     1498
     1499    if (str)
     1500      DrawTextA (hdc,
     1501                    str,
     1502                    -1,
     1503                    &rc,
     1504                    DT_SINGLELINE | DT_VCENTER | DT_NOPREFIX | DT_LEFT);
     1505    else
     1506    {
     1507      CHAR szText[128];
     1508      INT  nLen;
     1509
     1510      nLen = O32_GetWindowText (Win32BaseWindow::Win32ToOS2FrameHandle(hwnd),
     1511                                szText,
     1512                                128);
     1513
     1514      DrawTextA (hdc,
     1515                    szText,
     1516                    nLen,
     1517                    &rc,
     1518                    DT_SINGLELINE | DT_VCENTER | DT_NOPREFIX | DT_LEFT);
     1519    }
     1520
     1521    if (hFont)
     1522      O32_SelectObject (hdc,
     1523                        hOldFont);
     1524    else
     1525      O32_DeleteObject (O32_SelectObject (hdc,
     1526                                          hOldFont));
     1527  }
     1528
     1529  /* drawing focus ??? */
     1530  if (uFlags & 0x2000)
     1531  {
     1532    dprintf(("USER32: DrawCaptionTempA undocumented flag (0x2000)!\n"));
     1533  }
     1534
     1535  return 0;
     1536}
     1537/***********************************************************************
     1538 * DrawCaptionTemp32W [USER32.602]
     1539 *
     1540 * PARAMS
     1541 *
     1542 * RETURNS
     1543 *     Success:
     1544 *     Failure:
     1545 */
     1546
     1547BOOL WIN32API DrawCaptionTempW (HWND       hwnd,
     1548                                HDC        hdc,
     1549                                const RECT *rect,
     1550                                HFONT      hFont,
     1551                                HICON      hIcon,
     1552                                LPCWSTR    str,
     1553                                UINT       uFlags)
     1554{
     1555  LPSTR strAscii = UnicodeToAsciiString((LPWSTR)str);
     1556
     1557  BOOL res = DrawCaptionTempA (hwnd,
     1558                               hdc,
     1559                               rect,
     1560                               hFont,
     1561                               hIcon,
     1562                               strAscii,
     1563                               uFlags);
     1564
     1565  FreeAsciiString(strAscii);
     1566
     1567  return res;
     1568}
     1569
  • trunk/src/user32/win32wmdiclient.cpp

    r2803 r2852  
    1 /* $Id: win32wmdiclient.cpp,v 1.24 2000-02-16 14:28:24 sandervl Exp $ */
     1/* $Id: win32wmdiclient.cpp,v 1.25 2000-02-21 17:25:32 cbratschi Exp $ */
    22/*
    33 * Win32 MDI Client Window Class for OS/2
     
    3636#include "win32wndhandle.h"
    3737
    38 #define DBG_LOCALLOG    DBG_win32wmdiclient
     38#define DBG_LOCALLOG    DBG_win32wmdiclient
    3939#include "dbglocal.h"
    4040
     
    857857  // In Win 95 look, the system menu is replaced by the child icon
    858858
    859   HICON hIcon = GetClassLongA(child->getWindowHandle(), GCL_HICONSM);
    860   if (!hIcon)
    861     hIcon = GetClassLongA(child->getWindowHandle(), GCL_HICON);
     859  /* Find small icon */
     860  HICON hIcon = child->GetSmallIcon();
     861
     862  /* If no small icon or overwridden large icon, use class small icon.. */
     863  if (!hIcon && !child->GetIcon())
     864    hIcon = GetClassLongA(child->getWindowHandle(),GCL_HICONSM);
     865
     866  /* Use large icon */
     867  if (!hIcon) hIcon = child->GetIcon();
     868
     869  /* If all else fails, use large class icon. */
     870  if (!hIcon) hIcon = GetClassLongA(child->getWindowHandle(),GCL_HICON);
     871
    862872  if (hIcon)
    863873  {
  • trunk/src/user32/window.cpp

    r2803 r2852  
    1 /* $Id: window.cpp,v 1.55 2000-02-16 14:28:26 sandervl Exp $ */
     1/* $Id: window.cpp,v 1.56 2000-02-21 17:25:33 cbratschi Exp $ */
    22/*
    33 * Win32 window apis for OS/2
     
    3232#include <win\winpos.h>
    3333
    34 #define DBG_LOCALLOG    DBG_window
     34#define DBG_LOCALLOG    DBG_window
    3535#include "dbglocal.h"
    3636
     
    670670
    671671    if(hwnd == 0x68000034) {
    672         window = 0;
     672        window = 0;
    673673    }
    674674    dprintf(("GetWindowRect %x (%d,%d) (%d,%d)", hwnd, pRect->left, pRect->top, pRect->right, pRect->bottom));
     
    857857
    858858    dprintf(("AdjustWindowRectEx returned (%d,%d)(%d,%d)\n", rect->left, rect->top, rect->right, rect->bottom));
     859
    859860    return TRUE;
    860861}
     
    929930    wnd = Win32BaseWindow::GetWindowFromHandle (hwnd);
    930931    if (!wnd) {
    931         dprintf(("warning: ScreenToClient: window %x not found!", hwnd));
    932         return (TRUE);
     932        dprintf(("warning: ScreenToClient: window %x not found!", hwnd));
     933        return (TRUE);
    933934    }
    934935#ifdef DEBUG
     
    10571058    wnd = Win32BaseWindow::GetWindowFromHandle (hwnd);
    10581059    if (!wnd) {
    1059         dprintf(("warning: ClientToScreen window %x not found!", hwnd));
     1060        dprintf(("warning: ClientToScreen window %x not found!", hwnd));
    10601061        SetLastError(ERROR_INVALID_WINDOW_HANDLE);
    10611062        return (FALSE);
     
    10661067    rc = mapWin32Point(wnd->getOS2WindowHandle(),OSLIB_HWND_DESKTOP,(OSLIBPOINT*)pt);
    10671068    dprintf(("ClientToScreen %x (%d,%d) -> (%d,%d)", hwnd, tmp.x, tmp.y, pt->x, pt->y));
    1068    
     1069
    10691070    return rc;
    10701071}
     
    10781079    if (count <= 0)
    10791080    {
    1080         dprintf(("USER32: BeginDeferWindowPos invalid param %d", count));
     1081        dprintf(("USER32: BeginDeferWindowPos invalid param %d", count));
    10811082        SetLastError(ERROR_INVALID_PARAMETER);
    10821083        return 0;
Note: See TracChangeset for help on using the changeset viewer.