Ignore:
Timestamp:
Aug 30, 1999, 2:00:12 PM (26 years ago)
Author:
sandervl
Message:

Redesign; base class for all window types

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/user32/new/defwndproc.cpp

    r740 r741  
    1 /* $Id: defwndproc.cpp,v 1.5 1999-08-29 20:05:07 sandervl Exp $ */
     1/* $Id: defwndproc.cpp,v 1.6 1999-08-30 11:59:53 sandervl Exp $ */
    22
    33/*
     
    1414#include "user32.h"
    1515#include "syscolor.h"
     16#include "win32wbase.h"
    1617#include "win32wnd.h"
    1718
     
    2425LRESULT WIN32API DefWindowProcA(HWND hwnd, UINT Msg, WPARAM wParam, LPARAM lParam)
    2526{
     27  Win32BaseWindow *window;
     28
     29    window = Win32BaseWindow::GetWindowFromHandle(hwnd);
     30    if(!window) {
     31        dprintf(("DefWindowProcA, window %x not found", hwnd));
     32        return 0;
     33    }
     34    return window->DefWindowProcA(Msg, wParam, lParam);
     35}
     36//******************************************************************************
     37//******************************************************************************
     38LRESULT WIN32API DefWindowProcW(HWND hwnd, UINT Msg, WPARAM wParam, LPARAM lParam)
     39{
     40  Win32BaseWindow *window;
     41
     42    window = Win32BaseWindow::GetWindowFromHandle(hwnd);
     43    if(!window) {
     44        dprintf(("DefWindowProcW, window %x not found", hwnd));
     45        return 0;
     46    }
     47    return window->DefWindowProcW(Msg, wParam, lParam);
     48}
     49//******************************************************************************
     50//******************************************************************************
     51LRESULT WIN32API DefDlgProcA(HWND hwnd, UINT Msg, WPARAM wParam, LPARAM lParam)
     52{
     53#ifdef DEBUG
     54////    WriteLog("*DDP*");
     55#endif
     56    switch(Msg) {
     57        case WM_SETREDRAW: //Open32 does not set the visible flag
     58                if(wParam)
     59                  SetWindowLongA (hwnd, GWL_STYLE, GetWindowLongA (hwnd, GWL_STYLE) | WS_VISIBLE);
     60                else
     61                  SetWindowLongA (hwnd, GWL_STYLE, GetWindowLongA (hwnd, GWL_STYLE) & ~WS_VISIBLE);
     62                return O32_DefDlgProc(hwnd, Msg, wParam, lParam);
     63        case WM_NCCREATE://SvL: YAOFM (yet another open32 feature missing)
     64                return(TRUE);
     65        case WM_CTLCOLORMSGBOX:
     66        case WM_CTLCOLOREDIT:
     67        case WM_CTLCOLORLISTBOX:
     68        case WM_CTLCOLORBTN:
     69        case WM_CTLCOLORDLG:
     70        case WM_CTLCOLORSTATIC:
     71        case WM_CTLCOLORSCROLLBAR:
     72                SetBkColor((HDC)wParam, GetSysColor(COLOR_WINDOW));
     73                SetTextColor((HDC)wParam, GetSysColor(COLOR_WINDOWTEXT));
     74                return GetSysColorBrush(COLOR_BTNFACE);
     75
     76    case WM_PARENTNOTIFY: //Open32 doesn't like receiving those!!
     77        dprintf(("DefWndProc: WM_PARENTNOTIFY for %x", hwnd));
     78        return 0;
     79
     80        default:
     81                return O32_DefDlgProc(hwnd, Msg, wParam, lParam);
     82    }
     83}
     84//******************************************************************************
     85//NOTE: Unicode msg translation!
     86//******************************************************************************
     87LRESULT WIN32API DefDlgProcW(HWND hwnd, UINT Msg, WPARAM wParam, LPARAM lParam)
     88{
     89#ifdef DEBUG
     90////    WriteLog("*DDPW*");
     91#endif
     92    switch(Msg) {
     93        case WM_SETREDRAW: //Open32 does not set the visible flag
     94                if(wParam)
     95                  SetWindowLongA (hwnd, GWL_STYLE, GetWindowLongA (hwnd, GWL_STYLE) | WS_VISIBLE);
     96                else
     97                  SetWindowLongA (hwnd, GWL_STYLE, GetWindowLongA (hwnd, GWL_STYLE) & ~WS_VISIBLE);
     98                return O32_DefDlgProc(hwnd, Msg, wParam, lParam);
     99        case WM_NCCREATE://SvL: YAOFM (yet another open32 feature missing)
     100                return(TRUE);
     101        case WM_CTLCOLORMSGBOX:
     102        case WM_CTLCOLOREDIT:
     103        case WM_CTLCOLORLISTBOX:
     104        case WM_CTLCOLORBTN:
     105        case WM_CTLCOLORDLG:
     106        case WM_CTLCOLORSTATIC:
     107        case WM_CTLCOLORSCROLLBAR:
     108                SetBkColor((HDC)wParam, GetSysColor(COLOR_WINDOW));
     109                SetTextColor((HDC)wParam, GetSysColor(COLOR_WINDOWTEXT));
     110                return GetSysColorBrush(COLOR_BTNFACE);
     111
     112    case WM_PARENTNOTIFY: //Open32 doesn't like receiving those!!
     113        dprintf(("DefWndProc: WM_PARENTNOTIFY for %x", hwnd));
     114        return 0;
     115
     116        default:
     117                return O32_DefDlgProc(hwnd, Msg, wParam, lParam);
     118    }
     119}
     120//******************************************************************************
     121//******************************************************************************
     122LRESULT WIN32API DefFrameProcA(HWND hwndFrame, HWND hwndMDIClient, UINT Msg, WPARAM wParam, LPARAM lParam)
     123{
    26124  Win32Window *window;
    27125
    28     window = Win32Window::GetWindowFromHandle(hwnd);
    29     if(!window) {
    30         dprintf(("DefWindowProcA, window %x not found", hwnd));
    31         return 0;
    32     }
    33     return window->DefWindowProcA(Msg, wParam, lParam);
    34 }
    35 //******************************************************************************
    36 //******************************************************************************
    37 LRESULT WIN32API DefWindowProcW(HWND hwnd, UINT Msg, WPARAM wParam, LPARAM lParam)
     126    window = (Win32Window *)Win32BaseWindow::GetWindowFromHandle(hwndFrame);
     127    if(!window) {
     128        dprintf(("DefFrameProcA, window %x not found", hwndFrame));
     129        return 0;
     130    }
     131    return window->DefFrameProcA(hwndMDIClient, Msg, wParam, lParam);
     132}
     133//******************************************************************************
     134//******************************************************************************
     135LRESULT WIN32API DefFrameProcW(HWND hwndFrame, HWND hwndMDIClient, UINT Msg, WPARAM wParam, LPARAM lParam)
    38136{
    39137  Win32Window *window;
    40138
    41     window = Win32Window::GetWindowFromHandle(hwnd);
    42     if(!window) {
    43         dprintf(("DefWindowProcW, window %x not found", hwnd));
    44         return 0;
    45     }
    46     return window->DefWindowProcW(Msg, wParam, lParam);
    47 }
    48 //******************************************************************************
    49 //******************************************************************************
    50 LRESULT WIN32API DefDlgProcA(HWND hwnd, UINT Msg, WPARAM wParam, LPARAM lParam)
    51 {
    52 #ifdef DEBUG
    53 ////    WriteLog("*DDP*");
    54 #endif
    55     switch(Msg) {
    56         case WM_SETREDRAW: //Open32 does not set the visible flag
    57                 if(wParam)
    58                   SetWindowLongA (hwnd, GWL_STYLE, GetWindowLongA (hwnd, GWL_STYLE) | WS_VISIBLE);
    59                 else
    60                   SetWindowLongA (hwnd, GWL_STYLE, GetWindowLongA (hwnd, GWL_STYLE) & ~WS_VISIBLE);
    61                 return O32_DefDlgProc(hwnd, Msg, wParam, lParam);
    62         case WM_NCCREATE://SvL: YAOFM (yet another open32 feature missing)
    63                 return(TRUE);
    64         case WM_CTLCOLORMSGBOX:
    65         case WM_CTLCOLOREDIT:
    66         case WM_CTLCOLORLISTBOX:
    67         case WM_CTLCOLORBTN:
    68         case WM_CTLCOLORDLG:
    69         case WM_CTLCOLORSTATIC:
    70         case WM_CTLCOLORSCROLLBAR:
    71                 SetBkColor((HDC)wParam, GetSysColor(COLOR_WINDOW));
    72                 SetTextColor((HDC)wParam, GetSysColor(COLOR_WINDOWTEXT));
    73                 return GetSysColorBrush(COLOR_BTNFACE);
    74 
    75     case WM_PARENTNOTIFY: //Open32 doesn't like receiving those!!
    76         dprintf(("DefWndProc: WM_PARENTNOTIFY for %x", hwnd));
    77         return 0;
    78 
    79         default:
    80                 return O32_DefDlgProc(hwnd, Msg, wParam, lParam);
     139    window = (Win32Window *)Win32BaseWindow::GetWindowFromHandle(hwndFrame);
     140    if(!window) {
     141        dprintf(("DefFrameProcW, window %x not found", hwndFrame));
     142        return 0;
     143    }
     144    return window->DefFrameProcW(hwndMDIClient, Msg, wParam, lParam);
     145}
     146//******************************************************************************
     147//******************************************************************************
     148LRESULT WIN32API DefMDIChildProcA(HWND hwnd, UINT Msg, WPARAM wParam, LPARAM lParam)
     149{
     150#ifdef DEBUG
     151////    WriteLog("*DMP*");
     152#endif
     153    switch(Msg) {
     154        case WM_SETREDRAW: //Open32 does not set the visible flag
     155                if(wParam)
     156                  SetWindowLongA (hwnd, GWL_STYLE, GetWindowLongA (hwnd, GWL_STYLE) | WS_VISIBLE);
     157                else
     158                  SetWindowLongA (hwnd, GWL_STYLE, GetWindowLongA (hwnd, GWL_STYLE) & ~WS_VISIBLE);
     159                return O32_DefMDIChildProc(hwnd, Msg, wParam, lParam);
     160        case WM_NCCREATE://SvL: YAOFM (yet another open32 feature missing)
     161                return(TRUE);
     162        case WM_CTLCOLORMSGBOX:
     163        case WM_CTLCOLOREDIT:
     164        case WM_CTLCOLORLISTBOX:
     165        case WM_CTLCOLORBTN:
     166        case WM_CTLCOLORDLG:
     167        case WM_CTLCOLORSTATIC:
     168        case WM_CTLCOLORSCROLLBAR:
     169                SetBkColor((HDC)wParam, GetSysColor(COLOR_WINDOW));
     170                SetTextColor((HDC)wParam, GetSysColor(COLOR_WINDOWTEXT));
     171                return GetSysColorBrush(COLOR_BTNFACE);
     172
     173    case WM_PARENTNOTIFY: //Open32 doesn't like receiving those!!
     174        dprintf(("DefWndProc: WM_PARENTNOTIFY for %x", hwnd));
     175        return 0;
     176
     177        default:
     178                return O32_DefMDIChildProc(hwnd, Msg, wParam, lParam);
    81179    }
    82180}
     
    84182//NOTE: Unicode msg translation!
    85183//******************************************************************************
    86 LRESULT WIN32API DefDlgProcW(HWND hwnd, UINT Msg, WPARAM wParam, LPARAM lParam)
    87 {
    88 #ifdef DEBUG
    89 ////    WriteLog("*DDPW*");
    90 #endif
    91     switch(Msg) {
    92         case WM_SETREDRAW: //Open32 does not set the visible flag
    93                 if(wParam)
    94                   SetWindowLongA (hwnd, GWL_STYLE, GetWindowLongA (hwnd, GWL_STYLE) | WS_VISIBLE);
    95                 else
    96                   SetWindowLongA (hwnd, GWL_STYLE, GetWindowLongA (hwnd, GWL_STYLE) & ~WS_VISIBLE);
    97                 return O32_DefDlgProc(hwnd, Msg, wParam, lParam);
    98         case WM_NCCREATE://SvL: YAOFM (yet another open32 feature missing)
    99                 return(TRUE);
    100         case WM_CTLCOLORMSGBOX:
    101         case WM_CTLCOLOREDIT:
    102         case WM_CTLCOLORLISTBOX:
    103         case WM_CTLCOLORBTN:
    104         case WM_CTLCOLORDLG:
    105         case WM_CTLCOLORSTATIC:
    106         case WM_CTLCOLORSCROLLBAR:
    107                 SetBkColor((HDC)wParam, GetSysColor(COLOR_WINDOW));
    108                 SetTextColor((HDC)wParam, GetSysColor(COLOR_WINDOWTEXT));
    109                 return GetSysColorBrush(COLOR_BTNFACE);
    110 
    111     case WM_PARENTNOTIFY: //Open32 doesn't like receiving those!!
    112         dprintf(("DefWndProc: WM_PARENTNOTIFY for %x", hwnd));
    113         return 0;
    114 
    115         default:
    116                 return O32_DefDlgProc(hwnd, Msg, wParam, lParam);
    117     }
    118 }
    119 //******************************************************************************
    120 //TODO: Should be handled differently than the normal wnd proc
    121 //******************************************************************************
    122 LRESULT WIN32API DefFrameProcA(HWND hwndFrame, HWND hwndClient, UINT Msg, WPARAM wParam, LPARAM lParam)
    123 {
    124   Win32Window *window;
    125 
    126     window = Win32Window::GetWindowFromHandle(hwndFrame);
    127     if(!window) {
    128         dprintf(("DefFrameProcA, window %x not found", hwndFrame));
    129         return 0;
    130     }
    131     return window->DefWindowProcA(Msg, wParam, lParam);
    132 }
    133 //******************************************************************************
    134 //TODO: Should be handled differently than the normal wnd proc
    135 //******************************************************************************
    136 LRESULT WIN32API DefFrameProcW(HWND hwndFrame, HWND hwndClient, UINT Msg, WPARAM wParam, LPARAM lParam)
    137 {
    138   Win32Window *window;
    139 
    140     window = Win32Window::GetWindowFromHandle(hwndFrame);
    141     if(!window) {
    142         dprintf(("DefFrameProcW, window %x not found", hwndFrame));
    143         return 0;
    144     }
    145     return window->DefWindowProcW(Msg, wParam, lParam);
    146 }
    147 //******************************************************************************
    148 //******************************************************************************
    149 LRESULT WIN32API DefMDIChildProcA(HWND hwnd, UINT Msg, WPARAM wParam, LPARAM lParam)
    150 {
    151 #ifdef DEBUG
    152 ////    WriteLog("*DMP*");
    153 #endif
    154     switch(Msg) {
    155         case WM_SETREDRAW: //Open32 does not set the visible flag
    156                 if(wParam)
    157                   SetWindowLongA (hwnd, GWL_STYLE, GetWindowLongA (hwnd, GWL_STYLE) | WS_VISIBLE);
    158                 else
    159                   SetWindowLongA (hwnd, GWL_STYLE, GetWindowLongA (hwnd, GWL_STYLE) & ~WS_VISIBLE);
    160                 return O32_DefMDIChildProc(hwnd, Msg, wParam, lParam);
    161         case WM_NCCREATE://SvL: YAOFM (yet another open32 feature missing)
    162                 return(TRUE);
    163         case WM_CTLCOLORMSGBOX:
    164         case WM_CTLCOLOREDIT:
    165         case WM_CTLCOLORLISTBOX:
    166         case WM_CTLCOLORBTN:
    167         case WM_CTLCOLORDLG:
    168         case WM_CTLCOLORSTATIC:
    169         case WM_CTLCOLORSCROLLBAR:
    170                 SetBkColor((HDC)wParam, GetSysColor(COLOR_WINDOW));
    171                 SetTextColor((HDC)wParam, GetSysColor(COLOR_WINDOWTEXT));
    172                 return GetSysColorBrush(COLOR_BTNFACE);
    173 
    174     case WM_PARENTNOTIFY: //Open32 doesn't like receiving those!!
    175         dprintf(("DefWndProc: WM_PARENTNOTIFY for %x", hwnd));
    176         return 0;
    177 
    178         default:
    179                 return O32_DefMDIChildProc(hwnd, Msg, wParam, lParam);
    180     }
    181 }
    182 //******************************************************************************
    183 //NOTE: Unicode msg translation!
    184 //******************************************************************************
    185184LRESULT WIN32API DefMDIChildProcW(HWND hwnd, UINT Msg, WPARAM wParam, LPARAM lParam)
    186185{
Note: See TracChangeset for help on using the changeset viewer.