home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / dovetail.zip / control.cc < prev    next >
C/C++ Source or Header  |  1994-04-07  |  721b  |  37 lines

  1. #include "control.h"
  2.  
  3. // basic functions shared by all controls
  4.  
  5. Control::Control(HWND hParent, ULONG ulId)
  6. {
  7.     fCreated=FALSE;
  8.     if(ulId > 0)
  9.       hWnd = WinWindowFromID(hParent,ulId);
  10. }
  11. BOOL Control::Hide()
  12. {
  13.       return (BOOL) WinShowWindow(hWnd, FALSE);
  14. }
  15. BOOL Control::Show()
  16. {
  17.      return (BOOL) WinShowWindow(hWnd, TRUE);
  18. }
  19.  
  20. Control::~Control()
  21. {
  22.  
  23. // destroy window if we created it.  All subclasses are expected
  24. // to have an option to create the window.
  25.  
  26.      if(fCreated) WinDestroyWindow(hWnd);
  27. }
  28. VOID Control::SetPos(SHORT xp, SHORT yp, SHORT width, SHORT height)
  29. {
  30.    WinSetWindowPos(
  31.      hWnd,
  32.      0,
  33.      xp, yp,
  34.      width, height,
  35.      SWP_MOVE | SWP_SIZE);
  36. }
  37.