home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 1998 May / Pcwk5b98.iso / Borland / Cplus45 / BC45 / OWLINC.PAK / TOOLBOX.H < prev    next >
C/C++ Source or Header  |  1995-08-29  |  2KB  |  62 lines

  1. //----------------------------------------------------------------------------
  2. // ObjectWindows
  3. // (C) Copyright 1992, 1994 by Borland International, All Rights Reserved
  4. //
  5. //   Definition of class TToolBox.
  6. //----------------------------------------------------------------------------
  7. #if !defined(OWL_TOOLBOX_H)
  8. #define OWL_TOOLBOX_H
  9.  
  10. #if !defined(OWL_GADGETWI_H)
  11. # include <owl/gadgetwi.h>
  12. #endif
  13.  
  14. //
  15. //  class TToolBox
  16. //  ----- --------
  17. //
  18. //  arranges its gadgets in a matrix. all columns are the same width (as wide
  19. //  as the widest gadget) and all rows are the same height (as high as the
  20. //  heighest gadget)
  21. //
  22. //  you specify the number of rows and columns you want. you can specify
  23. //  AS_MANY_AS_NEEDED in which case the toolbox figures out how many rows or
  24. //  columns are needed based on the opposite dimension (e.g. if there are
  25. //  20 gadgets and you requested 4 columns then you would get 5 rows)
  26. //
  27. const int AS_MANY_AS_NEEDED = -1;
  28.  
  29. class _OWLCLASS TToolBox : public TGadgetWindow {
  30.   public:
  31.     TToolBox(TWindow*        parent,
  32.              int             numColumns = 2,
  33.              int             numRows = AS_MANY_AS_NEEDED,
  34.              TTileDirection  direction = Horizontal,  // Row Major
  35.              TModule*        module = 0);
  36.  
  37.     void  GetDesiredSize(TSize& size);
  38.     void  LayoutSession();
  39.  
  40.     //
  41.     // override Insert member function and tell the button to not notch
  42.     // its corners
  43.     //
  44.     void  Insert(TGadget& gadget, TPlacement = After, TGadget* sibling = 0);
  45.  
  46.     virtual void  SetDirection(TTileDirection direction);
  47.   
  48.   protected:
  49.     int             NumRows;
  50.     int             NumColumns;
  51.  
  52.     TRect TileGadgets();
  53.  
  54.   private:
  55.     void  ComputeNumRowsColumns(int& numRows, int& numColumns);
  56.     void  ComputeCellSize(TSize& size);
  57.  
  58.   DECLARE_CASTABLE;
  59. };
  60.  
  61. #endif  // OWL_TOOLBOX_H
  62.