Use layout aware BMenuBars and do not shrink the
left side of the interface below the menu bars minimum width. Resolves cut off strings with localization. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@41149 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2006-2010, Stephan Aßmus <[email protected]>.
|
* Copyright 2006-2011, Stephan Aßmus <[email protected]>.
|
||||||
* All rights reserved. Distributed under the terms of the MIT License.
|
* All rights reserved. Distributed under the terms of the MIT License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -106,7 +106,7 @@ MainWindow::~MainWindow()
|
|||||||
{
|
{
|
||||||
delete fState;
|
delete fState;
|
||||||
|
|
||||||
if (fIcon)
|
if (fIcon != NULL)
|
||||||
fIcon->Release();
|
fIcon->Release();
|
||||||
|
|
||||||
fDocument->CommandStack()->RemoveObserver(this);
|
fDocument->CommandStack()->RemoveObserver(this);
|
||||||
@@ -555,7 +555,7 @@ void
|
|||||||
MainWindow::_Init()
|
MainWindow::_Init()
|
||||||
{
|
{
|
||||||
// create the GUI
|
// create the GUI
|
||||||
_CreateGUI(Bounds());
|
_CreateGUI();
|
||||||
|
|
||||||
// fix up scrollbar layout in listviews
|
// fix up scrollbar layout in listviews
|
||||||
_ImproveScrollBarLayout(fPathListView);
|
_ImproveScrollBarLayout(fPathListView);
|
||||||
@@ -608,10 +608,8 @@ MainWindow::_Init()
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
MainWindow::_CreateGUI(BRect bounds)
|
MainWindow::_CreateGUI()
|
||||||
{
|
{
|
||||||
const float splitWidth = 13 * be_plain_font->Size();
|
|
||||||
|
|
||||||
SetLayout(new BGroupLayout(B_HORIZONTAL));
|
SetLayout(new BGroupLayout(B_HORIZONTAL));
|
||||||
|
|
||||||
BGridLayout* layout = new BGridLayout();
|
BGridLayout* layout = new BGridLayout();
|
||||||
@@ -622,10 +620,15 @@ MainWindow::_CreateGUI(BRect bounds)
|
|||||||
|
|
||||||
BGroupView* leftTopView = new BGroupView(B_VERTICAL, 0);
|
BGroupView* leftTopView = new BGroupView(B_VERTICAL, 0);
|
||||||
layout->AddView(leftTopView, 0, 0);
|
layout->AddView(leftTopView, 0, 0);
|
||||||
leftTopView->SetExplicitMinSize(BSize(splitWidth, B_SIZE_UNSET));
|
|
||||||
|
|
||||||
// views along the left side
|
// views along the left side
|
||||||
leftTopView->AddChild(_CreateMenuBar(bounds));
|
leftTopView->AddChild(_CreateMenuBar());
|
||||||
|
|
||||||
|
float splitWidth = 13 * be_plain_font->Size();
|
||||||
|
BSize minSize = leftTopView->MinSize();
|
||||||
|
splitWidth = std::max(splitWidth, minSize.width);
|
||||||
|
leftTopView->SetExplicitMaxSize(BSize(splitWidth, B_SIZE_UNSET));
|
||||||
|
leftTopView->SetExplicitMinSize(BSize(splitWidth, B_SIZE_UNSET));
|
||||||
|
|
||||||
BGroupView* iconPreviews = new BGroupView(B_HORIZONTAL);
|
BGroupView* iconPreviews = new BGroupView(B_HORIZONTAL);
|
||||||
iconPreviews->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
|
iconPreviews->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
|
||||||
@@ -644,7 +647,6 @@ MainWindow::_CreateGUI(BRect bounds)
|
|||||||
"icon preview 32 desktop");
|
"icon preview 32 desktop");
|
||||||
fIconPreview32Desktop->SetLowColor(ui_color(B_DESKTOP_COLOR));
|
fIconPreview32Desktop->SetLowColor(ui_color(B_DESKTOP_COLOR));
|
||||||
|
|
||||||
// fIconPreview48 = new IconView(bounds, "icon preview 48");
|
|
||||||
fIconPreview64 = new IconView(BRect(0, 0, 63, 63), "icon preview 64");
|
fIconPreview64 = new IconView(BRect(0, 0, 63, 63), "icon preview 64");
|
||||||
fIconPreview64->SetLowColor(ui_color(B_DESKTOP_COLOR));
|
fIconPreview64->SetLowColor(ui_color(B_DESKTOP_COLOR));
|
||||||
|
|
||||||
@@ -675,10 +677,10 @@ MainWindow::_CreateGUI(BRect bounds)
|
|||||||
|
|
||||||
BGroupView* leftSideView = new BGroupView(B_VERTICAL, 0);
|
BGroupView* leftSideView = new BGroupView(B_VERTICAL, 0);
|
||||||
layout->AddView(leftSideView, 0, 1);
|
layout->AddView(leftSideView, 0, 1);
|
||||||
leftSideView->SetExplicitMinSize(BSize(splitWidth, B_SIZE_UNSET));
|
leftSideView->SetExplicitMaxSize(BSize(splitWidth, B_SIZE_UNSET));
|
||||||
|
|
||||||
// path menu and list view
|
// path menu and list view
|
||||||
BMenuBar* menuBar = new BMenuBar(bounds, "path menu bar");
|
BMenuBar* menuBar = new BMenuBar("path menu bar");
|
||||||
menuBar->AddItem(fPathMenu);
|
menuBar->AddItem(fPathMenu);
|
||||||
leftSideView->AddChild(menuBar);
|
leftSideView->AddChild(menuBar);
|
||||||
|
|
||||||
@@ -690,7 +692,7 @@ MainWindow::_CreateGUI(BRect bounds)
|
|||||||
leftSideView->AddChild(scrollView);
|
leftSideView->AddChild(scrollView);
|
||||||
|
|
||||||
// shape list view
|
// shape list view
|
||||||
menuBar = new BMenuBar(bounds, "shape menu bar");
|
menuBar = new BMenuBar("shape menu bar");
|
||||||
menuBar->AddItem(fShapeMenu);
|
menuBar->AddItem(fShapeMenu);
|
||||||
leftSideView->AddChild(menuBar);
|
leftSideView->AddChild(menuBar);
|
||||||
|
|
||||||
@@ -701,7 +703,7 @@ MainWindow::_CreateGUI(BRect bounds)
|
|||||||
leftSideView->AddChild(scrollView);
|
leftSideView->AddChild(scrollView);
|
||||||
|
|
||||||
// transformer list view
|
// transformer list view
|
||||||
menuBar = new BMenuBar(bounds, "transformer menu bar");
|
menuBar = new BMenuBar("transformer menu bar");
|
||||||
menuBar->AddItem(fTransformerMenu);
|
menuBar->AddItem(fTransformerMenu);
|
||||||
leftSideView->AddChild(menuBar);
|
leftSideView->AddChild(menuBar);
|
||||||
|
|
||||||
@@ -712,7 +714,7 @@ MainWindow::_CreateGUI(BRect bounds)
|
|||||||
leftSideView->AddChild(scrollView);
|
leftSideView->AddChild(scrollView);
|
||||||
|
|
||||||
// property list view
|
// property list view
|
||||||
menuBar = new BMenuBar(bounds, "property menu bar");
|
menuBar = new BMenuBar("property menu bar");
|
||||||
menuBar->AddItem(fPropertyMenu);
|
menuBar->AddItem(fPropertyMenu);
|
||||||
leftSideView->AddChild(menuBar);
|
leftSideView->AddChild(menuBar);
|
||||||
|
|
||||||
@@ -750,7 +752,7 @@ MainWindow::_CreateGUI(BRect bounds)
|
|||||||
topSide->AddView(styleGroupView);
|
topSide->AddView(styleGroupView);
|
||||||
|
|
||||||
// style list view
|
// style list view
|
||||||
menuBar = new BMenuBar(bounds, "style menu bar");
|
menuBar = new BMenuBar("style menu bar");
|
||||||
menuBar->AddItem(fStyleMenu);
|
menuBar->AddItem(fStyleMenu);
|
||||||
styleGroup->AddView(menuBar);
|
styleGroup->AddView(menuBar);
|
||||||
|
|
||||||
@@ -771,7 +773,7 @@ MainWindow::_CreateGUI(BRect bounds)
|
|||||||
BView* swatchGroupView = new BView("swatch group", 0, swatchGroup);
|
BView* swatchGroupView = new BView("swatch group", 0, swatchGroup);
|
||||||
topSide->AddView(swatchGroupView);
|
topSide->AddView(swatchGroupView);
|
||||||
|
|
||||||
menuBar = new BMenuBar(bounds, "swatches menu bar");
|
menuBar = new BMenuBar("swatches menu bar");
|
||||||
menuBar->AddItem(fSwatchMenu);
|
menuBar->AddItem(fSwatchMenu);
|
||||||
swatchGroup->AddView(menuBar);
|
swatchGroup->AddView(menuBar);
|
||||||
|
|
||||||
@@ -786,9 +788,9 @@ MainWindow::_CreateGUI(BRect bounds)
|
|||||||
}
|
}
|
||||||
|
|
||||||
BMenuBar*
|
BMenuBar*
|
||||||
MainWindow::_CreateMenuBar(BRect frame)
|
MainWindow::_CreateMenuBar()
|
||||||
{
|
{
|
||||||
BMenuBar* menuBar = new BMenuBar(frame, "main menu");
|
BMenuBar* menuBar = new BMenuBar("main menu");
|
||||||
|
|
||||||
|
|
||||||
#undef B_TRANSLATE_CONTEXT
|
#undef B_TRANSLATE_CONTEXT
|
||||||
|
|||||||
@@ -69,8 +69,8 @@ public:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
void _Init();
|
void _Init();
|
||||||
void _CreateGUI(BRect frame);
|
void _CreateGUI();
|
||||||
BMenuBar* _CreateMenuBar(BRect frame);
|
BMenuBar* _CreateMenuBar();
|
||||||
|
|
||||||
void _ImproveScrollBarLayout(BView* target);
|
void _ImproveScrollBarLayout(BView* target);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user