Added method SetExplicitSize() for convenience.
This commit is contained in:
@@ -32,6 +32,7 @@ public:
|
|||||||
virtual void SetExplicitMinSize(BSize size) = 0;
|
virtual void SetExplicitMinSize(BSize size) = 0;
|
||||||
virtual void SetExplicitMaxSize(BSize size) = 0;
|
virtual void SetExplicitMaxSize(BSize size) = 0;
|
||||||
virtual void SetExplicitPreferredSize(BSize size) = 0;
|
virtual void SetExplicitPreferredSize(BSize size) = 0;
|
||||||
|
void SetExplicitSize(BSize size);
|
||||||
virtual void SetExplicitAlignment(BAlignment alignment) = 0;
|
virtual void SetExplicitAlignment(BAlignment alignment) = 0;
|
||||||
|
|
||||||
virtual bool IsVisible() = 0;
|
virtual bool IsVisible() = 0;
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2001-2009, Haiku, Inc. All rights reserved.
|
* Copyright 2001-2012, Haiku, Inc. All rights reserved.
|
||||||
* Distributed under the terms of the MIT License.
|
* Distributed under the terms of the MIT License.
|
||||||
*/
|
*/
|
||||||
#ifndef _VIEW_H
|
#ifndef _VIEW_H
|
||||||
@@ -537,6 +537,7 @@ public:
|
|||||||
void SetExplicitMinSize(BSize size);
|
void SetExplicitMinSize(BSize size);
|
||||||
void SetExplicitMaxSize(BSize size);
|
void SetExplicitMaxSize(BSize size);
|
||||||
void SetExplicitPreferredSize(BSize size);
|
void SetExplicitPreferredSize(BSize size);
|
||||||
|
void SetExplicitSize(BSize size);
|
||||||
void SetExplicitAlignment(BAlignment alignment);
|
void SetExplicitAlignment(BAlignment alignment);
|
||||||
|
|
||||||
BSize ExplicitMinSize() const;
|
BSize ExplicitMinSize() const;
|
||||||
@@ -753,4 +754,5 @@ BView::SetLowColor(uchar r, uchar g, uchar b, uchar a)
|
|||||||
SetLowColor(color);
|
SetLowColor(color);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#endif // _VIEW_H
|
#endif // _VIEW_H
|
||||||
|
|||||||
@@ -1,9 +1,10 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2010, Haiku, Inc.
|
* Copyright 2010-2012, Haiku, Inc.
|
||||||
* Copyright 2006, Ingo Weinhold <[email protected]>.
|
* Copyright 2006, Ingo Weinhold <[email protected]>.
|
||||||
* All rights reserved. Distributed under the terms of the MIT License.
|
* All rights reserved. Distributed under the terms of the MIT License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#include <LayoutItem.h>
|
#include <LayoutItem.h>
|
||||||
|
|
||||||
#include <Layout.h>
|
#include <Layout.h>
|
||||||
@@ -46,6 +47,15 @@ BLayoutItem::Layout() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
BLayoutItem::SetExplicitSize(BSize size)
|
||||||
|
{
|
||||||
|
SetExplicitMinSize(size);
|
||||||
|
SetExplicitMaxSize(size);
|
||||||
|
SetExplicitPreferredSize(size);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
bool
|
bool
|
||||||
BLayoutItem::HasHeightForWidth()
|
BLayoutItem::HasHeightForWidth()
|
||||||
{
|
{
|
||||||
@@ -122,7 +132,7 @@ BLayoutItem::AlignInFrame(BRect frame)
|
|||||||
|
|
||||||
float minHeight;
|
float minHeight;
|
||||||
GetHeightForWidth(frame.Width(), &minHeight, NULL, NULL);
|
GetHeightForWidth(frame.Width(), &minHeight, NULL, NULL);
|
||||||
|
|
||||||
frame.bottom = frame.top + max_c(frame.Height(), minHeight);
|
frame.bottom = frame.top + max_c(frame.Height(), minHeight);
|
||||||
maxSize.height = minHeight;
|
maxSize.height = minHeight;
|
||||||
}
|
}
|
||||||
@@ -178,7 +188,7 @@ BLayoutItem::SetLayout(BLayout* layout)
|
|||||||
BView::Private(view).RegisterLayoutItem(this);
|
BView::Private(view).RegisterLayoutItem(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fLayout)
|
if (fLayout)
|
||||||
AttachedToLayout();
|
AttachedToLayout();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4586,6 +4586,16 @@ BView::SetExplicitPreferredSize(BSize size)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
BView::SetExplicitSize(BSize size)
|
||||||
|
{
|
||||||
|
fLayoutData->fMinSize = size;
|
||||||
|
fLayoutData->fMaxSize = size;
|
||||||
|
fLayoutData->fPreferredSize = size;
|
||||||
|
InvalidateLayout();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
BView::SetExplicitAlignment(BAlignment alignment)
|
BView::SetExplicitAlignment(BAlignment alignment)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user