home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / ocl150a.zip / OCL / Source / OWinDefWindow.cpp < prev    next >
C/C++ Source or Header  |  1996-11-30  |  4KB  |  112 lines

  1. // OCL - OS/2 Class Library
  2. // (c) Cubus 1995
  3. // All Rights Reserved
  4. // OWinDefWindow.cpp
  5.  
  6.  
  7. /*
  8.  * Redistribution and use in source and binary forms, with or without
  9.  * modification, are permitted provided that the following conditions
  10.  * are met:
  11.  * 1. Redistributions of source code must retain the above copyright
  12.  *    notice, this list of conditions and the following disclaimer.
  13.  * 2. Neither the name Cubus nor the name Team OCL may be used to
  14.  *    endorse or promote products derived from this software
  15.  *    without specific prior written permission.
  16.  * 3. See OCL.INF for a detailed copyright notice.
  17.  *
  18.  *              THIS SOFTWARE IS PROVIDED ``AS IS'' AND
  19.  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  20.  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  21.  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
  22.  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  23.  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  24.  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  25.  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  26.  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  27.  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  28.  * SUCH DAMAGE.
  29.  */
  30.  
  31. // $Header: W:/Projects/OCL/Source/rcs/OWinDefWindow.cpp 1.50 1996/08/11 23:49:36 B.STEIN Release $
  32.  
  33. #define __OCL_SOURCE__
  34.  
  35. #define OINCL_OSTRING
  36. #define OINCL_BASE
  37.  
  38. #include <ocl.hpp>
  39. #include <OApp.hpp>
  40. #include <OCommand.hpp>
  41.  
  42.  
  43. // standard window procedure
  44.  
  45. MRESULT __CPP_EXPORT__ EXPENTRY OWinDefWindowProc(HWND   hwnd,
  46.                                                   ULONG  msg,
  47.                                                   MPARAM mp1,
  48.                                                   MPARAM mp2)
  49. {
  50.  switch(msg)
  51.   {
  52.    case WM_CREATE:
  53.      if (!mp1) return(MRESULT(TRUE));
  54.      WinSetWindowULong(hwnd, QWL_USER, (ULONG)mp1);
  55.      if (!OApp::OCMDTrace(hwnd, msg, mp1, mp2))
  56.        return(WinDefWindowProc(hwnd, msg, mp1, mp2));
  57.      break;
  58.  
  59.    case DM_DRAGOVER:
  60.      if (OApp::OCMDTrace(hwnd, msg, mp1, mp2))
  61.        return(MPFROM2SHORT(DOR_DROP, DO_UNKNOWN));
  62.      else
  63.        return(MPFROM2SHORT(DOR_NODROP, DO_UNKNOWN));
  64.  
  65.    case WM_CONTROL:
  66.      if(SHORT2FROMMP(mp1) == CN_DRAGOVER)
  67.       {
  68.        if (OApp::OCMDTrace(hwnd, msg, mp1, mp2))
  69.          return(MPFROM2SHORT(DOR_DROP, DO_UNKNOWN));
  70.        else
  71.          return(MPFROM2SHORT(DOR_NODROP, DO_UNKNOWN));
  72.       }
  73.      else if (!OApp::OCMDTrace(hwnd, msg, mp1, mp2))
  74.        return(WinDefWindowProc(hwnd, msg, mp1, mp2));
  75.      break;
  76.  
  77.    case WM_HITTEST:
  78.      if (!OApp::OCMDTrace(hwnd, msg, mp1, mp2))
  79.        return(WinDefWindowProc(hwnd, msg, mp1, mp2));
  80.      else
  81.        return(MPFROMSHORT(HT_NORMAL));
  82.  
  83.    case WM_ERASEBACKGROUND:
  84.      if (!OApp::OCMDTrace(hwnd, msg, mp1, mp2))
  85.        return(MRESULT(TRUE));
  86.      else
  87.        return(WinDefWindowProc(hwnd, msg, mp1, mp2));
  88.  
  89.    case WM_DRAWITEM:
  90.      return(MRESULT(OApp::OCMDTrace(hwnd, msg, mp1, mp2)));
  91.  
  92.    case HM_QUERY_KEYS_HELP:
  93.      return(MRESULT(OApp::OCMDTrace(hwnd, msg, mp1, mp2)));
  94.  
  95.    case WM_CLOSE:
  96.    case WM_DESTROY: {
  97.      BOOL dispatched = OApp::OCMDTrace(hwnd, msg, mp1, mp2);
  98.      WinSetWindowULong(hwnd, QWL_USER, (ULONG)OApp::currentOApp->NullHandler());
  99.      if (!dispatched)
  100.        return(WinDefWindowProc(hwnd, msg, mp1, mp2));
  101.      break; }
  102.  
  103.    default:
  104.      if (!OApp::OCMDTrace(hwnd, msg, mp1, mp2))
  105.        return(WinDefWindowProc(hwnd, msg, mp1, mp2));
  106.      break;
  107.   }
  108.  return(MRESULT(FALSE));
  109. }
  110.  
  111. // end of source
  112.