home *** CD-ROM | disk | FTP | other *** search
/ C Programming Starter Kit 2.0 / SamsPublishing-CProgrammingStarterKit-v2.0-Win31.iso / bc45 / owlsrc.pak / CONTROLB.CPP < prev    next >
Encoding:
C/C++ Source or Header  |  1997-07-24  |  1.3 KB  |  51 lines

  1. //----------------------------------------------------------------------------
  2. // ObjectWindows
  3. // (C) Copyright 1992, 1994 by Borland International, All Rights Reserved
  4. //
  5. //   Implementation of class TControlBar.
  6. //----------------------------------------------------------------------------
  7. #include <owl/owlpch.h>
  8. #include <owl/controlb.h>
  9.  
  10. IMPLEMENT_CASTABLE(TControlBar);
  11.  
  12. TControlBar::TControlBar(TWindow*        parent,
  13.                          TTileDirection  direction,
  14.                          TFont*          font,
  15.                          TModule*        module)
  16. :
  17.   TGadgetWindow(parent, direction, font, module)
  18. {
  19.   Margins.Units = TMargins::BorderUnits;
  20.  
  21.   if (Direction == Horizontal) {
  22.     Margins.Left = Margins.Right = 6;
  23.     Margins.Top = Margins.Bottom = 2;
  24.   }
  25.   else {
  26.     Margins.Left = Margins.Right = 2;
  27.     Margins.Top = Margins.Bottom = 6;
  28.   }
  29. }
  30.  
  31. bool
  32. TControlBar::PreProcessMsg(MSG&)
  33. {
  34.   return false;
  35. }
  36.  
  37. void
  38. TControlBar::PositionGadget(TGadget* previous, TGadget* next, TPoint& origin)
  39. {
  40.   //
  41.   // overlap the button borders
  42.   //
  43.   if (previous->GetBorderStyle() == TGadget::Plain &&
  44.       next->GetBorderStyle() == TGadget::Plain)
  45.     if (Direction == Horizontal)
  46.       origin.x -= GetSystemMetrics(SM_CXBORDER);
  47.  
  48.     else
  49.       origin.y -= GetSystemMetrics(SM_CYBORDER);
  50. }
  51.