home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / dho.zip / DHO / SRC / STATIC.CC < prev    next >
C/C++ Source or Header  |  1995-08-27  |  4KB  |  195 lines

  1. /****************************************/
  2. /*    Developer Helper Object Set       */
  3. /*  (C) 1994-95 Thomas E. Bednarz, Jr.  */
  4. /*     All rights reserved              */
  5. /***************************************/
  6.  
  7. /* $Id: static.cc 1.2 1995/08/13 03:21:12 teb Exp $ */
  8.  
  9.  
  10. #include"static.h"
  11. #include<stdio.h>
  12.  
  13.  
  14. //-----------------------------------------------------
  15. //   TStaticBase
  16. TStaticBase::TStaticBase(TWinBase *parent, ULONG resource):
  17.    TControl(parent, resource)
  18. {
  19.  
  20. }
  21.  
  22. //-----------------------------------------------------
  23. //   TStaticBase
  24. TStaticBase::TStaticBase(TWinBase *parent):
  25.    TControl(parent)
  26. {
  27.  
  28. }
  29.  
  30.  
  31. //-----------------------------------------------------
  32. //   initC
  33. void TStaticBase::initC()
  34. {
  35.    hwndControl = WinCreateWindow(
  36.             fParent->getHWND(),
  37.             WC_STATIC,
  38.             (PSZ)text,
  39.             WS_VISIBLE | classStyle,
  40.             fx, fy, cx, cy,
  41.             fParent->getHWND(),
  42.             HWND_TOP,
  43.             fResource,
  44.             NULL, NULL);
  45. }
  46.  
  47.  
  48.  
  49. //-----------------------------------------------------
  50. //   TStaticText
  51. TStaticText::TStaticText(TWinBase *Parent, char *text,
  52.                    ULONG x, ULONG y, ULONG width, ULONG height):
  53.    TStaticBase(Parent)
  54. {
  55.    fx = x;
  56.    fy = y;
  57.    cx = width;
  58.    cy = height;
  59.    this->text = text;
  60.    classStyle = SS_TEXT;
  61.    initC();
  62. }
  63.  
  64.  
  65. //-----------------------------------------------------
  66. //   TStaticText
  67. TStaticText::TStaticText(TWinBase *parent, ULONG resource):
  68.    TStaticBase(parent, resource)
  69. {
  70.  
  71. }
  72.  
  73.  
  74. //-----------------------------------------------------
  75. //   getClassName
  76. const char *TStaticText::getClassName()
  77. {
  78.    return "TStaticText";
  79. }
  80.  
  81. void TStaticText::setText(char *text)
  82. {
  83.    WinSetWindowText(hwndControl, (PSZ)text);
  84. }
  85.  
  86.  
  87. //-----------------------------------------------------
  88. //   TBitmap
  89. TBitmap::TBitmap(TWinBase *Parent, ULONG id, ULONG x, ULONG y, ULONG width, ULONG height):
  90.    TStaticBase(Parent)
  91. {
  92.    char buf[50];
  93.    fx = x;
  94.    fy = y;
  95.    cx = width;
  96.    cy = height;
  97.  
  98.    sprintf(buf, "#%ld", id);
  99.    text = buf;
  100.    classStyle = SS_BITMAP;
  101.  
  102.    initC();
  103. }
  104.  
  105.  
  106. //-----------------------------------------------------
  107. //   TBitmap
  108. TBitmap::TBitmap(TWinBase *parent, ULONG resource):
  109.    TStaticBase(parent, resource)
  110. {
  111.  
  112. }
  113.  
  114.  
  115. //-----------------------------------------------------
  116. //   TBitmap
  117. const char *TBitmap::getClassName()
  118. {
  119.    return "TBitmap";
  120. }
  121.  
  122.  
  123.  
  124. //-----------------------------------------------------
  125. //   TGroupBox
  126. TGroupBox::TGroupBox(TWinBase *Parent, ULONG x, ULONG y, ULONG width, ULONG height):
  127.    TStaticBase(Parent)
  128. {
  129.    fx = x;
  130.    fy = y;
  131.    cx = width;
  132.    cy = height;
  133.    text = NULL;
  134.    classStyle = SS_GROUPBOX;
  135.  
  136.    initC();
  137. }
  138.  
  139.  
  140. //-----------------------------------------------------
  141. //   TGroupBox
  142. TGroupBox::TGroupBox(TWinBase *parent, ULONG resource):
  143.    TStaticBase(parent, resource)
  144. {
  145.  
  146.  
  147. }
  148.  
  149.  
  150. //-----------------------------------------------------
  151. //   getClassName
  152. const char *TGroupBox::getClassName()
  153. {
  154.    return "TGroupBox";
  155. }
  156.  
  157.  
  158.  
  159. //-----------------------------------------------------
  160. //   TIcon
  161. TIcon::TIcon(TWinBase *Parent, ULONG id, ULONG x, ULONG y, ULONG width, ULONG height):
  162.    TStaticBase(Parent)
  163. {
  164.    char buf[50];
  165.  
  166.    fx = x;
  167.    fy = y;
  168.    cx = width;
  169.    cy = height;
  170.    sprintf(buf, "#%ld", id);
  171.    text = buf;
  172.    classStyle = SS_ICON;
  173.  
  174.    initC();
  175. }
  176.  
  177.  
  178. //-----------------------------------------------------
  179. //   TIcon
  180. TIcon::TIcon(TWinBase *parent, ULONG resource):
  181.    TStaticBase(parent, resource)
  182. {
  183.  
  184. }
  185.  
  186.  
  187. //-----------------------------------------------------
  188. //   getClassName
  189. const char *TIcon::getClassName()
  190. {
  191.    return "TIcon";
  192. }
  193.  
  194.  
  195.