hrev45810 adds 2 changesets to branch 'master' old head: 621ae6bd72cc2434e98a14944c1387d0b59abc17 new head: a97ff1bb60f6c3adddc121296175de58cb3f632c overview: http://cgit.haiku-os.org/haiku/log/?qt=range&q=a97ff1b+%5E621ae6b ---------------------------------------------------------------------------- 46d6e9d: Interface Kit: Adjust max size and default alignment... ...on controls where it makes sense: - BRadioButton and BCheckBox now return their preferred size as their maximum. - BRadioButton, BCheckBox and BTextControl now use left alignment by default, as this is the most common use case for them. a97ff1b: Adjust apps to conform to previous layout changes. The Deskbar and Time preferences were both relying on BCheckBox's previous unlimited max width to get their containing BBoxes to be the right size. Adjust the box constraints to make this happen at the level of the box instead. [ Rene Gollent <anevilyak@xxxxxxxxx> ] ---------------------------------------------------------------------------- 8 files changed, 35 insertions(+), 5 deletions(-) headers/os/interface/CheckBox.h | 5 +++-- headers/os/interface/RadioButton.h | 2 +- headers/os/interface/TextControl.h | 1 + src/apps/deskbar/PreferencesWindow.cpp | 1 + src/kits/interface/CheckBox.cpp | 10 +++++++++- src/kits/interface/RadioButton.cpp | 9 ++++++++- src/kits/interface/TextControl.cpp | 11 +++++++++++ src/preferences/time/ClockView.cpp | 1 + ############################################################################ Commit: 46d6e9d9ed21f6752b4f256ed193faa5bc586501 URL: http://cgit.haiku-os.org/haiku/commit/?id=46d6e9d Author: Rene Gollent <anevilyak@xxxxxxxxx> Date: Sun Jun 30 00:33:42 2013 UTC Interface Kit: Adjust max size and default alignment... ...on controls where it makes sense: - BRadioButton and BCheckBox now return their preferred size as their maximum. - BRadioButton, BCheckBox and BTextControl now use left alignment by default, as this is the most common use case for them. ---------------------------------------------------------------------------- diff --git a/headers/os/interface/CheckBox.h b/headers/os/interface/CheckBox.h index b8d2c58..7e7de42 100644 --- a/headers/os/interface/CheckBox.h +++ b/headers/os/interface/CheckBox.h @@ -17,9 +17,9 @@ public: uint32 flags = B_WILL_DRAW | B_NAVIGABLE); BCheckBox(const char* name, const char* label, BMessage* message, uint32 flags - = B_WILL_DRAW | B_NAVIGABLE); + = B_WILL_DRAW | B_NAVIGABLE); BCheckBox(const char* label, - BMessage* message = NULL); + BMessage* message = NULL); BCheckBox(BMessage* archive); virtual ~BCheckBox(); @@ -55,6 +55,7 @@ public: virtual BSize MinSize(); virtual BSize MaxSize(); virtual BSize PreferredSize(); + virtual BAlignment LayoutAlignment(); virtual void MakeFocus(bool focused = true); diff --git a/headers/os/interface/RadioButton.h b/headers/os/interface/RadioButton.h index 5586a51..48da018 100644 --- a/headers/os/interface/RadioButton.h +++ b/headers/os/interface/RadioButton.h @@ -61,7 +61,7 @@ public: virtual status_t Perform(perform_code d, void* argument); virtual BSize MaxSize(); - + virtual BAlignment LayoutAlignment(); private: friend status_t _init_interface_kit_(); diff --git a/headers/os/interface/TextControl.h b/headers/os/interface/TextControl.h index aca56a1..77d36d9 100644 --- a/headers/os/interface/TextControl.h +++ b/headers/os/interface/TextControl.h @@ -86,6 +86,7 @@ public: virtual BSize MinSize(); virtual BSize MaxSize(); virtual BSize PreferredSize(); + virtual BAlignment LayoutAlignment(); BLayoutItem* CreateLabelLayoutItem(); BLayoutItem* CreateTextViewLayoutItem(); diff --git a/src/kits/interface/CheckBox.cpp b/src/kits/interface/CheckBox.cpp index 031fb11..ffe9ee3 100644 --- a/src/kits/interface/CheckBox.cpp +++ b/src/kits/interface/CheckBox.cpp @@ -452,7 +452,7 @@ BSize BCheckBox::MaxSize() { return BLayoutUtils::ComposeSize(ExplicitMaxSize(), - BSize(B_SIZE_UNLIMITED, _ValidatePreferredSize().height)); + _ValidatePreferredSize()); } @@ -464,6 +464,14 @@ BCheckBox::PreferredSize() } +BAlignment +BCheckBox::LayoutAlignment() +{ + return BLayoutUtils::ComposeAlignment(ExplicitAlignment(), + BAlignment(B_ALIGN_LEFT, B_ALIGN_VERTICAL_UNSET)); +} + + // #pragma mark - diff --git a/src/kits/interface/RadioButton.cpp b/src/kits/interface/RadioButton.cpp index e3b3cfb..3e7659d 100644 --- a/src/kits/interface/RadioButton.cpp +++ b/src/kits/interface/RadioButton.cpp @@ -566,10 +566,17 @@ BRadioButton::MaxSize() GetPreferredSize(&width, &height); return BLayoutUtils::ComposeSize(ExplicitMaxSize(), - BSize(B_SIZE_UNLIMITED, height)); + BSize(width, height)); } +BAlignment +BRadioButton::LayoutAlignment() +{ + return BLayoutUtils::ComposeAlignment(ExplicitAlignment(), + BAlignment(B_ALIGN_LEFT, B_ALIGN_VERTICAL_UNSET)); +} + void BRadioButton::_ReservedRadioButton1() {} diff --git a/src/kits/interface/TextControl.cpp b/src/kits/interface/TextControl.cpp index 90ee19d..05ba91b 100644 --- a/src/kits/interface/TextControl.cpp +++ b/src/kits/interface/TextControl.cpp @@ -850,6 +850,17 @@ BTextControl::PreferredSize() } +BAlignment +BTextControl::LayoutAlignment() +{ + CALLED(); + + _ValidateLayoutData(); + return BLayoutUtils::ComposeAlignment(ExplicitAlignment(), + BAlignment(B_ALIGN_LEFT, B_ALIGN_VERTICAL_UNSET)); +} + + BLayoutItem* BTextControl::CreateLabelLayoutItem() { ############################################################################ Revision: hrev45810 Commit: a97ff1bb60f6c3adddc121296175de58cb3f632c URL: http://cgit.haiku-os.org/haiku/commit/?id=a97ff1b Author: Rene Gollent <anevilyak@xxxxxxxxx> Date: Sun Jun 30 00:34:35 2013 UTC Adjust apps to conform to previous layout changes. The Deskbar and Time preferences were both relying on BCheckBox's previous unlimited max width to get their containing BBoxes to be the right size. Adjust the box constraints to make this happen at the level of the box instead. ---------------------------------------------------------------------------- diff --git a/src/apps/deskbar/PreferencesWindow.cpp b/src/apps/deskbar/PreferencesWindow.cpp index b4a720d..581d69c 100644 --- a/src/apps/deskbar/PreferencesWindow.cpp +++ b/src/apps/deskbar/PreferencesWindow.cpp @@ -223,6 +223,7 @@ PreferencesWindow::PreferencesWindow(BRect frame) BBox* windowSettingsBox = new BBox("window"); windowSettingsBox->SetLabel(B_TRANSLATE("Window")); windowSettingsBox->AddChild(BLayoutBuilder::Group<>() + .SetExplicitMaxSize(BSize(B_SIZE_UNLIMITED, B_SIZE_UNSET)) .AddGroup(B_VERTICAL, 0) .Add(fWindowAlwaysOnTop) .Add(fWindowAutoRaise) diff --git a/src/preferences/time/ClockView.cpp b/src/preferences/time/ClockView.cpp index 82085c9..4755824 100644 --- a/src/preferences/time/ClockView.cpp +++ b/src/preferences/time/ClockView.cpp @@ -52,6 +52,7 @@ ClockView::ClockView(const char* name) new BMessage(kShowTimeZone)); BView* view = BLayoutBuilder::Group<>(B_VERTICAL, 0) + .SetExplicitMaxSize(BSize(B_SIZE_UNLIMITED, B_SIZE_UNSET)) .Add(fShowSeconds) .Add(fShowDayOfWeek) .Add(fShowTimeZone)