home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 7 / 07.iso / c / c083 / 11.ddi / OWLSRC.PAK / CONTROLB.CPP < prev    next >
Encoding:
C/C++ Source or Header  |  1993-12-02  |  1.3 KB  |  49 lines

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