home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / ocl150a.zip / OCL / Source / OWinDefDlg.cpp < prev    next >
C/C++ Source or Header  |  1996-08-12  |  3KB  |  102 lines

  1. // OCL - OS/2 Class Library
  2. // (c) Cubus 1995
  3. // All Rights Reserved
  4. // OWinDefDlg.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/OWinDefDlg.cpp 1.50 1996/08/11 23:49:35 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 dialog procedure
  44.  
  45. MRESULT __CPP_EXPORT__ EXPENTRY OWinDefDlgProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
  46. {
  47.  switch(msg)
  48.   {
  49.    case WM_INITDLG:
  50.      if (!mp2) return(MRESULT(TRUE));
  51.      WinSetWindowULong(hwnd, QWL_USER, (ULONG)mp2);
  52.      if (!OApp::OCMDTrace(hwnd, msg, mp1, mp2))
  53.        return(WinDefDlgProc(hwnd, msg, mp1, mp2));
  54.      break;
  55.  
  56.    case DM_DRAGOVER:
  57.      if (OApp::OCMDTrace(hwnd, msg, mp1, mp2))
  58.        return(MPFROM2SHORT(DOR_DROP, DO_UNKNOWN));
  59.      else
  60.        return(MPFROM2SHORT(DOR_NODROP, DO_UNKNOWN));
  61.  
  62.    case WM_CONTROL:
  63.      if(SHORT2FROMMP(mp1) == CN_DRAGOVER)
  64.       {
  65.        if (OApp::OCMDTrace(hwnd, msg, mp1, mp2))
  66.          return(MPFROM2SHORT(DOR_DROP, DO_UNKNOWN));
  67.        else
  68.          return(MPFROM2SHORT(DOR_NODROP, DO_UNKNOWN));
  69.       }
  70.      else if (!OApp::OCMDTrace(hwnd, msg, mp1, mp2))
  71.        return(WinDefWindowProc(hwnd, msg, mp1, mp2));
  72.      break;
  73.  
  74.    case WM_HITTEST:
  75.      if (!OApp::OCMDTrace(hwnd, msg, mp1, mp2))
  76.        return(WinDefWindowProc(hwnd, msg, mp1, mp2));
  77.      else
  78.        return(MPFROMSHORT(HT_NORMAL));
  79.  
  80.    case WM_DRAWITEM:
  81.      return(MRESULT(OApp::OCMDTrace(hwnd, msg, mp1, mp2)));
  82.  
  83.    case WM_CLOSE:
  84.    case WM_DESTROY: {
  85.      BOOL dispatched = OApp::OCMDTrace(hwnd, msg, mp1, mp2);
  86.      WinSetWindowULong(hwnd, QWL_USER, (ULONG)OApp::currentOApp->NullHandler());
  87.      if (!dispatched)
  88.        return(WinDefWindowProc(hwnd, msg, mp1, mp2));
  89.      break; }
  90.  
  91.    default:
  92.      if (!OApp::OCMDTrace(hwnd, msg, mp1, mp2))
  93.        return(WinDefDlgProc(hwnd, msg, mp1, mp2));
  94.      break;
  95.   }
  96.  return(MRESULT(FALSE));
  97. }
  98.  
  99.  
  100.  
  101. // end of source
  102.