Changeset 3153 for trunk/src


Ignore:
Timestamp:
Mar 18, 2000, 5:13:41 PM (25 years ago)
Author:
cbratschi
Message:

merged with Corel 20000317, small icon

Location:
trunk/src/user32
Files:
14 edited

Legend:

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

    r2804 r3153  
    1 /* $Id: button.cpp,v 1.33 2000-02-16 14:34:03 sandervl Exp $ */
     1/* $Id: button.cpp,v 1.34 2000-03-18 16:13:25 cbratschi Exp $ */
    22/* File: button.cpp -- Button type widgets
    33 *
     
    77 * Copyright (c) 1999 Christoph Bratschi
    88 *
    9  * WINE version: 20000130
     9 * Corel version: 20000317
     10 * (WINE version: 20000130)
    1011 *
    1112 * Status: complete
     
    2122#include "initterm.h"
    2223
    23 #define DBG_LOCALLOG    DBG_button
     24#define DBG_LOCALLOG    DBG_button
    2425#include "dbglocal.h"
    2526
     
    485486  HANDLE oldHbitmap = infoPtr->hImage;
    486487
    487   if ((dwStyle & BS_BITMAP) || (dwStyle & BS_ICON)) infoPtr->hImage = (HANDLE)lParam;
     488  if ((dwStyle & BS_BITMAP) || (dwStyle & BS_ICON))
     489  {
     490    infoPtr->hImage = (HANDLE)lParam;
     491    InvalidateRect(hwnd,NULL,FALSE);
     492  }
    488493
    489494  return oldHbitmap;
  • trunk/src/user32/combo.cpp

    r3108 r3153  
    1 /* $Id: combo.cpp,v 1.27 2000-03-14 15:00:58 sandervl Exp $ */
     1/* $Id: combo.cpp,v 1.28 2000-03-18 16:13:26 cbratschi Exp $ */
    22/*
    33 * Combo controls
     
    88 * FIXME: roll up in Netscape 3.01.
    99 *
    10  * Corel version: 20000212
     10 * Corel version: 20000317
    1111 * (WINE version: 991212)
    1212 *
     
    3131#endif
    3232
    33 #define DBG_LOCALLOG    DBG_combo
     33#define DBG_LOCALLOG    DBG_combo
    3434#include "dbglocal.h"
    3535
     
    10151015   if( idx >= 0 )
    10161016   {
    1017        SendMessageA( lphc->hWndLBox, LB_SETTOPINDEX, (WPARAM)idx, 0 );
     1017       /* the LB_SETCARETINDEX message should scroll the list box if required
     1018          and sending LB_SETTOPINDEX can generate annoying behaviors  */
    10181019       /* probably superfluous but Windows sends this too */
    10191020       SendMessageA( lphc->hWndLBox, LB_SETCARETINDEX, (WPARAM)idx, 0 );
     
    11501151                           RDW_ERASE | RDW_UPDATENOW | RDW_NOCHILDREN );
    11511152
    1152    ShowWindow( lphc->hWndLBox, SW_SHOWNA );
     1153   EnableWindow( lphc->hWndLBox, TRUE );
     1154   ShowWindow( lphc->hWndLBox, SW_SHOW);
     1155
    11531156}
    11541157
     
    13851388
    13861389           case (EN_UPDATE >> 8):
    1387                 //SvL: Don't send updates either. (Realplayer 7 infinite loops)
     1390                //SvL: Don't send updates either. (Realplayer 7 infinite loops)
     1391                //CB: note: EN_UPDATE changes in Corel 20000317
    13881392               /*
    13891393                * In some circumstances (when the selection of the combobox
     
    13991403                else
    14001404                {
    1401                         CB_NOTIFY( lphc, CBN_EDITUPDATE );
    1402                 }
     1405                  CB_NOTIFY( lphc, CBN_EDITUPDATE );
     1406                }
    14031407                break;
    14041408
     
    19041908{
    19051909  LPHEADCOMBO lphc = (LPHEADCOMBO)GetInfoPtr(hwnd);
     1910  INT CurSel = SendMessageA( lphc->hWndLBox, LB_GETCURSEL, 0, 0 );
    19061911  INT index = SendMessageA(lphc->hWndLBox,LB_SELECTSTRING,wParam,lParam);
    19071912
     
    19091914  {
    19101915    if( lphc->wState & CBF_EDIT )
    1911       CBUpdateEdit( lphc, index );
    1912     else
    1913       InvalidateRect(CB_HWND(lphc), &lphc->textRect, TRUE);
     1916    {
     1917      if (CurSel != index)
     1918        CBUpdateEdit( lphc, index );
     1919    } else
     1920        InvalidateRect(CB_HWND(lphc), &lphc->textRect, TRUE);
    19141921  }
    19151922
  • trunk/src/user32/edit.cpp

    r3028 r3153  
    1 /* $Id: edit.cpp,v 1.37 2000-03-06 22:39:03 sandervl Exp $ */
     1/* $Id: edit.cpp,v 1.38 2000-03-18 16:13:26 cbratschi Exp $ */
    22/*
    33 *      Edit control
     
    99 *      Copyright  1999 Christoph Bratschi
    1010 *
    11  * Corel version: 20000212
    12  * WINE version: 991212
     11 * Corel version: 20000317
     12 * (WINE version: 991212)
    1313 *
    1414 * Status:  complete
     
    590590        case WM_GETDLGCODE:
    591591                //DPRINTF_EDIT_MSG32("WM_GETDLGCODE");
    592                 result = (es->style & ES_MULTILINE) ?
    593                                 DLGC_WANTALLKEYS | DLGC_HASSETSEL | DLGC_WANTCHARS | DLGC_WANTARROWS :
    594                                 DLGC_HASSETSEL | DLGC_WANTCHARS | DLGC_WANTARROWS;
    595                 break;
     592                result = DLGC_HASSETSEL | DLGC_WANTCHARS | DLGC_WANTARROWS;
     593                if (es->style & ES_WANTRETURN)
     594                {
     595                   LPMSG msg = (LPMSG)lParam;
     596                   if (msg && (msg->message == WM_KEYDOWN) && (msg->wParam == VK_RETURN))
     597                      result |= DLGC_WANTMESSAGE;
     598                }
     599                break;
    596600
    597601        case WM_CHAR:
     
    12591263        HLOCAL hNew32;
    12601264
    1261         if (size <= es->buffer_size)
    1262                 return TRUE;
    12631265        if (size > es->buffer_limit) {
    12641266                EDIT_NOTIFY_PARENT(hwnd, EN_MAXTEXT);
    12651267                return FALSE;
    12661268        }
     1269        if (size <= es->buffer_size)
     1270                return TRUE;
    12671271        size = ((size / GROWLENGTH) + 1) * GROWLENGTH;
    12681272        if (size > es->buffer_limit)
     
    22222226        nyoff = MAX(0, es->y_offset + dy);
    22232227
    2224         //SvL: If nyoff > nr lines in control -> last line in control
     2228        //SvL: If nyoff > nr lines in control -> last line in control
    22252229        //     window should show last line of control
    22262230        //     Wine code shows last line at the top of the control
    22272231        //     (Quake 3 startup edit control shows the problem)
    22282232        if (nyoff >= es->line_count) {
    2229                 if(es->line_count <= vlc) {
    2230                         nyoff = es->y_offset;   //no need to scroll
    2231                 }
    2232                 else    nyoff = es->line_count - vlc - 1;
     2233                if(es->line_count <= vlc) {
     2234                        nyoff = es->y_offset;   //no need to scroll
     2235                }
     2236                else    nyoff = es->line_count - vlc - 1;
    22332237        }
    22342238        dy = (es->y_offset - nyoff) * es->line_height;
     
    40394043             while processing WM_SETTEXT */
    40404044          EDIT_NOTIFY_PARENT(hwnd, EN_CHANGE);
    4041           es->flags &= EF_UPDATE;
     4045          es->flags &= ~EF_UPDATE;
    40424046        }
    40434047}
  • trunk/src/user32/listbox.cpp

    r3144 r3153  
    1 /* $Id: listbox.cpp,v 1.23 2000-03-17 17:12:07 cbratschi Exp $ */
     1/* $Id: listbox.cpp,v 1.24 2000-03-18 16:13:30 cbratschi Exp $ */
    22/*
    33 * Listbox controls
     
    66 * Copyright 1999 Christoph Bratschi (ported from WINE)
    77 *
    8  * Corel version: 20000212
    9  * WINE version: 991212
     8 * Corel version: 20000317
     9 * (WINE version: 991212)
    1010 *
    1111 * Status: ???
     
    2626#include "dbglocal.h"
    2727
    28 /* Unimplemented yet:
     28/* bugs:
    2929 - LBS_NOSEL
    3030 - LBS_USETABSTOPS
     
    3434 - VK_LINEDOWN -> bottom most item not always visible
    3535 - performance not optimized
     36 - ownerdraw is broken -> toolbar customize dialog
     37 - first item selection mark not redrawn on new selection
    3638 */
    3739
     
    340342    descr->width  = rect.right - rect.left;
    341343    descr->height = rect.bottom - rect.top;
    342     if (!(descr->style & LBS_NOINTEGRALHEIGHT) && !IS_OWNERDRAW(descr))
     344    if (!(descr->style & LBS_NOINTEGRALHEIGHT) && !(descr->style & LBS_OWNERDRAWVARIABLE))
    343345    {
    344346        if ((descr->height > descr->item_height) &&
     
    480482    {
    481483        DRAWITEMSTRUCT dis;
    482         UINT             id = (descr->lphc) ? ID_CB_LISTBOX : GetWindowLongA(hwnd,GWL_ID);
     484        UINT           id = (descr->lphc) ? ID_CB_LISTBOX : GetWindowLongA(hwnd,GWL_ID);
    483485
    484486        if (!item)
     
    879881    INT i, col_pos = descr->page_size - 1;
    880882    RECT rect;
     883    RECT focusRect = {-1, -1, -1, -1};
    881884    HFONT oldFont = 0;
    882885    HBRUSH hbrush, oldBrush = 0;
    883886    DWORD dwStyle = GetWindowLongA(hwnd,GWL_STYLE);
     887    INT focusItem;
    884888
    885889    SetRect( &rect, 0, 0, descr->width, descr->height );
     
    910914    }
    911915
     916    /* Paint all the item, regarding the selection
     917       Focus state will be painted after  */
     918    focusItem = descr->focus_item;
     919    descr->focus_item = -1;
     920
    912921    for (i = descr->top_item; i < descr->nb_items; i++)
    913922    {
     
    917926            rect.bottom = rect.top + descr->items[i].height;
    918927
     928        if (i == focusItem)
     929        {
     930            /* keep the focus rect, to paint the focus item after */
     931            focusRect.left = rect.left;
     932            focusRect.right = rect.right;
     933            focusRect.top = rect.top;
     934            focusRect.bottom = rect.bottom;
     935        }
    919936        LISTBOX_DrawItem( hwnd, descr, hdc, &rect, i, ODA_DRAWENTIRE );
    920937        rect.top = rect.bottom;
     
    946963        }
    947964    }
     965
     966    /* Paint the focus item now */
     967    descr->focus_item = focusItem;
     968    if (focusRect.top != focusRect.bottom)
     969        LISTBOX_DrawItem( hwnd, descr, hdc, &focusRect, descr->focus_item, ODA_FOCUS );
    948970
    949971    if (!IS_OWNERDRAW(descr))
     
    12851307                               BOOL fully_visible )
    12861308{
    1287     LISTBOX_SetCaretIndex( hwnd, descr, index, fully_visible );
     1309    INT oldfocus = descr->focus_item;
     1310
     1311    if ((index <  0) || (index >= descr->nb_items) || (oldfocus == index))
     1312        return;
     1313
     1314    /* Important, repaint need ot be done in this order if
     1315       you want to mimic Windows behavior:
     1316       1. Remove the focus and paint the item
     1317       2. Remove the selection and paint the item(s)
     1318       3. Set the selection and repaint the item(s)
     1319       4. Set the focus to 'index' and repaint the item */
     1320
     1321    /* 1. remove the focus and repaint the item */
     1322    descr->focus_item = -1;
     1323    if ((oldfocus != -1) && descr->caret_on && (descr->in_focus))
     1324        LISTBOX_RepaintItem( hwnd, descr, oldfocus, ODA_FOCUS );
     1325
     1326    /* 2. then turn off the previous selection */
     1327    /* 3. repaint the new selected item */
    12881328    if (descr->style & LBS_EXTENDEDSEL)
    12891329    {
    12901330        if (descr->anchor_item != -1)
    12911331        {
    1292             INT first = MIN( descr->focus_item, descr->anchor_item );
    1293             INT last  = MAX( descr->focus_item, descr->anchor_item );
     1332            INT first = MIN( index, descr->anchor_item );
     1333            INT last  = MAX( index, descr->anchor_item );
    12941334            if (first > 0)
    12951335                LISTBOX_SelectItemRange( hwnd, descr, 0, first - 1, FALSE );
     
    13031343        LISTBOX_SetSelection( hwnd, descr, index, TRUE, FALSE );
    13041344    }
     1345
     1346    /* 4. repaint the new item with the focus */
     1347    descr->focus_item = index;
     1348    LISTBOX_MakeItemVisible( hwnd, descr, index, fully_visible );
     1349    if (descr->caret_on && (descr->in_focus))
     1350        LISTBOX_RepaintItem( hwnd, descr, index, ODA_FOCUS );
    13051351}
    13061352
  • trunk/src/user32/menu.cpp

    r2852 r3153  
    1 /* $Id: menu.cpp,v 1.18 2000-02-21 17:25:28 cbratschi Exp $*/
     1/* $Id: menu.cpp,v 1.19 2000-03-18 16:13:34 cbratschi Exp $*/
    22/*
    33 * Menu functions
     
    99 * Copyright 1999 Christoph Bratschi
    1010 *
    11  * Corel version: 20000212
    12  * WINE version: 20000130
     11 * Corel version: 20000317
     12 * (WINE version: 20000130)
    1313 *
    1414 * Status:  ???
     
    614614
    615615    if (((*hmenu)==0xffff) || (!(menu = MENU_GetMenu(*hmenu)))) return NULL;
     616    if (!menu) return NULL;
    616617    if (wFlags & MF_BYPOSITION)
    617618    {
     
    16301631        SetWindowPos( menu->hWnd, HWND_TOP, 0, 0, 0, 0,
    16311632                        SWP_SHOWWINDOW | SWP_NOSIZE | SWP_NOMOVE | SWP_NOACTIVATE );
     1633        EnableWindow(menu->hWnd,TRUE);
    16321634        UpdateWindow( menu->hWnd );
    16331635        return TRUE;
     
    23702372       MENUITEM *item;
    23712373
    2372             MENU_SwitchTracking( pmt, hPtMenu, id );
     2374            MENU_SwitchTracking( pmt, hPtMenu, id );
    23732375
    23742376
     
    23762378          Test to see if we are trying to popup a submenu or not.
    23772379          If we aren't, don't change the current menu pointer
    2378           and return.
     2380          and return.
    23792381       */
    23802382       if (!(menu = (POPUPMENU *)MENU_GetMenu( hPtMenu )))
    23812383       {
    23822384          pmt->hCurrentMenu = hPtMenu;
    2383           return TRUE;
     2385          return TRUE;
    23842386       }
    23852387
     
    23882390       {
    23892391          pmt->hCurrentMenu = hPtMenu;
    2390           return TRUE;
     2392          return TRUE;
    23912393       }
    23922394
     
    23962398       {
    23972399          pmt->hCurrentMenu =  hPtMenu;
    2398           return TRUE;
     2400          return TRUE;
    23992401       }
    24002402
    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.
     2403       /* Check to see if we are trying to popup a toplevel menu or a
     2404          submenu.  Only the submenu has a delay.
    24082405       */
    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)
     2406       if (uSubPWndLevel)
    24112407       {
    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);
     2408         /*
     2409           If we made it here, we want to pop up a submenu.  Before we pop it up,
     2410           we want a slight delay.  This is implemented by remembering the ID of the menu
     2411           where the mouse is currently positioned, and setting up a timer.  When the
     2412           timer fires (handled in MENU_TrackMenu() ), if the mouse is over the same
     2413           submenu item, we popup it up.  Otherwise, we do nothing.
     2414         */
     2415         KillTimer (pmt->hOwnerWnd, SUBMENU_POPUP_TIMERID); /* Just in case another timer was set up and not fired yet... */
     2416         if ( (SetTimer (pmt->hOwnerWnd, SUBMENU_POPUP_TIMERID, POPUP_MENU_DELAY, NULL)) != SUBMENU_POPUP_TIMERID)
     2417         {
     2418            /*
     2419              For some reason the timer wasn't set up properly... Revert to old
     2420              functionality.
     2421            */
     2422            pmt->hCurrentMenu = MENU_ShowSubPopup(pmt->hOwnerWnd,hPtMenu,FALSE,wFlags,&pmt->pt);
     2423            return TRUE;
     2424         }
     2425       } else
     2426       {
     2427         /* We are trying to popup a top level menu... so no delay */
     2428
     2429          pmt->hCurrentMenu = MENU_ShowSubPopup(pmt->hOwnerWnd, hPtMenu, FALSE, wFlags,&pmt->pt);
    24182430          return TRUE;
    2419     }
     2431       }
    24202432
    24212433       mouseOverMenuID = id;
     
    26952707    MTRACKER mt;
    26962708    BOOL enterIdleSent = FALSE;
     2709    BOOL bSysMenu;
    26972710
    26982711    mt.trackFlags = 0;
     
    27092722    fEndMenu = FALSE;
    27102723    if (!(menu = MENU_GetMenu(hmenu))) return FALSE;
     2724
     2725    bSysMenu = IS_SYSTEM_MENU(menu);
    27112726
    27122727    if (wFlags & TPM_BUTTONDOWN)
     
    27542769                case WM_RBUTTONDOWN:
    27552770                    if (!(wFlags & TPM_RIGHTBUTTON)) break;
    2756                     /* fall through */
     2771                    goto buttondown;
    27572772                case WM_LBUTTONDBLCLK:
     2773                    if (bSysMenu && (hmenu == mt.hTopMenu))
     2774                    {
     2775                        fEndMenu = TRUE;
     2776                        break;
     2777                    }
     2778                    /* fall through */
    27582779                case WM_LBUTTONDOWN:
    27592780                    /* If the message belongs to the menu, removes it from the queue */
    27602781                    /* Else, end menu tracking */
     2782
     2783                 buttondown:
     2784                    /* Forcing mouse popup NOW - Ensure timer doesn't popup menu also */
     2785                    mouseOverMenuID = -1;
    27612786                    fRemove = MENU_ButtonDown( &mt, hmenu, wFlags );
    27622787                    fEndMenu = !fRemove;
     
    27702795                    if (hmenu)
    27712796                    {
     2797                        /* Forcing mouse popup NOW - Ensure timer doesn't popup menu also */
     2798                        mouseOverMenuID = -1;
    27722799                        executedMenuId = MENU_ButtonUp( &mt, hmenu, wFlags);
    27732800
     
    27912818            } /* switch(msg.message) - mouse */
    27922819        }
    2793         else if (msg.message == WM_TIMER)
    2794         {
    2795            UINT id = -1;
     2820        else if (msg.message == WM_TIMER)
     2821        {
     2822           UINT id = -1;
    27962823           POPUPMENU *ptmenu = NULL;
    27972824
    27982825           if (isTimerSet)
    2799            {
     2826           {
    28002827              /*
    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 )
     2828                If we get here, an attempt was made to pop up a submenu.
     2829                (See MENU_MouseMove() )
     2830              */
     2831
     2832              /* Get the ID of the menu item the mouse is over now. */
     2833              if( hmenu )
    28072834              {
    28082835                 ptmenu = (POPUPMENU *)MENU_GetMenu( hmenu );
     
    28112838                 else
    28122839                   MENU_FindItemByCoords( ptmenu, mt.pt, &id );
     2840
     2841                 /* If it is over the same item that set up the timer originally .... */
     2842                 if (mouseOverMenuID != -1 && mouseOverMenuID == id)
     2843                 {
     2844                   /* .... Pop up the menu */
     2845                   mt.hCurrentMenu = MENU_ShowSubPopup(mt.hOwnerWnd, hmenu, FALSE, wFlags,&mt.pt);
     2846                  }
    28132847              }
    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         }
     2848
     2849              /* Reset the timer so it doesn't fire again. (So we are ready for the next
     2850                 attempt to popup a submenu... ) */
     2851              KillTimer(mt.hOwnerWnd,SUBMENU_POPUP_TIMERID);
     2852              isTimerSet = FALSE;
     2853           }
     2854        }
    28292855        else if ((msg.message >= WM_KEYFIRST) && (msg.message <= WM_KEYLAST))
    28302856        {
     
    28662892                    break;
    28672893
    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                     }
     2894                case VK_F1:
     2895                    {
     2896                        HELPINFO hi;
     2897                        hi.cbSize = sizeof(HELPINFO);
     2898                        hi.iContextType = HELPINFO_MENUITEM;
     2899                        if (menu->FocusedItem == NO_SELECTED_ITEM)
     2900                            hi.iCtrlId = 0;
     2901                        else
     2902                            hi.iCtrlId = menu->items[menu->FocusedItem].wID;
     2903                        hi.hItemHandle = hmenu;
     2904                        hi.dwContextId = menu->dwContextHelpID;
     2905                        hi.MousePos = msg.pt;
     2906                        //TRACE_(winhelp)("Sending HELPINFO_MENUITEM to 0x%08x\n", hwnd);
     2907                        SendMessageA(hwnd, WM_HELP, 0, (LPARAM)&hi);
     2908                        break;
     2909                    }
    28842910
    28852911                default:
     
    29292955            }  /* switch(msg.message) - kbd */
    29302956        }
     2957        else if (msg.message == WM_SYSCOMMAND)
     2958        {
     2959                /* The user clicked on the system menu/button */
     2960        fEndMenu = TRUE;
     2961        break;
     2962        }
    29312963        else
    29322964        {
  • trunk/src/user32/msgbox.c

    r2804 r3153  
    1 /* $Id: msgbox.c,v 1.2 2000-02-16 14:34:24 sandervl Exp $ */
     1/* $Id: msgbox.c,v 1.3 2000-03-18 16:13:37 cbratschi Exp $ */
    22/*
    33 * Message boxes (based on Wine code)
     
    55 * Copyright 1995 Bernd Schmidt
    66 *
     7 * Corel WINE version: 20000317
    78 *
    89 */
     
    1415#include <heapstring.h>
    1516
    16 #define DBG_LOCALLOG    DBG_msgbox
     17#define DBG_LOCALLOG    DBG_msgbox
    1718#include "dbglocal.h"
    1819
     
    3132    LPCSTR lpszText;
    3233    char buf[256];
    33 
    34 ////    if (TWEAK_WineLook >= WIN95_LOOK) {
    35         NONCLIENTMETRICSA nclm;
    36 ////    INT i;
    37         nclm.cbSize = sizeof(NONCLIENTMETRICSA);
    38         SystemParametersInfoA (SPI_GETNONCLIENTMETRICS, 0, &nclm, 0);
    39         hFont = CreateFontIndirectA (&nclm.lfMessageFont);
    40         /* set button font */
    41         for (i=1; i < 8; i++)
    42             SendDlgItemMessageA (hwnd, i, WM_SETFONT, (WPARAM)hFont, 0);
    43         /* set text font */
    44         SendDlgItemMessageA (hwnd, MSGBOX_IDTEXT, WM_SETFONT, (WPARAM)hFont, 0);
    45 ////    }
     34    NONCLIENTMETRICSA nclm;
     35    BOOL hasIcon = TRUE;
     36
     37    nclm.cbSize = sizeof(NONCLIENTMETRICSA);
     38    SystemParametersInfoA (SPI_GETNONCLIENTMETRICS, 0, &nclm, 0);
     39    hFont = CreateFontIndirectA (&nclm.lfMessageFont);
     40    /* set button font */
     41    for (i=1; i < 8; i++)
     42        SendDlgItemMessageA (hwnd, i, WM_SETFONT, (WPARAM)hFont, 0);
     43    /* set text font */
     44    SendDlgItemMessageA (hwnd, MSGBOX_IDTEXT, WM_SETFONT, (WPARAM)hFont, 0);
     45
    4646    if (HIWORD(lpmb->lpszCaption)) {
    4747       SetWindowTextA(hwnd, lpmb->lpszCaption);
    4848    } else {
    4949       if (LoadStringA(lpmb->hInstance, LOWORD(lpmb->lpszCaption), buf, sizeof(buf)))
    50           SetWindowTextA(hwnd, buf);
     50          SetWindowTextA(hwnd, buf);
    5151    }
    5252    if (HIWORD(lpmb->lpszText)) {
     
    5555       lpszText = buf;
    5656       if (!LoadStringA(lpmb->hInstance, LOWORD(lpmb->lpszText), buf, sizeof(buf)))
    57           *buf = 0;     /* FIXME ?? */
     57          *buf = 0;     /* FIXME ?? */
    5858    }
    5959    SetWindowTextA(GetDlgItem(hwnd, MSGBOX_IDTEXT), lpszText);
     
    6262    switch(lpmb->dwStyle & MB_TYPEMASK) {
    6363    case MB_OK:
    64         ShowWindow(GetDlgItem(hwnd, IDCANCEL), SW_HIDE);
    65         /* fall through */
     64        ShowWindow(GetDlgItem(hwnd, IDCANCEL), SW_HIDE);
     65        /* fall through */
    6666    case MB_OKCANCEL:
    67         ShowWindow(GetDlgItem(hwnd, IDABORT), SW_HIDE);
    68         ShowWindow(GetDlgItem(hwnd, IDRETRY), SW_HIDE);
    69         ShowWindow(GetDlgItem(hwnd, IDIGNORE), SW_HIDE);
    70         ShowWindow(GetDlgItem(hwnd, IDYES), SW_HIDE);
    71         ShowWindow(GetDlgItem(hwnd, IDNO), SW_HIDE);
    72         break;
     67        ShowWindow(GetDlgItem(hwnd, IDABORT), SW_HIDE);
     68        ShowWindow(GetDlgItem(hwnd, IDRETRY), SW_HIDE);
     69        ShowWindow(GetDlgItem(hwnd, IDIGNORE), SW_HIDE);
     70        ShowWindow(GetDlgItem(hwnd, IDYES), SW_HIDE);
     71        ShowWindow(GetDlgItem(hwnd, IDNO), SW_HIDE);
     72        break;
    7373    case MB_ABORTRETRYIGNORE:
    74         ShowWindow(GetDlgItem(hwnd, IDOK), SW_HIDE);
    75         ShowWindow(GetDlgItem(hwnd, IDCANCEL), SW_HIDE);
    76         ShowWindow(GetDlgItem(hwnd, IDYES), SW_HIDE);
    77         ShowWindow(GetDlgItem(hwnd, IDNO), SW_HIDE);
    78         break;
     74        ShowWindow(GetDlgItem(hwnd, IDOK), SW_HIDE);
     75        ShowWindow(GetDlgItem(hwnd, IDCANCEL), SW_HIDE);
     76        ShowWindow(GetDlgItem(hwnd, IDYES), SW_HIDE);
     77        ShowWindow(GetDlgItem(hwnd, IDNO), SW_HIDE);
     78        break;
    7979    case MB_YESNO:
    80         ShowWindow(GetDlgItem(hwnd, IDCANCEL), SW_HIDE);
    81         /* fall through */
     80        ShowWindow(GetDlgItem(hwnd, IDCANCEL), SW_HIDE);
     81        /* fall through */
    8282    case MB_YESNOCANCEL:
    83         ShowWindow(GetDlgItem(hwnd, IDOK), SW_HIDE);
    84         ShowWindow(GetDlgItem(hwnd, IDABORT), SW_HIDE);
    85         ShowWindow(GetDlgItem(hwnd, IDRETRY), SW_HIDE);
    86         ShowWindow(GetDlgItem(hwnd, IDIGNORE), SW_HIDE);
    87         break;
     83        ShowWindow(GetDlgItem(hwnd, IDOK), SW_HIDE);
     84        ShowWindow(GetDlgItem(hwnd, IDABORT), SW_HIDE);
     85        ShowWindow(GetDlgItem(hwnd, IDRETRY), SW_HIDE);
     86        ShowWindow(GetDlgItem(hwnd, IDIGNORE), SW_HIDE);
     87        break;
    8888    case MB_RETRYCANCEL:
    89         ShowWindow(GetDlgItem(hwnd, IDOK), SW_HIDE);
    90         ShowWindow(GetDlgItem(hwnd, IDABORT), SW_HIDE);
    91         ShowWindow(GetDlgItem(hwnd, IDIGNORE), SW_HIDE);
    92         ShowWindow(GetDlgItem(hwnd, IDYES), SW_HIDE);
    93         ShowWindow(GetDlgItem(hwnd, IDNO), SW_HIDE);
    94         break;
     89        ShowWindow(GetDlgItem(hwnd, IDOK), SW_HIDE);
     90        ShowWindow(GetDlgItem(hwnd, IDABORT), SW_HIDE);
     91        ShowWindow(GetDlgItem(hwnd, IDIGNORE), SW_HIDE);
     92        ShowWindow(GetDlgItem(hwnd, IDYES), SW_HIDE);
     93        ShowWindow(GetDlgItem(hwnd, IDNO), SW_HIDE);
     94        break;
    9595    }
    9696    /* Set the icon */
    9797    switch(lpmb->dwStyle & MB_ICONMASK) {
    9898    case MB_ICONEXCLAMATION:
    99         SendDlgItemMessageA(hwnd, stc1, STM_SETICON,
    100                            (WPARAM)LoadIconA(0, IDI_EXCLAMATIONA), 0);
    101         break;
     99        SendDlgItemMessageA(hwnd, stc1, STM_SETICON,
     100                           (WPARAM)LoadIconA(0, IDI_EXCLAMATIONA), 0);
     101        break;
    102102    case MB_ICONQUESTION:
    103         SendDlgItemMessageA(hwnd, stc1, STM_SETICON,
    104                              (WPARAM)LoadIconA(0, IDI_QUESTIONA), 0);
    105         break;
     103        SendDlgItemMessageA(hwnd, stc1, STM_SETICON,
     104                             (WPARAM)LoadIconA(0, IDI_QUESTIONA), 0);
     105        break;
    106106    case MB_ICONASTERISK:
    107         SendDlgItemMessageA(hwnd, stc1, STM_SETICON,
    108                              (WPARAM)LoadIconA(0, IDI_ASTERISKA), 0);
    109         break;
     107        SendDlgItemMessageA(hwnd, stc1, STM_SETICON,
     108                             (WPARAM)LoadIconA(0, IDI_ASTERISKA), 0);
     109        break;
    110110    case MB_ICONHAND:
     111        SendDlgItemMessageA(hwnd, stc1, STM_SETICON,
     112                             (WPARAM)LoadIconA(0, IDI_HANDA), 0);
     113        break;
    111114    default:
    112         SendDlgItemMessageA(hwnd, stc1, STM_SETICON,
    113                              (WPARAM)LoadIconA(0, IDI_HANDA), 0);
    114         break;
    115     }
    116    
     115      /* By default, Windows 95/98/NT do not associate an icon to message boxes.
     116       * So wine should do the same.
     117       */
     118        hasIcon = FALSE;
     119        ShowWindow(GetDlgItem(hwnd,stc1),SW_HIDE);
     120        break;
     121    }
     122
    117123    /* Position everything */
    118124    GetWindowRect(hwnd, &rect);
     
    122128    borheight -= rect.bottom - rect.top;
    123129    borwidth  -= rect.right - rect.left;
    124    
     130
    125131    /* Get the icon height */
    126     GetWindowRect(GetDlgItem(hwnd, MSGBOX_IDICON), &rect);
    127     MapWindowPoints(0, hwnd, (LPPOINT)&rect, 2);
    128     iheight = rect.bottom - rect.top;
    129     ileft = rect.left;
    130     iwidth = rect.right - ileft;
    131    
     132    if (hasIcon)
     133    {
     134      GetWindowRect(GetDlgItem(hwnd, MSGBOX_IDICON), &rect);
     135      MapWindowPoints(0, hwnd, (LPPOINT)&rect, 2);
     136      iheight = rect.bottom - rect.top;
     137      ileft = rect.left;
     138      iwidth = rect.right - ileft;
     139    } else
     140    {
     141      iheight = 0;
     142      ileft = 0;
     143      iwidth = 0;
     144    }
     145
    132146    hdc = GetDC(hwnd);
    133147    if (hFont)
    134         hPrevFont = SelectObject(hdc, hFont);
    135    
     148        hPrevFont = SelectObject(hdc, hFont);
     149
    136150    /* Get the number of visible buttons and their size */
    137151    bh = bw = 1; /* Minimum button sizes */
    138152    for (buttons = 0, i = 1; i < 8; i++)
    139153    {
    140         hItem = GetDlgItem(hwnd, i);
    141         if (GetWindowLongA(hItem, GWL_STYLE) & WS_VISIBLE)
    142         {
    143             char buttonText[1024];
    144             int w, h;
    145             buttons++;
    146             if (GetWindowTextA(hItem, buttonText, sizeof buttonText))
    147             {
    148                 DrawTextA( hdc, buttonText, -1, &rect, DT_LEFT | DT_EXPANDTABS | DT_CALCRECT);
    149                 h = rect.bottom - rect.top;
    150                 w = rect.right - rect.left;
    151                 if (h > bh) bh = h;
    152                 if (w > bw)  bw = w ;
    153             }
    154         }
     154        hItem = GetDlgItem(hwnd, i);
     155        if (GetWindowLongA(hItem, GWL_STYLE) & WS_VISIBLE)
     156        {
     157            char buttonText[1024];
     158            int w, h;
     159            buttons++;
     160            if (GetWindowTextA(hItem, buttonText, sizeof buttonText))
     161            {
     162                DrawTextA( hdc, buttonText, -1, &rect, DT_LEFT | DT_EXPANDTABS | DT_CALCRECT);
     163                h = rect.bottom - rect.top;
     164                w = rect.right - rect.left;
     165                if (h > bh) bh = h;
     166                if (w > bw)  bw = w ;
     167            }
     168        }
    155169    }
    156170    bw = MAX(bw, bh * 2);
     
    159173    bw = bw * 2;
    160174    bspace = bw/3; /* Space between buttons */
    161    
     175
    162176    /* Get the text size */
    163177    GetClientRect(GetDlgItem(hwnd, MSGBOX_IDTEXT), &rect);
    164178    rect.top = rect.left = rect.bottom = 0;
    165179    DrawTextA( hdc, lpszText, -1, &rect,
    166                DT_LEFT | DT_EXPANDTABS | DT_WORDBREAK | DT_CALCRECT);
     180               DT_LEFT | DT_EXPANDTABS | DT_WORDBREAK | DT_CALCRECT);
    167181    /* Min text width corresponds to space for the buttons */
    168182    tleft = 2 * ileft + iwidth;
    169183    twidth = MAX((bw + bspace) * buttons + bspace - tleft, rect.right);
    170184    theight = rect.bottom;
    171    
     185
    172186    if (hFont)
    173         SelectObject(hdc, hPrevFont);
     187        SelectObject(hdc, hPrevFont);
    174188    ReleaseDC(hItem, hdc);
    175    
     189
    176190    tiheight = 16 + MAX(iheight, theight);
    177191    wwidth  = tleft + twidth + ileft + borwidth;
    178192    wheight = 8 + tiheight + bh + borheight;
    179    
     193
    180194    /* Resize the window */
    181195    SetWindowPos(hwnd, 0, 0, 0, wwidth, wheight,
    182                 SWP_NOMOVE | SWP_NOZORDER | SWP_NOACTIVATE | SWP_NOREDRAW);
    183    
     196                SWP_NOMOVE | SWP_NOZORDER | SWP_NOACTIVATE | SWP_NOREDRAW);
     197
    184198    /* Position the icon */
    185199    SetWindowPos(GetDlgItem(hwnd, MSGBOX_IDICON), 0, ileft, (tiheight - iheight) / 2, 0, 0,
    186                 SWP_NOSIZE | SWP_NOZORDER | SWP_NOACTIVATE | SWP_NOREDRAW);
    187    
     200                SWP_NOSIZE | SWP_NOZORDER | SWP_NOACTIVATE | SWP_NOREDRAW);
     201
    188202    /* Position the text */
    189203    SetWindowPos(GetDlgItem(hwnd, MSGBOX_IDTEXT), 0, tleft, (tiheight - theight) / 2, twidth, theight,
    190                 SWP_NOZORDER | SWP_NOACTIVATE | SWP_NOREDRAW);
    191    
     204                SWP_NOZORDER | SWP_NOACTIVATE | SWP_NOREDRAW);
     205
    192206    /* Position the buttons */
    193207    bpos = (wwidth - (bw + bspace) * buttons + bspace) / 2;
    194208    for (buttons = i = 0; i < 7; i++) {
    195         /* some arithmetic to get the right order for YesNoCancel windows */
    196         hItem = GetDlgItem(hwnd, (i + 5) % 7 + 1);
    197         if (GetWindowLongA(hItem, GWL_STYLE) & WS_VISIBLE) {
    198             if (buttons++ == ((lpmb->dwStyle & MB_DEFMASK) >> 8)) {
    199                 SetFocus(hItem);
    200                 SendMessageA( hItem, BM_SETSTYLE, BS_DEFPUSHBUTTON, TRUE );
    201             }
    202             SetWindowPos(hItem, 0, bpos, tiheight, bw, bh,
    203                         SWP_NOZORDER|SWP_NOACTIVATE|SWP_NOREDRAW);
    204             bpos += bw + bspace;
    205         }
     209        /* some arithmetic to get the right order for YesNoCancel windows */
     210        hItem = GetDlgItem(hwnd, (i + 5) % 7 + 1);
     211        if (GetWindowLongA(hItem, GWL_STYLE) & WS_VISIBLE) {
     212            if (buttons++ == ((lpmb->dwStyle & MB_DEFMASK) >> 8)) {
     213                SetFocus(hItem);
     214                SendMessageA( hItem, BM_SETSTYLE, BS_DEFPUSHBUTTON, TRUE );
     215            }
     216            SetWindowPos(hItem, 0, bpos, tiheight, bw, bh,
     217                        SWP_NOZORDER|SWP_NOACTIVATE|SWP_NOREDRAW);
     218            bpos += bw + bspace;
     219        }
    206220    }
    207221    return hFont;
     
    216230static LRESULT CALLBACK MSGBOX_DlgProc( HWND hwnd, UINT message,
    217231                                        WPARAM wParam, LPARAM lParam )
    218 { 
     232{
    219233  static HFONT hFont;
    220234  switch(message) {
     
    222236    hFont = MSGBOX_OnInit(hwnd, (LPMSGBOXPARAMSA)lParam);
    223237    return 0;
    224    
     238
    225239   case WM_COMMAND:
    226240    switch (wParam)
     
    235249      EndDialog(hwnd, wParam);
    236250      if (hFont)
    237           DeleteObject(hFont);
     251          DeleteObject(hFont);
    238252      break;
    239253    }
     
    287301    LPSTR textA  = HEAP_strdupWtoA( GetProcessHeap(), 0, text );
    288302    INT ret;
    289    
     303
    290304    ret = MessageBoxA( hwnd, textA, titleA, type );
    291305    HeapFree( GetProcessHeap(), 0, titleA );
     
    333347    return DialogBoxIndirectParamA( msgbox->hInstance, lpTemplate,
    334348                                      msgbox->hwndOwner, (DLGPROC)MSGBOX_DlgProc,
    335                                       (LPARAM)msgbox );
     349                                      (LPARAM)msgbox );
    336350}
    337351
     
    341355INT WINAPI MessageBoxIndirectW( LPMSGBOXPARAMSW msgbox )
    342356{
    343     MSGBOXPARAMSA       msgboxa;
     357    MSGBOXPARAMSA       msgboxa;
    344358
    345359    memcpy(&msgboxa,msgbox,sizeof(msgboxa));
    346     if (msgbox->lpszCaption)   
     360    if (msgbox->lpszCaption)
    347361      lstrcpyWtoA((LPSTR)msgboxa.lpszCaption,msgbox->lpszCaption);
    348     if (msgbox->lpszText)       
     362    if (msgbox->lpszText)
    349363      lstrcpyWtoA((LPSTR)msgboxa.lpszText,msgbox->lpszText);
    350364
    351365    return MessageBoxIndirectA(&msgboxa);
     366}
     367
     368/**************************************************************************
     369 *           FatalAppExit32A   (KERNEL32.108)
     370 */
     371void WINAPI FatalAppExitA( UINT action, LPCSTR str )
     372{
     373    //WARN("AppExit\n");
     374    MessageBoxA( 0, str, NULL, MB_SYSTEMMODAL | MB_OK );
     375    ExitProcess(0);
     376}
     377
     378
     379/**************************************************************************
     380 *           FatalAppExit32W   (KERNEL32.109)
     381 */
     382void WINAPI FatalAppExitW( UINT action, LPCWSTR str )
     383{
     384    //WARN("AppExit\n");
     385    MessageBoxW( 0, str, NULL, MB_SYSTEMMODAL | MB_OK );
     386    ExitProcess(0);
    352387}
    353388
  • trunk/src/user32/static.cpp

    r2852 r3153  
    1 /* $Id: static.cpp,v 1.18 2000-02-21 17:25:29 cbratschi Exp $ */
     1/* $Id: static.cpp,v 1.19 2000-03-18 16:13:37 cbratschi Exp $ */
    22/*
    33 * Static control
     
    77 * Copyright  David W. Metcalfe, 1993
    88 *
    9  * Corel version: 20000212
    10  * WINE version: 990923
     9 * Corel version: 20000317
     10 * (WINE version: 990923)
    1111 *
    1212 * Status:  complete
     
    336336
    337337  InvalidateRect(hwnd,NULL,FALSE);
    338   UpdateWindow(hwnd);
    339338
    340339  return TRUE;
     
    726725        if (!(hMemDC = CreateCompatibleDC( hdc ))) return;
    727726
    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         {
     727        GetObjectA(infoPtr->hIcon, sizeof(bm), &bm);
     728        oldbitmap = SelectObject(hMemDC, infoPtr->hIcon);
     729
     730        // Paint the image in center area
     731        if(dwStyle & SS_CENTERIMAGE)
     732        {
    734733            SIZE szbm;
    735734            SIZE szdc;
     
    765764        }
    766765
    767         SelectObject(hMemDC, oldbitmap);
    768         DeleteDC(hMemDC);
     766        SelectObject(hMemDC, oldbitmap);
     767        DeleteDC(hMemDC);
    769768    }
    770769}
  • trunk/src/user32/win32class.cpp

    r2860 r3153  
    1 /* $Id: win32class.cpp,v 1.15 2000-02-22 19:15:20 sandervl Exp $ */
     1/* $Id: win32class.cpp,v 1.16 2000-03-18 16:13:37 cbratschi Exp $ */
    22/*
    33 * Win32 Window Class Managment Code for OS/2
     
    2525#include <win\winproc.h>
    2626
    27 #define DBG_LOCALLOG    DBG_win32class
     27#define DBG_LOCALLOG    DBG_win32class
    2828#include "dbglocal.h"
    2929
     
    6363                AsciiToUnicode(classNameA, classNameW);
    6464        }
    65         classAtom = 0;
    66         //SvL: If a system control has already be registered, use that atom instead
     65        classAtom = 0;
     66        //SvL: If a system control has already be registered, use that atom instead
    6767        //     of creating a new one
    68         if(wndclass->style & CS_GLOBALCLASS) {
    69                 classAtom = GlobalFindAtomA(classNameA);
    70         }
    71         if(!classAtom) classAtom = GlobalAddAtomA(classNameA);
     68        if(wndclass->style & CS_GLOBALCLASS) {
     69                classAtom = GlobalFindAtomA(classNameA);
     70        }
     71        if(!classAtom) classAtom = GlobalAddAtomA(classNameA);
    7272  }
    7373  else {
     
    7777  }
    7878  if(!(wndclass->style & CS_GLOBALCLASS)) {
    79         processId = GetCurrentProcess();
     79        processId = GetCurrentProcess();
    8080  }
    8181  menuNameA = 0;
     
    100100  }
    101101  else dprintf(("USER32:  wndclass->lpszMenuName %X\n", menuNameA));
     102  dprintf(("USER32:  wndclass->hIconSm %X\n", wndclass->hIconSm));
    102103
    103104  nrExtraClassWords     = wndclass->cbClsExtra;
     
    362363        case GCL_HICON:
    363364                return hIcon;
     365        case GCL_HICONSM:
     366                return hIconSm;
    364367        case GCL_HMODULE:
    365368                return hInstance;
     
    428431                hIcon = lNewVal;
    429432                break;
     433        case GCL_HICONSM:
     434                rc = hIconSm;
     435                hIconSm = lNewVal;
     436                break;
    430437        case GCL_HMODULE:
    431438                rc = hInstance;
  • trunk/src/user32/win32class.h

    r2834 r3153  
    1 /* $Id: win32class.h,v 1.10 2000-02-20 18:28:34 cbratschi Exp $ */
     1/* $Id: win32class.h,v 1.11 2000-03-18 16:13:38 cbratschi Exp $ */
    22/*
    33 * Win32 Window Class Managment Code for OS/2
     
    4545
    4646         HICON  getIcon()               { return hIcon; };
     47         HICON  getIconSm()             { return hIconSm; };
    4748        HCURSOR getCursor()             { return hCursor; };
    4849
     
    8788 PCHAR          classNameA;
    8889 WCHAR         *classNameW;
    89  HICON          hIconSm;
     90 HICON          hIconSm;                //GCW_HICONSM
    9091 HDC            hdcClass;
    9192
  • trunk/src/user32/win32wbase.cpp

    r3144 r3153  
    1 /* $Id: win32wbase.cpp,v 1.173 2000-03-17 17:12:08 cbratschi Exp $ */
     1/* $Id: win32wbase.cpp,v 1.174 2000-03-18 16:13:38 cbratschi Exp $ */
    22/*
    33 * Win32 Window Base Class for OS/2
     
    253253                    return FALSE;
    254254            }
     255            /* Windows does this for overlapped windows
     256             * (I don't know about other styles.) */
     257            if (cs->hwndParent == GetDesktopWindow() && (!(cs->style & WS_CHILD) || (cs->style & WS_POPUP)))
     258            {
     259                    cs->hwndParent = 0;
     260            }
    255261    }
    256262    else
     
    927933    if(fClick)
    928934    {
    929      HWND hwndTop;
     935      HWND hwndTop;
    930936
    931937        /* Activate the window if needed */
     
    945951                   && (hwndTop != GetForegroundWindow()) )
    946952                {
     953                    Win32BaseWindow *win32top = Win32BaseWindow::GetWindowFromHandle(hwndTop);
     954
    947955                    //SvL: Calling OSLibSetActiveWindow(hwndTop); causes focus problems
    948                     OSLibWinSetFocus(getOS2FrameWindowHandle());
     956                    if (win32top) OSLibWinSetFocus(win32top->getOS2FrameWindowHandle());
    949957                }
    950958        }
     
    16591667        {
    16601668          LRESULT result = 0;
    1661           if (!windowClass) return result;
     1669
    16621670          /* Set the appropriate icon members in the window structure. */
    16631671          if (wParam == ICON_SMALL)
     
    16731681            {
    16741682              hIcon = (HICON)lParam;
    1675               OSLibWinSetIcon(OS2HwndFrame,hIcon);
     1683              if ((dwStyle & WS_CAPTION) == WS_CAPTION)
     1684                OSLibWinSetIcon(OS2HwndFrame,hIcon);
    16761685            }
    16771686          }
     1687          if ((Msg == WM_SETICON) && ((dwStyle & WS_CAPTION) == WS_CAPTION))
     1688            HandleNCPaint((HRGN)1);
     1689
    16781690          return result;
    16791691        }
     
    19501962        window = parentwindow;
    19511963   }
     1964}
     1965//******************************************************************************
     1966// Returns the big or small icon for the window, falling back to the
     1967// class as windows does.
     1968//******************************************************************************
     1969HICON Win32BaseWindow::IconForWindow(WPARAM fType)
     1970{
     1971  HICON hWndIcon;
     1972
     1973  if (fType == ICON_BIG)
     1974  {
     1975    if (hIcon) hWndIcon = hIcon;
     1976    else if (windowClass && windowClass->getIcon()) hWndIcon = windowClass->getIcon();
     1977    else if (!(dwStyle & DS_MODALFRAME))
     1978      hWndIcon = LoadImageA(0,MAKEINTRESOURCEA(OIC_ODINICON),IMAGE_ICON,0,0,LR_DEFAULTCOLOR);
     1979    else hWndIcon = 0;
     1980  } else
     1981  {
     1982    if (hIconSm) hWndIcon = hIconSm;
     1983    else if (hIcon) hWndIcon = hIcon;
     1984    else if (windowClass && windowClass->getIconSm()) hWndIcon = windowClass->getIconSm();
     1985    else if (windowClass && windowClass->getIcon()) hWndIcon = windowClass->getIcon();
     1986    else if (!(dwStyle & DS_MODALFRAME))
     1987      hWndIcon = LoadImageA(0,MAKEINTRESOURCEA(OIC_ODINICON),IMAGE_ICON,0,0,LR_DEFAULTCOLOR);
     1988    else hWndIcon = 0;
     1989  }
     1990
     1991  return hWndIcon;
    19521992}
    19531993//******************************************************************************
     
    27002740                    return value;
    27012741
    2702                 value &= ~(WS_VISIBLE | WS_CHILD);      /* Some bits can't be changed this way (WINE) */
     2742                value &= ~WS_CHILD;      /* Some bits can't be changed this way (WINE) */
    27032743                ss.styleOld = getStyle();
    2704                 ss.styleNew = value | (ss.styleOld & (WS_VISIBLE | WS_CHILD));
     2744                ss.styleNew = value | (ss.styleOld & WS_CHILD);
    27052745                dprintf(("SetWindowLong GWL_STYLE %x old %x new style %x", getWindowHandle(), ss.styleOld, ss.styleNew));
    27062746                SendInternalMessageA(WM_STYLECHANGING,GWL_STYLE,(LPARAM)&ss);
  • trunk/src/user32/win32wbase.h

    r3127 r3153  
    1 /* $Id: win32wbase.h,v 1.89 2000-03-16 19:19:11 sandervl Exp $ */
     1/* $Id: win32wbase.h,v 1.90 2000-03-18 16:13:39 cbratschi Exp $ */
    22/*
    33 * Win32 Window Base Class for OS/2
     
    192192         HMENU  GetSysMenu()                        { return hSysMenu; }
    193193
    194          HICON  GetIcon()                           { return hIcon; }
    195          HICON  GetSmallIcon()                      { return hIconSm; }
     194         HICON  IconForWindow(WPARAM fType);
    196195
    197196         void   SetWindowRegion(HRGN hRegion)       { hWindowRegion = hRegion; };
     
    442441                filler:31;
    443442public:
    444          VOID   setEraseBkgnd (BOOL erase)      { EraseBkgndFlag = erase; }
    445          BOOL   needsEraseBkgnd()               { return EraseBkgndFlag; }
     443         VOID   setEraseBkgnd (BOOL erase)      { EraseBkgndFlag = erase; }
     444         BOOL   needsEraseBkgnd()               { return EraseBkgndFlag; }
    446445};
    447446
  • trunk/src/user32/win32wbasenonclient.cpp

    r2956 r3153  
    1 /* $Id: win32wbasenonclient.cpp,v 1.16 2000-03-01 13:30:06 sandervl Exp $ */
     1/* $Id: win32wbasenonclient.cpp,v 1.17 2000-03-18 16:13:39 cbratschi Exp $ */
    22/*
    33 * Win32 Window Base Class for OS/2 (non-client methods)
     
    490490      {
    491491        /* Check if there is an user icon */
    492         HICON hSysIcon = hIconSm;
    493         if(!hSysIcon) hSysIcon = (HICON) GetClassLongA(Win32Hwnd,GCL_HICONSM);
    494 
    495         /* If there is an icon associated with the window OR              */
    496         /* If there is no hIcon specified and this is not a modal dialog, */
    497         /* there is a system menu icon.                                   */
    498         if((hSysIcon != 0) || (!(dwStyle & DS_MODALFRAME)))
     492        if (IconForWindow(ICON_SMALL))
    499493          rect.left += GetSystemMetrics(SM_CYCAPTION) - 1;
    500494      }
     
    644638  else r = *rect;
    645639
    646   hSysIcon = hIconSm;
    647 
    648   /* if no small icon and no large icon, use class small icon */
    649   if (!hSysIcon && !hIcon)
    650     hSysIcon =  (HICON) GetClassLongA(Win32Hwnd, GCL_HICONSM);
    651 
    652   /* otherwise use the large icon */
    653   if (!hSysIcon) hSysIcon = hIcon;
    654 
    655   /* if all else fails, use the application icon. */
    656   if(!hSysIcon) hSysIcon = (HICON) GetClassLongA(Win32Hwnd, GCL_HICON);
    657 
    658   /* If there is no hIcon specified or this is not a modal dialog, */
    659   /* get the default one.                                          */
    660   if(hSysIcon == 0)
    661     if (!(dwStyle & DS_MODALFRAME))
    662       hSysIcon = LoadImageA(0, MAKEINTRESOURCEA(OIC_ODINICON), IMAGE_ICON, 0, 0, LR_DEFAULTCOLOR);
     640  hSysIcon = IconForWindow(ICON_SMALL);
     641
    663642//CB: todo: add icons (including Odin icon) to user32.rc
    664643  if (hSysIcon)
     
    14061385
    14071386      if (!win32wnd) return 0;
    1408 
    1409       /* Get small icon. */
    1410       HICON hAppIcon = win32wnd->GetSmallIcon();
    1411 
    1412       /* if no small icon and no large icon, use class small icon */
    1413       if (!hAppIcon && !win32wnd->GetIcon())
    1414         hAppIcon = (HICON) GetClassLongA(hwnd, GCL_HICONSM);
    1415 
    1416       /* otherwise use the large icon it */
    1417       if (!hAppIcon) hAppIcon = win32wnd->GetIcon();
    1418 
    1419       /* if all else fails, use the application icon. */
    1420       if(!hAppIcon) hAppIcon = (HICON) GetClassLongA(hwnd, GCL_HICON);
    1421 
    1422       DrawIconEx (hdc, pt.x, pt.y, hAppIcon, GetSystemMetrics(SM_CXSMICON),
     1387       
     1388      DrawIconEx (hdc, pt.x, pt.y, win32wnd->IconForWindow(ICON_SMALL),
     1389                  GetSystemMetrics(SM_CXSMICON),
    14231390                  GetSystemMetrics(SM_CYSMICON), 0, 0, DI_NORMAL);
    14241391    }
  • trunk/src/user32/win32wmdiclient.cpp

    r2852 r3153  
    1 /* $Id: win32wmdiclient.cpp,v 1.25 2000-02-21 17:25:32 cbratschi Exp $ */
     1/* $Id: win32wmdiclient.cpp,v 1.26 2000-03-18 16:13:40 cbratschi Exp $ */
    22/*
    33 * Win32 MDI Client Window Class for OS/2
     
    66 * Copyright 1999      Daniela Engert (dani@ngrt.de)
    77 *
    8  * Parts based on Wine (windows\mdi.c) (990815)
     8 * Parts based on Corel WINE (window\mdi.c: 20000317)
     9 * (Parts based on Wine (windows\mdi.c) (990815))
    910 *
    1011 * Copyright 1994, Bob Amstadt
     
    857858  // In Win 95 look, the system menu is replaced by the child icon
    858859
    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);
     860  /* Find icon */
     861  HICON hIcon = child->IconForWindow(ICON_SMALL);
    871862
    872863  if (hIcon)
  • trunk/src/user32/windlgmsg.cpp

    r2803 r3153  
    1 /* $Id: windlgmsg.cpp,v 1.6 2000-02-16 14:28:25 sandervl Exp $ */
     1/* $Id: windlgmsg.cpp,v 1.7 2000-03-18 16:13:41 cbratschi Exp $ */
    22/*
    33 * Win32 dialog message APIs for OS/2
     
    55 * Copyright 1999 Sander van Leeuwen (OS/2 port & adaption)
    66 *
    7  * Based on Wine code (990815: window\dialog.c)
     7 * Based on Corel WINE code (20000317: window\dialog.c)
     8 * (Based on Wine code (990815: window\dialog.c))
    89 *
    910 * Copyright 1993, 1994, 1996 Alexandre Julliard
     
    2122#include "win32dlg.h"
    2223
    23 #define DBG_LOCALLOG    DBG_windlgmsg
     24#define DBG_LOCALLOG    DBG_windlgmsg
    2425#include "dbglocal.h"
    2526
     
    176177}
    177178/***********************************************************************
     179 *           DIALOG_FindMsgDestination
     180 *
     181 * The messages that IsDialogMessage send may not go to the dialog
     182 * calling IsDialogMessage if that dialog is a child, and it has the
     183 * DS_CONTROL style set.
     184 * We propagate up until we hit a that does not have DS_CONTROL, or
     185 * whose parent is not a dialog.
     186 */
     187static HWND DIALOG_FindMsgDestination( HWND hwndDlg )
     188{
     189    while (GetWindowLongA(hwndDlg, GWL_STYLE) & DS_CONTROL)
     190    {
     191        Win32BaseWindow *pParent;
     192        HWND hParent = GetParent(hwndDlg);
     193        if (!hParent) break;
     194
     195        pParent = Win32BaseWindow::GetWindowFromHandle(hParent);
     196        if (!pParent) break;
     197
     198        if (!pParent->IsDialog())
     199          break;
     200
     201        hwndDlg = hParent;
     202    }
     203
     204    return hwndDlg;
     205}
     206
     207/***********************************************************************
    178208 *           DIALOG_IsDialogMessage
    179209 */
    180 static BOOL DIALOG_IsDialogMessage( HWND hwnd, HWND hwndDlg,
    181                                     UINT message, WPARAM wParam,
    182                                     LPARAM lParam, BOOL *translate,
    183                                     BOOL *dispatch, INT dlgCode )
     210static BOOL DIALOG_IsDialogMessage( HWND hwndDlg, BOOL *translate, BOOL *dispatch, INT dlgCode, LPMSG msg )
    184211{
    185212    *translate = *dispatch = FALSE;
    186213
    187     if (message == WM_PAINT)
     214    if (msg->message == WM_PAINT)
    188215    {
    189216        /* Apparently, we have to handle this one as well */
     
    193220
    194221      /* Only the key messages get special processing */
    195     if ((message != WM_KEYDOWN) &&
    196         (message != WM_SYSCHAR) &&
    197         (message != WM_CHAR))
     222    if ((msg->message != WM_KEYDOWN) &&
     223        (msg->message != WM_SYSCHAR) &&
     224        (msg->message != WM_CHAR))
    198225        return FALSE;
    199226
     
    204231    }
    205232
    206     switch(message)
     233    hwndDlg = DIALOG_FindMsgDestination(hwndDlg);
     234
     235    switch(msg->message)
    207236    {
    208237    case WM_KEYDOWN:
    209         switch(wParam)
     238        switch(msg->wParam)
    210239        {
    211240        case VK_TAB:
     
    224253            if (!(dlgCode & DLGC_WANTARROWS))
    225254            {
    226                 BOOL fPrevious = (wParam == VK_LEFT || wParam == VK_UP);
     255                BOOL fPrevious = (msg->wParam == VK_LEFT || msg->wParam == VK_UP);
    227256                HWND hwndNext =
    228257                    GetNextDlgGroupItem (hwndDlg, GetFocus(), fPrevious );
     
    252281
    253282                }
    254             }
    255             return TRUE;
     283
     284                return TRUE;
     285            }
    256286        }
    257287        *translate = TRUE;
     
    263293
    264294    case WM_SYSCHAR:
    265         if (DIALOG_IsAccelerator( hwnd, hwndDlg, wParam ))
     295        if (DIALOG_IsAccelerator( msg->hwnd, hwndDlg, msg->wParam ))
    266296        {
    267297            /* don't translate or dispatch */
     
    287317
    288318    dlgCode = SendMessageA( msg->hwnd, WM_GETDLGCODE, 0, (LPARAM)msg);
    289     ret = DIALOG_IsDialogMessage( msg->hwnd, hwndDlg, msg->message,
    290                                   msg->wParam, msg->lParam,
    291                                   &translate, &dispatch, dlgCode );
     319    ret = DIALOG_IsDialogMessage(hwndDlg,&translate,&dispatch,dlgCode,msg);
    292320    if (translate) TranslateMessage( msg );
    293321    if (dispatch) DispatchMessageA( msg );
     
    306334
    307335    dlgCode = SendMessageW( msg->hwnd, WM_GETDLGCODE, 0, (LPARAM)msg);
    308     ret = DIALOG_IsDialogMessage( msg->hwnd, hwndDlg, msg->message,
    309                                   msg->wParam, msg->lParam,
    310                                   &translate, &dispatch, dlgCode );
     336    ret = DIALOG_IsDialogMessage(hwndDlg,&translate,&dispatch,dlgCode,msg);
    311337    if (translate) TranslateMessage( msg );
    312338    if (dispatch) DispatchMessageW( msg );
Note: See TracChangeset for help on using the changeset viewer.