Override the LayoutAlignment method in BStringView.
Left align StringViews using layout API by default falling back to the alignment settings set by SetAlignment() only if SetExplicitAlignment() is not used. This way StringViews are left-aligned by default, can be changed using the Layout API, and the pre-Layout API legacy method is used as a fallback. See this thread for details: http://www.freelists.org/post/haiku-development/Can-we-make-BStringViews-MaxSize-BSizeB-SIZE-UNLIMITED-B-SIZE-UNSET-by-default
This commit is contained in:
@@ -42,6 +42,7 @@ public:
|
||||
virtual BSize MaxSize();
|
||||
virtual BSize PreferredSize();
|
||||
virtual void ResizeToPreferred();
|
||||
virtual BAlignment LayoutAlignment();
|
||||
virtual void FrameMoved(BPoint newPosition);
|
||||
virtual void FrameResized(float newWidth, float newHeight);
|
||||
|
||||
|
||||
@@ -13,15 +13,15 @@
|
||||
|
||||
#include <StringView.h>
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <LayoutUtils.h>
|
||||
#include <Message.h>
|
||||
#include <View.h>
|
||||
#include <Window.h>
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <binary_compatibility/Interface.h>
|
||||
|
||||
|
||||
@@ -199,6 +199,14 @@ BStringView::ResizeToPreferred()
|
||||
}
|
||||
|
||||
|
||||
BAlignment
|
||||
BStringView::LayoutAlignment()
|
||||
{
|
||||
return BLayoutUtils::ComposeAlignment(ExplicitAlignment(),
|
||||
BAlignment(fAlign, B_ALIGN_MIDDLE));
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
BStringView::FrameMoved(BPoint newPosition)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user