OWLNext    7.0
Borland's Object Windows Library for the modern age
Loading...
Searching...
No Matches
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,
46 int numRows = AS_MANY_AS_NEEDED,
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:
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
74 DECLARE_CASTABLE;
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
TPlacement
Enumerates the placement of a gadget.
Definition gadgetwi.h:47
friend class TGadget
Definition gadgetwi.h:361
TGadgetWindow(TWindow *parent=nullptr, TTileDirection direction=Horizontal, TFont *font=nullptr, TModule *module=nullptr)
Creates a TGadgetWindow interface object with the default tile direction and font and passes module w...
Definition gadgetwi.cpp:98
TTileDirection
Enumeration describing how gadgets should be laid out within the gadget window.
Definition gadgetwi.h:130
@ Horizontal
Arrange gadgets in a row.
Definition gadgetwi.h:131
ObjectWindows dynamic-link libraries (DLLs) construct an instance of TModule, which acts as an object...
Definition module.h:78
TRect is a mathematical class derived from tagRect.
Definition geometry.h:308
The tagSIZE struct is defined as.
Definition geometry.h:234
TRect TileGadgets()
Tiles the gadgets in the direction requested (horizontal or vertical).
Definition toolbox.cpp:162
int GetNumColumns() const
Returns the number of columns the tool box is using.
Definition toolbox.h:97
virtual void SetDirection(TTileDirection direction)
Sets the direction of the tiling–either horizontal or vertical.
Definition toolbox.cpp:65
TToolBox(TWindow *parent, int numColumns=2, int numRows=AS_MANY_AS_NEEDED, TTileDirection direction=Horizontal, TModule *module=0)
Constructs a TToolBox object with the specified number of columns and rows and tiling direction.
Definition toolbox.cpp:22
void GetDesiredSize(TSize &size)
Overrides TGadget's GetDesiredSize function and computes the size of the cell by calling GetMargins t...
Definition toolbox.cpp:120
int GetNumRows() const
Returns the number of rows the tool box is using.
Definition toolbox.h:89
void Insert(TGadget &gadget, TPlacement=After, TGadget *sibling=0)
Override Insert member function and tell the button to not notch its corners.
Definition toolbox.cpp:48
void LayoutSession()
Called when a change occurs in the size of the margins of the tool box or size of the gadgets,...
Definition toolbox.cpp:251
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,...
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