home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 11 Util / 11-Util.zip / CFGED1B.ZIP / PMVIEWS.ZIP / DIALOG.H < prev    next >
C/C++ Source or Header  |  1992-08-29  |  5KB  |  136 lines

  1. // this might look like 'C', but it's really  -*-c++-*-
  2. /* dialog.h
  3.  *
  4.  * Klssendeklaration der Dialog-Window-Klassen
  5.  *
  6.  * Die Klassen ermoeglichen die einfachere Handhabung
  7.  * von PM-Dialogboxen und -Controls fuer eine
  8.  * eine PM Applikation
  9.  *
  10.  * Language        : C++
  11.  * Operating System: OS/2 V2.0 and higher
  12.  * Compiler        : GNU GCC V2.1 and higher
  13.  *
  14.  *
  15.  * $Id: dialog.h,v 1.3 1992/08/29 18:16:07 gruen Exp $
  16.  * $Log: dialog.h,v $
  17.  * Revision 1.3  1992/08/29  18:16:07  gruen
  18.  * Version as used by cfged 1.0 beta. Applied some additional callbacks and
  19.  * fixed bugs.
  20.  *
  21.  * Revision 1.2  1992/08/09  22:18:38  gruen
  22.  * corrected some bugs, changed the contsructors for the dialog windows, appended
  23.  * some methods.
  24.  *
  25.  * Revision 1.1  1992/07/19  02:01:13  gruen
  26.  * Initial revision
  27.  *
  28.  *
  29.  * Copyright (c) 1992 Lutz Grueneberg
  30.  *
  31.  * This library is free software; you can redistribute it and/or modify
  32.  * it under the terms of the GNU Library General Public License as
  33.  * published by the Free Software Foundation; either version 2 of the
  34.  * License, or (at your option) any later version.  This library is
  35.  * distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
  36.  * without even the implied warranty of MERCHANTABILITY or FITNESS FOR
  37.  * A PARTICULAR PURPOSE.  See the GNU Library General Public License for
  38.  * more details. You should have received a copy of the GNU Library
  39.  * General Public License along with this library; if not, write to the
  40.  * Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
  41.  */
  42.  
  43. /* the master file needs to define INCL_WIN and must include os2.h */
  44. /*
  45.  * The main goals of the Dialog class are:
  46.  * o Relieve the programmer of writing a WindowProc (Callback).
  47.  *   Instead subclassing with virtual methods is used.
  48.  * o Supply a calm, secure interface to the programmer.
  49.  * 
  50.  * The dialog class should be used in conjunction with a 
  51.  * Dialog-Box Editor (i.e. dlgbox).
  52.  * 
  53.  * Wie arbeitet die Klasse?
  54.  * Zu Beginn einer Session wird für jede, i.d.R. mit dem
  55.  * Dialogbox-Editor erstellte, Dialogbox ein Objekt vom Typ
  56.  * Dialog erzeugt. Dabei werden dem Konstruktor die Adresse
  57.  * des Owner-Windows Objekts (Klasse StdWindow) sowie die
  58.  * Resource-ID des Dialogs übergeben. Diese Informationen
  59.  * werden im Objekt (einer Instanz der Klasse Dialog) verankert.
  60.  * Danach werden der Klasse die Dialog-Elemente, auf die
  61.  * eine Reaktion erfolgen soll, die vom Standard abweicht,
  62.  * uebergeben. Dies erfolgt mit der Methode Dialog::Add.
  63.  *
  64.  * Wenn nun der Dialog zur Anzeige gebracht werden soll, 
  65.  * wird die Methode Dialog::Create benutzt. Diese Methode
  66.  * fragt erzeugt den Dialog.
  67.  *
  68.  * class MyDialog : public Dialog {
  69.  * public:
  70.  *   Initialize( HWND hwndDlg) {
  71.  *     StringBox.SetText( "Hallo");
  72.  *   }
  73.  */
  74.  
  75. #ifndef DIALOG_H_INCLUDED
  76. #define DIALOG_H_INCLUDED
  77.  
  78. class Dialog {
  79. private:
  80.   static Dialog  *pDialogList;
  81.   Dialog         *pDialogNext;
  82.   CHAR           szTitle[80];
  83.   USHORT         idRes;
  84.   HWND           hwndParent;
  85.   HWND           hwndOwner;
  86.   HWND           hwndDlg;
  87.   static MRESULT StaticDlgWndProc(HWND hwnd, USHORT msg,
  88.                   MPARAM  mp1, MPARAM  mp2);     
  89.   MRESULT        DlgWndProc(HWND hwnd, USHORT msg,
  90.                 MPARAM  mp1, MPARAM  mp2);
  91.   
  92.  
  93. public:
  94.   Dialog( HWND hwndOwnerNew,            /* Owner Window (hwndClient) */
  95.       USHORT  idResNew,            /* Ressource ID of Dialog    */
  96.       HWND hwndParentNew=HWND_DESKTOP); 
  97.   VOID            create();           /* Erzeugung des Fensters  */
  98.   HWND            load();
  99.   VOID            destroy();          /* Zerstören des Fensters  */
  100.   virtual MRESULT msgInitDlg( HWND hwnd, USHORT msg,
  101.                   MPARAM  mp1, MPARAM  mp2, BOOL *fDoDefault);
  102.   virtual MRESULT msgCommand( HWND hwnd, USHORT msg,
  103.                   MPARAM  mp1, MPARAM  mp2, BOOL *fDoDefault);
  104.   virtual MRESULT msgControl( HWND hwnd, USHORT msg,
  105.                   MPARAM  mp1, MPARAM  mp2, BOOL *fDoDefault);
  106.   virtual MRESULT msgActivate(HWND hwnd, USHORT msg,
  107.                   MPARAM  mp1, MPARAM  mp2, BOOL *fDoDefault);
  108.   virtual MRESULT msgClose(HWND hwnd, USHORT msg,
  109.                MPARAM  mp1, MPARAM  mp2, BOOL *fDoDefault);
  110.   virtual MRESULT msgDestroy(HWND hwnd, USHORT msg,
  111.                  MPARAM  mp1, MPARAM  mp2, BOOL *fDoDefault);
  112.   /* Service methods, query */
  113.   HWND            queryHwnd( VOID) { return hwndDlg;}
  114.   BOOL            querySize( SIZEL *pSize);       /* TRUE signals success */
  115.   BOOL            queryPos( POINTL *pPos);        /* TRUE signals success */
  116.   HWND            queryHwndOwner( VOID);          /* ret. handle to owner */
  117.   /* Service methods, set */
  118.   BOOL            setPos( POINTL *pPos);          /* TRUE signals success */
  119.   BOOL            show( BOOL fShow);              /* TRUE signals success */
  120.   BOOL            enable( BOOL fEnable);          /* TRUE signals success */
  121.   // set the title of the window
  122.   // this method is only usable, if the dialog is displayed
  123.   BOOL            setTitle( CHAR *szNewTitle);    /* Set the dialog title */
  124.  
  125. };
  126. #endif /* DIALOG_H_INCLUDED */
  127.  
  128.  
  129.  
  130.  
  131.  
  132.  
  133.  
  134.  
  135.  
  136.