LayoutItem.h
Go to the documentation of this file.
1 /*--------------------------------------------------------------------------------------+
2 |
3 | Supplied under applicable software license agreement.
4 |
5 | Copyright (c) 2018 Bentley Systems, Incorporated. All rights reserved.
6 |
7 +---------------------------------------------------------------------------------------*/
8 #pragma once
9 
10 #include <UI\UIFramework.h>
11 #include <UI\Core\BRect.h>
12 #include <UI\Layout\LayoutFlags.h>
13 #include <UI\Layout\SizePolicy.h>
14 
15 #include <limits.h>
16 
17 #include <Bentley\RefCounted.h>
18 
19 #pragma warning(disable:4275) // non – DLL-interface classkey 'identifier' used as base for DLL-interface classkey 'identifier'
20 
22 
23 static const int LAYOUTSIZE_MAX = INT_MAX/256/16;
24 
25 
26 class LayoutManager;
27 class LayoutControl;
28 class BSize;
29 
30 //=======================================================================================
51 //=======================================================================================
52 class LayoutItem : public Bentley::RefCounted <IRefCounted>
53  {
54 public:
56  DLLEXPORT virtual BSize GetDesiredSize() const = 0;
57 
59  DLLEXPORT virtual BSize GetMinimumSize() const = 0;
60 
62  DLLEXPORT virtual BSize GetMaximumSize() const = 0;
63 
67 
70  DLLEXPORT virtual void SetGeometry (const BRect& rect) = 0;
71 
73  DLLEXPORT virtual BRect GetGeometry() const = 0;
74 
76  DLLEXPORT virtual bool IsEmpty() const = 0;
77 
79  DLLEXPORT virtual bool IsVisible() const = 0;
80 
82  DLLEXPORT virtual BSize GetSize() const;
83 
85  DLLEXPORT virtual bool HasHeightForWidth() const;
86 
89  DLLEXPORT virtual int GetHeightForWidth (int width) const;
90 
93  DLLEXPORT virtual int GetMinimumHeightForWidth (int width) const;
94 
96  DLLEXPORT virtual void Invalidate();
97 
99  DLLEXPORT virtual void SetDirty();
100 
103 
105  DLLEXPORT virtual LayoutManager* GetLayout();
106 
109 
112  DLLEXPORT void SetAlignment (LayoutAlignment alignment);
113 
114 
115  };
116 
virtual void Invalidate()
Invalidates the layout item then updates it.
The LayoutControl class is the abstract base class of all user interface elements for layout manager ...
Definition: LayoutControl.h:54
virtual BSize GetMinimumSize() const =0
Returns the minimum size for this layout item.
virtual BSize GetSize() const
Returns the geometry's size for this layout item.
virtual void SetDirty()
Invalidates the layout item without updating it.
virtual BSize GetDesiredSize() const =0
Returns the desired size for this layout item.
virtual int GetMinimumHeightForWidth(int width) const
Returns the minimum height for this layout item, given the width.
LayoutFlags - Creates a "Flags" class out of an enum with constructors and operator overloading...
Definition: LayoutFlags.h:43
The LayoutItem class provides an abstract item that a LayoutManager manipulates.
Definition: LayoutItem.h:52
virtual void SetGeometry(const BRect &rect)=0
Sets the geometry for this layout item to the given rectangle.
The BRect class defines a rectangle using integer precision.
Definition: BRect.h:71
Template to simplify the task of writing a class that implements the reference-counting pattern...
Definition: RefCounted.h:90
The BSize class defines the size of a two - dimensional object using integer point precision...
Definition: BSize.h:38
#define BEGIN_BENTLEY_UIFRAMEWORK_NAMESPACE
Definition: UIFramework.h:14
virtual LayoutOrientations GetExpandingOrientations() const =0
Returns whether this layout item can make use of more space than GetDesiredSize().
#define DLLEXPORT
Definition: basedefs.h:137
virtual LayoutControl * GetControl()
If the concrete item is a LayoutControl, it can be retrieved using GetControl().
virtual int GetHeightForWidth(int width) const
Returns the preferred height for this layout item, given the width.
LayoutAlignment GetAlignment() const
Returns the alignment within the layout for this layout item.
#define END_BENTLEY_UIFRAMEWORK_NAMESPACE
Definition: UIFramework.h:15
virtual BRect GetGeometry() const =0
Returns the geometry for this layout item.
virtual bool IsVisible() const =0
Returns whether the layout item is visible.
virtual BSize GetMaximumSize() const =0
Returns the maximum size for this layout item.
The LayoutManager class is the base class of the layout managers.
Definition: LayoutManager.h:46
virtual bool HasHeightForWidth() const
Returns whether this layout's preferred height depends on its width.
virtual LayoutManager * GetLayout()
If the concrete item is a LayoutManager, it can be retrieved using GetLayout().
virtual bool IsEmpty() const =0
Returns whether the layout item is empty.
void SetAlignment(LayoutAlignment alignment)
Sets the alignment within the layout for this layout item.

Copyright © 2017 Bentley Systems, Incorporated. All rights reserved.