BTab: decouple display label from view name.

In BeOS, the tab label was synchronized with the view name. This means
BTab::SetLabel would change the view name. This behavior is unexpected,
and also annoying, for example it prevents using localized tab labels
but fixed view names for scripting.

* Document this divergence from BeOS in the Haiku book
* Detect if we're running in a BeOS app to preserve the old behavior
  then

Change-Id: I5b758a035fe8752cee2ea7789a30ea47a01467b9
Reviewed-on: https://review.haiku-os.org/c/haiku/+/122
Tested-by: Commit checker robot <[email protected]>
Reviewed-by: Jérôme Duval <[email protected]>
This commit is contained in:
Kacper Kasper
2025-12-02 08:00:36 +00:00
committed by Adrien Destugues
parent 0200659132
commit ccf8b1e96f
3 changed files with 48 additions and 15 deletions
+8 -1
View File
@@ -140,6 +140,8 @@
/*!
\fn const char* BTab::Label() const
\brief Returns the tab's label (the target view's name).
\warning In BeOS, the tab label is determined from the view name. In Haiku, they can be
different if SetLabel() was used.
\since BeOS R3
*/
@@ -147,7 +149,9 @@
/*!
\fn void BTab::SetLabel(const char* label)
\brief Sets the target view's name, and updates the BTab accordingly.
\brief Sets the tab label.
\warning In BeOS, setting the tab label also renamed the view attached to the tab. In Haiku,
this is not the case anymore, the label and view name are independant.
\since BeOS R3
*/
@@ -220,6 +224,9 @@
/*!
\fn void BTab::SetView(BView* view)
\brief Sets the view to be displayed for this tab.
This also resets the tab label to match the view name (to preserve BeOS behavior).
If you need to use a different label, SetLabel must be called after SetView.
*/