OWLNext    7.0
Borland's Object Windows Library for the modern age
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
toolbox.h
Go to the documentation of this file.
1//----------------------------------------------------------------------------
2// ObjectWindows
3// Copyright (c) 1992, 1996 by Borland International, All Rights Reserved
4//
5/// \file
6/// Definition of class TToolBox.
7//----------------------------------------------------------------------------
8
9#if !defined(OWL_TOOLBOX_H)
10#define OWL_TOOLBOX_H
11
12#include <owl/private/defs.h>
13#if defined(BI_HAS_PRAGMA_ONCE)
14# pragma once
15#endif
16
17#include <owl/defs.h>
18#include <owl/gadgetwi.h>
19
20
21namespace owl {
22
23#include <owl/preclass.h>
24
25/// \addtogroup gadgets
26/// @{
27//
28/// \class TToolBox
29// ~~~~~ ~~~~~~~~
30/// Arranges its gadgets in a matrix. All columns are the same width (as wide
31/// as the widest gadget) and all rows are the same height (as high as the
32/// heighest gadget)
33//
34/// You specify the number of rows and columns you want. You can specify
35/// AS_MANY_AS_NEEDED in which case the toolbox figures out how many rows or
36/// columns are needed based on the opposite dimension (e.g. if there are
37/// 20 gadgets and you requested 4 columns then you would get 5 rows)
38//
39
40const int AS_MANY_AS_NEEDED = -1;
41
43 public:
44 TToolBox(TWindow* parent,
45 int numColumns = 2,
47 TTileDirection direction = Horizontal, // Row Major
48 TModule* module = 0);
49
50 void GetDesiredSize(TSize& size);
51 void LayoutSession();
52
53 /// Override Insert member function and tell the button to not notch
54 /// its corners
55 //
56 void Insert(TGadget& gadget, TPlacement = After, TGadget* sibling = 0);
57
58 virtual void SetDirection(TTileDirection direction);
59
60 protected:
61 TRect TileGadgets();
62
63 int GetNumRows() const;
64 int GetNumColumns() const;
65
67 int NumRows; ///< Contains the number of rows for the toolbox.
68 int NumColumns; ///< Contains the number of columns for the toolbox.
69
70 private:
71 void ComputeNumRowsColumns(int& numRows, int& numColumns);
72 void ComputeCellSize(TSize& size);
73
75};
76
77/// @}
78
79#include <owl/posclass.h>
80
81
82//----------------------------------------------------------------------------
83// Inline implementation
84//
85
86//
87/// Returns the number of rows the tool box is using.
88//
89inline int TToolBox::GetNumRows() const
90{
91 return NumRows;
92}
93
94//
95/// Returns the number of columns the tool box is using.
96//
97inline int TToolBox::GetNumColumns() const
98{
99 return NumColumns;
100}
101
102} // OWL namespace
103
104
105#endif // OWL_TOOLBOX_H
TGadget is the base class for the following derived gadget classes:
Definition gadget.h:120
TPlacement
Enumerates the placement of a gadget.
Definition gadgetwi.h:47
Derived from TWindow, TGadgetWindow maintains a list of tiled gadgets for a window and lets you dynam...
Definition gadgetwi.h:122
TTileDirection
Enumeration describing how gadgets should be laid out within the gadget window.
Definition gadgetwi.h:130
ObjectWindows dynamic-link libraries (DLLs) construct an instance of TModule, which acts as an object...
Definition module.h:75
TRect is a mathematical class derived from tagRect.
Definition geometry.h:308
The tagSIZE struct is defined as.
Definition geometry.h:234
int GetNumColumns() const
Returns the number of columns the tool box is using.
Definition toolbox.h:97
int GetNumRows() const
Returns the number of rows the tool box is using.
Definition toolbox.h:89
TWindow, derived from TEventHandler and TStreamableBase, provides window-specific behavior and encaps...
Definition window.h:414
Definition of TGadgetList, TGadgetWindow & TGadgetWindowFont A list holding gadgets,...
#define DECLARE_CASTABLE
Definition objstrm.h:1440
const int AS_MANY_AS_NEEDED
Arranges its gadgets in a matrix.
Definition toolbox.h:40
Object Windows Library (OWLNext Core)
Definition animctrl.h:22
General definitions used by all ObjectWindows programs.
#define protected_data
Definition defs.h:208
#define _OWLCLASS
Definition defs.h:338