Fixed font sensitiveness issues in the Fonts preflet. Patch by Lucasz
Zemczak. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@20379 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
4f18055dfa
commit
2ef329a206
@ -88,10 +88,10 @@ FontSelectionView::FontSelectionView(BRect _rect, const char* name,
|
||||
AddChild(fFontsMenuField);
|
||||
|
||||
// size menu
|
||||
rect.right = rect.left + StringWidth("99") + 40;
|
||||
rect.right = rect.left + StringWidth("Size: 99") + 30.0f;
|
||||
fSizesMenuField = new BMenuField(rect, "sizes", "Size:", fSizesMenu, true,
|
||||
B_FOLLOW_RIGHT | B_FOLLOW_TOP);
|
||||
fSizesMenuField->SetDivider(StringWidth(fSizesMenuField->Label()) + 5.0);
|
||||
B_FOLLOW_TOP);
|
||||
fSizesMenuField->SetDivider(StringWidth(fSizesMenuField->Label()) + 5.0f);
|
||||
fSizesMenuField->SetAlignment(B_ALIGN_RIGHT);
|
||||
fSizesMenuField->ResizeToPreferred();
|
||||
rect = Bounds();
|
||||
@ -165,6 +165,20 @@ FontSelectionView::SetDivider(float divider)
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
FontSelectionView::RelayoutIfNeeded()
|
||||
{
|
||||
float width, height;
|
||||
GetPreferredSize(&width, &height);
|
||||
|
||||
if (width > Bounds().Width()) {
|
||||
fSizesMenuField->MoveTo(fMaxFontNameWidth + fDivider + 40.0f,
|
||||
fFontsMenuField->Bounds().top);
|
||||
ResizeTo(width, height);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
FontSelectionView::AttachedToWindow()
|
||||
{
|
||||
|
@ -30,6 +30,7 @@ class FontSelectionView : public BView {
|
||||
virtual void MessageReceived(BMessage *msg);
|
||||
|
||||
void SetDivider(float divider);
|
||||
void RelayoutIfNeeded();
|
||||
|
||||
void SetDefaults();
|
||||
void Revert();
|
||||
|
@ -85,6 +85,15 @@ FontView::UpdateFonts()
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
FontView::RelayoutIfNeeded()
|
||||
{
|
||||
fPlainView->RelayoutIfNeeded();
|
||||
fBoldView->RelayoutIfNeeded();
|
||||
fFixedView->RelayoutIfNeeded();
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
FontView::IsRevertable()
|
||||
{
|
||||
|
@ -23,6 +23,7 @@ class FontView : public BView {
|
||||
void SetDefaults();
|
||||
void Revert();
|
||||
void UpdateFonts();
|
||||
void RelayoutIfNeeded();
|
||||
|
||||
bool IsRevertable();
|
||||
|
||||
|
@ -61,6 +61,8 @@ MainWindow::MainWindow()
|
||||
|
||||
tabView->AddTab(fFontsView);
|
||||
|
||||
fFontsView->UpdateFonts();
|
||||
fFontsView->RelayoutIfNeeded();
|
||||
float width, height;
|
||||
fFontsView->GetPreferredSize(&width, &height);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user