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

  1. // this might look like 'C', but it's really  -*-c++-*-
  2. /* controls.h
  3.  *
  4.  * Klassendeklaration der Control-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: controls.h,v 1.1 1992/07/19 02:01:18 gruen Exp $
  16.  * $Log: controls.h,v $
  17.  * Revision 1.1  1992/07/19  02:01:18  gruen
  18.  * Initial revision
  19.  *
  20.  * Revision 1.2  1992/06/24  23:28:16  gruen
  21.  * changed the constructor from HWND to Dialog*
  22.  *
  23.  * Revision 1.1  1992/06/24  19:51:38  gruen
  24.  * Initial revision
  25.  *
  26.  *
  27.  * Copyright (c) 1992 Lutz Grueneberg
  28.  *
  29.  * This library is free software; you can redistribute it and/or modify
  30.  * it under the terms of the GNU Library General Public License as
  31.  * published by the Free Software Foundation; either version 2 of the
  32.  * License, or (at your option) any later version.  This library is
  33.  * distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
  34.  * without even the implied warranty of MERCHANTABILITY or FITNESS FOR
  35.  * A PARTICULAR PURPOSE.  See the GNU Library General Public License for
  36.  * more details. You should have received a copy of the GNU Library
  37.  * General Public License along with this library; if not, write to the
  38.  * Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
  39.  */
  40.  
  41. /* the master file needs to define INCL_WIN and must include os2.h */
  42. /* 
  43.  * The idea standing behind this library is easy: avoid PM overhead.
  44.  * Following classes are included:
  45.  *  CntrlWindow           base class for PM Control Windows
  46.  *    StaticText          usual text strings in a static control           
  47.  *      EntryField        for easy access to Entry Field Controls
  48.  *    ListBox             Interface to PM List Boxes
  49.  */
  50.  
  51. #ifndef CONTROLS_H_INCLUDED
  52. #define CONTROLS_H_INCLUDED
  53.  
  54.  
  55. class CntrlWindow {
  56. private:
  57.   Dialog      *pOwner;
  58.   USHORT      idRes;
  59. public:
  60.   CntrlWindow(Dialog *pOwnerNew, USHORT idResNew);
  61.  
  62.   HWND   queryHwnd( VOID);               // retrieve hwnd of Dialog
  63.   USHORT queryId( VOID);         // retrieve resource id
  64.   BOOL   show( BOOL fShow);              /* TRUE signals success */
  65.   BOOL   enable( BOOL fEnable);          /* TRUE signals success */
  66.   BOOL   enableUpdate( BOOL fEnable);    /* TRUE signals success */
  67. };
  68.  
  69. class StaticText: public CntrlWindow {
  70.   public:
  71.     StaticText(Dialog* pOwnerNew, USHORT idResNew);
  72.  
  73.     BOOL setText(CHAR* szBuf);                    /* TRUE signals success */
  74.     SHORT queryText(CHAR* szBuf, SHORT sSize);    /* count of chars,      */
  75.                                                   /* zero indicates error */ 
  76.     BOOL setShort( SHORT sVal);                   /* TRUE signals success */
  77.     BOOL queryShort( SHORT *psVal);               /* TRUE signals success */
  78.     BOOL setUShort( USHORT usVal);                /* TRUE signals success */
  79.     BOOL queryUShort( USHORT *pusVal);            /* TRUE signals success */
  80.     
  81.     SHORT queryTextLength(VOID);                  /* returns string length*/
  82. };    
  83.  
  84.  
  85. class EntryField : public StaticText {
  86.   public:
  87.     EntryField(Dialog* pOwnerNew, USHORT idResNew);
  88.     
  89.     BOOL setTextLimit(SHORT sMax);                /* TRUE signals success */
  90. };
  91.  
  92. class ListBox : public CntrlWindow {
  93.   public:
  94.     ListBox(Dialog* pOwnerNew, USHORT idResNew);
  95.     /* basic PM methods */
  96.     BOOL  deleteAll(VOID);             /* TRUE signals success              */
  97.     SHORT deleteItem(SHORT iItem);     /* number of remaining items         */
  98.     SHORT insertItem(SHORT iItem,      /* LIT_MEMERROR,LIT_ERROR ->error    */
  99.              CHAR* pszText);
  100.     SHORT queryItemCount(VOID);        /* returns item count                */
  101.     SHORT queryItemHandle(SHORT iItem);/* handle, zero indicates error      */
  102.     SHORT queryItemText(SHORT iItem,   /* count of transferred characters   */
  103.         CHAR* pszText, SHORT cch); /* without terminating  zero     */
  104.     SHORT queryItemTextLength(SHORT iItem);/* count of characters or zero   */
  105.     SHORT querySelection(SHORT iItemPrev);/* index of sel. item or LIT_NONE */ 
  106.     SHORT queryTopIndex(VOID);         /* index of top item or LIT_NONE     */
  107.     SHORT searchString(USHORT usCmd,   /* index of item or LIT_NONE         */
  108.                SHORT iItem, CHAR* pszSearch);
  109.     BOOL  selectItem(SHORT iItem,      /* TRUE signals success              */
  110.              BOOL fSelect);
  111.     
  112.     BOOL  setItemHandle(SHORT iItem,   /* TRUE signals success              */
  113.             ULONG ulHandle);
  114.     BOOL  setItemHeight(SHORT sHeight);/* TRUE signals success              */
  115.     BOOL  setItemText(SHORT iItem,     /* TRUE signals success              */
  116.               CHAR* pszText);
  117.     BOOL  setTopIndex(SHORT iItem);    /* TRUE signals success              */
  118. };
  119.  
  120. #endif /* CONTROLS_H_INCLUDED */
  121.  
  122.  
  123.  
  124.  
  125.  
  126.  
  127.  
  128.  
  129.