home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 7 / 07.iso / c / c083 / 19.ddi / OWLINC.PAK / TOOLBOX.H < prev    next >
Encoding:
C/C++ Source or Header  |  1993-12-02  |  1.8 KB  |  61 lines

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