haiku/docs/user/interface/TabView.dox

757 lines
14 KiB
Plaintext
Raw Normal View History

2014-12-20 03:43:44 +03:00
/*
BeControlLook: Fix app integration drawing issues Update BTab::DrawTab() to pass the current index, the index of the selected tab, and the index of the first and last tabs into BControlLook::DrawActiveTab() and BControlLook::DrawInactiveTab(). This allows you to draw tabs differently in your BTab or BControlLook subclass in many different circumstances. Modify BControlLook API to add indexes to DrawActiveTab() and DrawInactiveTab() like so: void DrawActiveTab(..., int32 index = 0, int32 selected = -1, int32 first = 0, int32 last = 0); void DrawInactiveTab(..., int32 index = 0, int32 selected = -1, int32 first = 0, int32 last = 0); These extra indexes are not used by HaikuControlLook which relies only on if the tab is active or inactive to draw. Add IndexOf(BTab* tab) method to BTabView and document it to get the index of the current tab in BTab::DrawTab(). Also add a warning in the BTabView::DrawTab() method not to use the position and full parameters anymore, use BTabView::IndexOf(), BTabView::Selection(), and BTabView::TabCount() to get the info you need. Using a dynamic_cast to a BTabView in BeControlLook to determine if the view is derived from a BTabView didn't work in the case of WebPositive. Furthermore, WebPositive does custom tab drawing which needed to be updated for alternative control look. These index parameters passed from BTab to BeControlLook allow us to draw the tab like BeOS without relying on a dynamic_cast to BTabView to get the info. Reproduce the functionality described above for BTab in WebPositive's custom tabs. Eliminate no longer needed code in favor of using indexes. Update WebPositive custom tabs to use BControlLook::DrawTabFrame() instead of BControlLook::DrawInactiveTab() matching the update made in BTabView. In BeControlLook::DrawTabFrame() fill rect with base color, WebPositive doesn't draw any tab background, so it expects this work to be done for it. Eliminate hasFrames variable from WebPositive. Rename TabSelected(index) to UpdateSelection(index) in WebPositive to better reflect its purpose. Adjusted HaikuControlLook::DrawInactiveTab() to draw the tab borders more selectively. Only draw border if left border is set for top and bottom tabs or top border is set for left and right tabs. Undo no longer needed frame manipulation border drawing workaround in HaikuControlLook::DrawTabFrame(). Draw scroll bar triangle without using DrawArrowShape(). Unlike in HaikuControlLook, DrawArrowShape() is used to draw arrows in BOutlineListView and menus distinctly from how it draws arrows in scroll bars. Draw our distinct arrows in DrawSrollBarButtons() instead. This fixes overflow of time edit up-down arrows in Clock prefs and the collapse-expand arrow in Deskbar not being vertically centered. In DrawBorders() only inset if we actually draw the border. Fix alignment issues with DrawSliderThumb dots for example in MediaPlayer volume knobs. Draw using line arrays calling AddLine instead of StrokeLine in several places. DrawMenuBar() extends to draw final pixel which eliminates an extra lines at the end of menu bars. Truncate button labels better fixing a few issues for example keymap keyboard layout button labels. Button insets has been updated a bit to fix drawing issues with buttons missing a border. Using a dynamic_cast to a BButton to determine if a view is a button in BeControlLook didn't work in the case of the keymap label. Look for B_FLAT, B_HOVER, or B_DEFAULT_BUTTON flag in BeControlLook::DrawLabel() to draw the label inverted on click. Pass the B_FLAT flag from Keymap keys when drawing using BControlLook so that the label is inverted. Change-Id: I07631f4b006bdb9aeca2adc9cbdf2da54dae8e92 Reviewed-on: https://review.haiku-os.org/c/haiku/+/2866 Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
2020-06-02 00:15:29 +03:00
* Copyright 2014-2020 Haiku, Inc. All rights reserved.
2014-12-20 03:43:44 +03:00
* Distributed under the terms of the MIT License.
*
* Authors:
* Augustin Cavalier <waddlesplash>
2014-12-20 03:43:44 +03:00
* John Scipione, jscipione@gmail.com
*
* Corresponds to:
BeControlLook: Fix app integration drawing issues Update BTab::DrawTab() to pass the current index, the index of the selected tab, and the index of the first and last tabs into BControlLook::DrawActiveTab() and BControlLook::DrawInactiveTab(). This allows you to draw tabs differently in your BTab or BControlLook subclass in many different circumstances. Modify BControlLook API to add indexes to DrawActiveTab() and DrawInactiveTab() like so: void DrawActiveTab(..., int32 index = 0, int32 selected = -1, int32 first = 0, int32 last = 0); void DrawInactiveTab(..., int32 index = 0, int32 selected = -1, int32 first = 0, int32 last = 0); These extra indexes are not used by HaikuControlLook which relies only on if the tab is active or inactive to draw. Add IndexOf(BTab* tab) method to BTabView and document it to get the index of the current tab in BTab::DrawTab(). Also add a warning in the BTabView::DrawTab() method not to use the position and full parameters anymore, use BTabView::IndexOf(), BTabView::Selection(), and BTabView::TabCount() to get the info you need. Using a dynamic_cast to a BTabView in BeControlLook to determine if the view is derived from a BTabView didn't work in the case of WebPositive. Furthermore, WebPositive does custom tab drawing which needed to be updated for alternative control look. These index parameters passed from BTab to BeControlLook allow us to draw the tab like BeOS without relying on a dynamic_cast to BTabView to get the info. Reproduce the functionality described above for BTab in WebPositive's custom tabs. Eliminate no longer needed code in favor of using indexes. Update WebPositive custom tabs to use BControlLook::DrawTabFrame() instead of BControlLook::DrawInactiveTab() matching the update made in BTabView. In BeControlLook::DrawTabFrame() fill rect with base color, WebPositive doesn't draw any tab background, so it expects this work to be done for it. Eliminate hasFrames variable from WebPositive. Rename TabSelected(index) to UpdateSelection(index) in WebPositive to better reflect its purpose. Adjusted HaikuControlLook::DrawInactiveTab() to draw the tab borders more selectively. Only draw border if left border is set for top and bottom tabs or top border is set for left and right tabs. Undo no longer needed frame manipulation border drawing workaround in HaikuControlLook::DrawTabFrame(). Draw scroll bar triangle without using DrawArrowShape(). Unlike in HaikuControlLook, DrawArrowShape() is used to draw arrows in BOutlineListView and menus distinctly from how it draws arrows in scroll bars. Draw our distinct arrows in DrawSrollBarButtons() instead. This fixes overflow of time edit up-down arrows in Clock prefs and the collapse-expand arrow in Deskbar not being vertically centered. In DrawBorders() only inset if we actually draw the border. Fix alignment issues with DrawSliderThumb dots for example in MediaPlayer volume knobs. Draw using line arrays calling AddLine instead of StrokeLine in several places. DrawMenuBar() extends to draw final pixel which eliminates an extra lines at the end of menu bars. Truncate button labels better fixing a few issues for example keymap keyboard layout button labels. Button insets has been updated a bit to fix drawing issues with buttons missing a border. Using a dynamic_cast to a BButton to determine if a view is a button in BeControlLook didn't work in the case of the keymap label. Look for B_FLAT, B_HOVER, or B_DEFAULT_BUTTON flag in BeControlLook::DrawLabel() to draw the label inverted on click. Pass the B_FLAT flag from Keymap keys when drawing using BControlLook so that the label is inverted. Change-Id: I07631f4b006bdb9aeca2adc9cbdf2da54dae8e92 Reviewed-on: https://review.haiku-os.org/c/haiku/+/2866 Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
2020-06-02 00:15:29 +03:00
* headers/os/interface/TabView.h hrev54500
* src/kits/interface/TabView.cpp hrev54500
2014-12-20 03:43:44 +03:00
*/
/*!
\file TabView.h
\ingroup interface
\ingroup libbe
\brief Provides the BTab and BTabView classes.
*/
/*!
\enum tab_position
\ingroup interface
Tab position flags
\since BeOS R3
BeControlLook: Fix app integration drawing issues Update BTab::DrawTab() to pass the current index, the index of the selected tab, and the index of the first and last tabs into BControlLook::DrawActiveTab() and BControlLook::DrawInactiveTab(). This allows you to draw tabs differently in your BTab or BControlLook subclass in many different circumstances. Modify BControlLook API to add indexes to DrawActiveTab() and DrawInactiveTab() like so: void DrawActiveTab(..., int32 index = 0, int32 selected = -1, int32 first = 0, int32 last = 0); void DrawInactiveTab(..., int32 index = 0, int32 selected = -1, int32 first = 0, int32 last = 0); These extra indexes are not used by HaikuControlLook which relies only on if the tab is active or inactive to draw. Add IndexOf(BTab* tab) method to BTabView and document it to get the index of the current tab in BTab::DrawTab(). Also add a warning in the BTabView::DrawTab() method not to use the position and full parameters anymore, use BTabView::IndexOf(), BTabView::Selection(), and BTabView::TabCount() to get the info you need. Using a dynamic_cast to a BTabView in BeControlLook to determine if the view is derived from a BTabView didn't work in the case of WebPositive. Furthermore, WebPositive does custom tab drawing which needed to be updated for alternative control look. These index parameters passed from BTab to BeControlLook allow us to draw the tab like BeOS without relying on a dynamic_cast to BTabView to get the info. Reproduce the functionality described above for BTab in WebPositive's custom tabs. Eliminate no longer needed code in favor of using indexes. Update WebPositive custom tabs to use BControlLook::DrawTabFrame() instead of BControlLook::DrawInactiveTab() matching the update made in BTabView. In BeControlLook::DrawTabFrame() fill rect with base color, WebPositive doesn't draw any tab background, so it expects this work to be done for it. Eliminate hasFrames variable from WebPositive. Rename TabSelected(index) to UpdateSelection(index) in WebPositive to better reflect its purpose. Adjusted HaikuControlLook::DrawInactiveTab() to draw the tab borders more selectively. Only draw border if left border is set for top and bottom tabs or top border is set for left and right tabs. Undo no longer needed frame manipulation border drawing workaround in HaikuControlLook::DrawTabFrame(). Draw scroll bar triangle without using DrawArrowShape(). Unlike in HaikuControlLook, DrawArrowShape() is used to draw arrows in BOutlineListView and menus distinctly from how it draws arrows in scroll bars. Draw our distinct arrows in DrawSrollBarButtons() instead. This fixes overflow of time edit up-down arrows in Clock prefs and the collapse-expand arrow in Deskbar not being vertically centered. In DrawBorders() only inset if we actually draw the border. Fix alignment issues with DrawSliderThumb dots for example in MediaPlayer volume knobs. Draw using line arrays calling AddLine instead of StrokeLine in several places. DrawMenuBar() extends to draw final pixel which eliminates an extra lines at the end of menu bars. Truncate button labels better fixing a few issues for example keymap keyboard layout button labels. Button insets has been updated a bit to fix drawing issues with buttons missing a border. Using a dynamic_cast to a BButton to determine if a view is a button in BeControlLook didn't work in the case of the keymap label. Look for B_FLAT, B_HOVER, or B_DEFAULT_BUTTON flag in BeControlLook::DrawLabel() to draw the label inverted on click. Pass the B_FLAT flag from Keymap keys when drawing using BControlLook so that the label is inverted. Change-Id: I07631f4b006bdb9aeca2adc9cbdf2da54dae8e92 Reviewed-on: https://review.haiku-os.org/c/haiku/+/2866 Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
2020-06-02 00:15:29 +03:00
\deprecated This should not be used anymore.
\sa BTab::DrawTab()
2014-12-20 03:43:44 +03:00
*/
/*!
\var tab_position B_TAB_FIRST
BeControlLook: Fix app integration drawing issues Update BTab::DrawTab() to pass the current index, the index of the selected tab, and the index of the first and last tabs into BControlLook::DrawActiveTab() and BControlLook::DrawInactiveTab(). This allows you to draw tabs differently in your BTab or BControlLook subclass in many different circumstances. Modify BControlLook API to add indexes to DrawActiveTab() and DrawInactiveTab() like so: void DrawActiveTab(..., int32 index = 0, int32 selected = -1, int32 first = 0, int32 last = 0); void DrawInactiveTab(..., int32 index = 0, int32 selected = -1, int32 first = 0, int32 last = 0); These extra indexes are not used by HaikuControlLook which relies only on if the tab is active or inactive to draw. Add IndexOf(BTab* tab) method to BTabView and document it to get the index of the current tab in BTab::DrawTab(). Also add a warning in the BTabView::DrawTab() method not to use the position and full parameters anymore, use BTabView::IndexOf(), BTabView::Selection(), and BTabView::TabCount() to get the info you need. Using a dynamic_cast to a BTabView in BeControlLook to determine if the view is derived from a BTabView didn't work in the case of WebPositive. Furthermore, WebPositive does custom tab drawing which needed to be updated for alternative control look. These index parameters passed from BTab to BeControlLook allow us to draw the tab like BeOS without relying on a dynamic_cast to BTabView to get the info. Reproduce the functionality described above for BTab in WebPositive's custom tabs. Eliminate no longer needed code in favor of using indexes. Update WebPositive custom tabs to use BControlLook::DrawTabFrame() instead of BControlLook::DrawInactiveTab() matching the update made in BTabView. In BeControlLook::DrawTabFrame() fill rect with base color, WebPositive doesn't draw any tab background, so it expects this work to be done for it. Eliminate hasFrames variable from WebPositive. Rename TabSelected(index) to UpdateSelection(index) in WebPositive to better reflect its purpose. Adjusted HaikuControlLook::DrawInactiveTab() to draw the tab borders more selectively. Only draw border if left border is set for top and bottom tabs or top border is set for left and right tabs. Undo no longer needed frame manipulation border drawing workaround in HaikuControlLook::DrawTabFrame(). Draw scroll bar triangle without using DrawArrowShape(). Unlike in HaikuControlLook, DrawArrowShape() is used to draw arrows in BOutlineListView and menus distinctly from how it draws arrows in scroll bars. Draw our distinct arrows in DrawSrollBarButtons() instead. This fixes overflow of time edit up-down arrows in Clock prefs and the collapse-expand arrow in Deskbar not being vertically centered. In DrawBorders() only inset if we actually draw the border. Fix alignment issues with DrawSliderThumb dots for example in MediaPlayer volume knobs. Draw using line arrays calling AddLine instead of StrokeLine in several places. DrawMenuBar() extends to draw final pixel which eliminates an extra lines at the end of menu bars. Truncate button labels better fixing a few issues for example keymap keyboard layout button labels. Button insets has been updated a bit to fix drawing issues with buttons missing a border. Using a dynamic_cast to a BButton to determine if a view is a button in BeControlLook didn't work in the case of the keymap label. Look for B_FLAT, B_HOVER, or B_DEFAULT_BUTTON flag in BeControlLook::DrawLabel() to draw the label inverted on click. Pass the B_FLAT flag from Keymap keys when drawing using BControlLook so that the label is inverted. Change-Id: I07631f4b006bdb9aeca2adc9cbdf2da54dae8e92 Reviewed-on: https://review.haiku-os.org/c/haiku/+/2866 Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
2020-06-02 00:15:29 +03:00
The first tab in the tab view.
2014-12-20 03:43:44 +03:00
\since BeOS R3
BeControlLook: Fix app integration drawing issues Update BTab::DrawTab() to pass the current index, the index of the selected tab, and the index of the first and last tabs into BControlLook::DrawActiveTab() and BControlLook::DrawInactiveTab(). This allows you to draw tabs differently in your BTab or BControlLook subclass in many different circumstances. Modify BControlLook API to add indexes to DrawActiveTab() and DrawInactiveTab() like so: void DrawActiveTab(..., int32 index = 0, int32 selected = -1, int32 first = 0, int32 last = 0); void DrawInactiveTab(..., int32 index = 0, int32 selected = -1, int32 first = 0, int32 last = 0); These extra indexes are not used by HaikuControlLook which relies only on if the tab is active or inactive to draw. Add IndexOf(BTab* tab) method to BTabView and document it to get the index of the current tab in BTab::DrawTab(). Also add a warning in the BTabView::DrawTab() method not to use the position and full parameters anymore, use BTabView::IndexOf(), BTabView::Selection(), and BTabView::TabCount() to get the info you need. Using a dynamic_cast to a BTabView in BeControlLook to determine if the view is derived from a BTabView didn't work in the case of WebPositive. Furthermore, WebPositive does custom tab drawing which needed to be updated for alternative control look. These index parameters passed from BTab to BeControlLook allow us to draw the tab like BeOS without relying on a dynamic_cast to BTabView to get the info. Reproduce the functionality described above for BTab in WebPositive's custom tabs. Eliminate no longer needed code in favor of using indexes. Update WebPositive custom tabs to use BControlLook::DrawTabFrame() instead of BControlLook::DrawInactiveTab() matching the update made in BTabView. In BeControlLook::DrawTabFrame() fill rect with base color, WebPositive doesn't draw any tab background, so it expects this work to be done for it. Eliminate hasFrames variable from WebPositive. Rename TabSelected(index) to UpdateSelection(index) in WebPositive to better reflect its purpose. Adjusted HaikuControlLook::DrawInactiveTab() to draw the tab borders more selectively. Only draw border if left border is set for top and bottom tabs or top border is set for left and right tabs. Undo no longer needed frame manipulation border drawing workaround in HaikuControlLook::DrawTabFrame(). Draw scroll bar triangle without using DrawArrowShape(). Unlike in HaikuControlLook, DrawArrowShape() is used to draw arrows in BOutlineListView and menus distinctly from how it draws arrows in scroll bars. Draw our distinct arrows in DrawSrollBarButtons() instead. This fixes overflow of time edit up-down arrows in Clock prefs and the collapse-expand arrow in Deskbar not being vertically centered. In DrawBorders() only inset if we actually draw the border. Fix alignment issues with DrawSliderThumb dots for example in MediaPlayer volume knobs. Draw using line arrays calling AddLine instead of StrokeLine in several places. DrawMenuBar() extends to draw final pixel which eliminates an extra lines at the end of menu bars. Truncate button labels better fixing a few issues for example keymap keyboard layout button labels. Button insets has been updated a bit to fix drawing issues with buttons missing a border. Using a dynamic_cast to a BButton to determine if a view is a button in BeControlLook didn't work in the case of the keymap label. Look for B_FLAT, B_HOVER, or B_DEFAULT_BUTTON flag in BeControlLook::DrawLabel() to draw the label inverted on click. Pass the B_FLAT flag from Keymap keys when drawing using BControlLook so that the label is inverted. Change-Id: I07631f4b006bdb9aeca2adc9cbdf2da54dae8e92 Reviewed-on: https://review.haiku-os.org/c/haiku/+/2866 Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
2020-06-02 00:15:29 +03:00
\deprecated This should not be used anymore.
\sa BTab::DrawTab()
2014-12-20 03:43:44 +03:00
*/
/*!
\var tab_position B_TAB_FRONT
BeControlLook: Fix app integration drawing issues Update BTab::DrawTab() to pass the current index, the index of the selected tab, and the index of the first and last tabs into BControlLook::DrawActiveTab() and BControlLook::DrawInactiveTab(). This allows you to draw tabs differently in your BTab or BControlLook subclass in many different circumstances. Modify BControlLook API to add indexes to DrawActiveTab() and DrawInactiveTab() like so: void DrawActiveTab(..., int32 index = 0, int32 selected = -1, int32 first = 0, int32 last = 0); void DrawInactiveTab(..., int32 index = 0, int32 selected = -1, int32 first = 0, int32 last = 0); These extra indexes are not used by HaikuControlLook which relies only on if the tab is active or inactive to draw. Add IndexOf(BTab* tab) method to BTabView and document it to get the index of the current tab in BTab::DrawTab(). Also add a warning in the BTabView::DrawTab() method not to use the position and full parameters anymore, use BTabView::IndexOf(), BTabView::Selection(), and BTabView::TabCount() to get the info you need. Using a dynamic_cast to a BTabView in BeControlLook to determine if the view is derived from a BTabView didn't work in the case of WebPositive. Furthermore, WebPositive does custom tab drawing which needed to be updated for alternative control look. These index parameters passed from BTab to BeControlLook allow us to draw the tab like BeOS without relying on a dynamic_cast to BTabView to get the info. Reproduce the functionality described above for BTab in WebPositive's custom tabs. Eliminate no longer needed code in favor of using indexes. Update WebPositive custom tabs to use BControlLook::DrawTabFrame() instead of BControlLook::DrawInactiveTab() matching the update made in BTabView. In BeControlLook::DrawTabFrame() fill rect with base color, WebPositive doesn't draw any tab background, so it expects this work to be done for it. Eliminate hasFrames variable from WebPositive. Rename TabSelected(index) to UpdateSelection(index) in WebPositive to better reflect its purpose. Adjusted HaikuControlLook::DrawInactiveTab() to draw the tab borders more selectively. Only draw border if left border is set for top and bottom tabs or top border is set for left and right tabs. Undo no longer needed frame manipulation border drawing workaround in HaikuControlLook::DrawTabFrame(). Draw scroll bar triangle without using DrawArrowShape(). Unlike in HaikuControlLook, DrawArrowShape() is used to draw arrows in BOutlineListView and menus distinctly from how it draws arrows in scroll bars. Draw our distinct arrows in DrawSrollBarButtons() instead. This fixes overflow of time edit up-down arrows in Clock prefs and the collapse-expand arrow in Deskbar not being vertically centered. In DrawBorders() only inset if we actually draw the border. Fix alignment issues with DrawSliderThumb dots for example in MediaPlayer volume knobs. Draw using line arrays calling AddLine instead of StrokeLine in several places. DrawMenuBar() extends to draw final pixel which eliminates an extra lines at the end of menu bars. Truncate button labels better fixing a few issues for example keymap keyboard layout button labels. Button insets has been updated a bit to fix drawing issues with buttons missing a border. Using a dynamic_cast to a BButton to determine if a view is a button in BeControlLook didn't work in the case of the keymap label. Look for B_FLAT, B_HOVER, or B_DEFAULT_BUTTON flag in BeControlLook::DrawLabel() to draw the label inverted on click. Pass the B_FLAT flag from Keymap keys when drawing using BControlLook so that the label is inverted. Change-Id: I07631f4b006bdb9aeca2adc9cbdf2da54dae8e92 Reviewed-on: https://review.haiku-os.org/c/haiku/+/2866 Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
2020-06-02 00:15:29 +03:00
The selected tab in the tab view.
2014-12-20 03:43:44 +03:00
\since BeOS R3
BeControlLook: Fix app integration drawing issues Update BTab::DrawTab() to pass the current index, the index of the selected tab, and the index of the first and last tabs into BControlLook::DrawActiveTab() and BControlLook::DrawInactiveTab(). This allows you to draw tabs differently in your BTab or BControlLook subclass in many different circumstances. Modify BControlLook API to add indexes to DrawActiveTab() and DrawInactiveTab() like so: void DrawActiveTab(..., int32 index = 0, int32 selected = -1, int32 first = 0, int32 last = 0); void DrawInactiveTab(..., int32 index = 0, int32 selected = -1, int32 first = 0, int32 last = 0); These extra indexes are not used by HaikuControlLook which relies only on if the tab is active or inactive to draw. Add IndexOf(BTab* tab) method to BTabView and document it to get the index of the current tab in BTab::DrawTab(). Also add a warning in the BTabView::DrawTab() method not to use the position and full parameters anymore, use BTabView::IndexOf(), BTabView::Selection(), and BTabView::TabCount() to get the info you need. Using a dynamic_cast to a BTabView in BeControlLook to determine if the view is derived from a BTabView didn't work in the case of WebPositive. Furthermore, WebPositive does custom tab drawing which needed to be updated for alternative control look. These index parameters passed from BTab to BeControlLook allow us to draw the tab like BeOS without relying on a dynamic_cast to BTabView to get the info. Reproduce the functionality described above for BTab in WebPositive's custom tabs. Eliminate no longer needed code in favor of using indexes. Update WebPositive custom tabs to use BControlLook::DrawTabFrame() instead of BControlLook::DrawInactiveTab() matching the update made in BTabView. In BeControlLook::DrawTabFrame() fill rect with base color, WebPositive doesn't draw any tab background, so it expects this work to be done for it. Eliminate hasFrames variable from WebPositive. Rename TabSelected(index) to UpdateSelection(index) in WebPositive to better reflect its purpose. Adjusted HaikuControlLook::DrawInactiveTab() to draw the tab borders more selectively. Only draw border if left border is set for top and bottom tabs or top border is set for left and right tabs. Undo no longer needed frame manipulation border drawing workaround in HaikuControlLook::DrawTabFrame(). Draw scroll bar triangle without using DrawArrowShape(). Unlike in HaikuControlLook, DrawArrowShape() is used to draw arrows in BOutlineListView and menus distinctly from how it draws arrows in scroll bars. Draw our distinct arrows in DrawSrollBarButtons() instead. This fixes overflow of time edit up-down arrows in Clock prefs and the collapse-expand arrow in Deskbar not being vertically centered. In DrawBorders() only inset if we actually draw the border. Fix alignment issues with DrawSliderThumb dots for example in MediaPlayer volume knobs. Draw using line arrays calling AddLine instead of StrokeLine in several places. DrawMenuBar() extends to draw final pixel which eliminates an extra lines at the end of menu bars. Truncate button labels better fixing a few issues for example keymap keyboard layout button labels. Button insets has been updated a bit to fix drawing issues with buttons missing a border. Using a dynamic_cast to a BButton to determine if a view is a button in BeControlLook didn't work in the case of the keymap label. Look for B_FLAT, B_HOVER, or B_DEFAULT_BUTTON flag in BeControlLook::DrawLabel() to draw the label inverted on click. Pass the B_FLAT flag from Keymap keys when drawing using BControlLook so that the label is inverted. Change-Id: I07631f4b006bdb9aeca2adc9cbdf2da54dae8e92 Reviewed-on: https://review.haiku-os.org/c/haiku/+/2866 Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
2020-06-02 00:15:29 +03:00
\deprecated This should not be used anymore.
\sa BTab::DrawTab()
2014-12-20 03:43:44 +03:00
*/
/*!
\var tab_position B_TAB_ANY
BeControlLook: Fix app integration drawing issues Update BTab::DrawTab() to pass the current index, the index of the selected tab, and the index of the first and last tabs into BControlLook::DrawActiveTab() and BControlLook::DrawInactiveTab(). This allows you to draw tabs differently in your BTab or BControlLook subclass in many different circumstances. Modify BControlLook API to add indexes to DrawActiveTab() and DrawInactiveTab() like so: void DrawActiveTab(..., int32 index = 0, int32 selected = -1, int32 first = 0, int32 last = 0); void DrawInactiveTab(..., int32 index = 0, int32 selected = -1, int32 first = 0, int32 last = 0); These extra indexes are not used by HaikuControlLook which relies only on if the tab is active or inactive to draw. Add IndexOf(BTab* tab) method to BTabView and document it to get the index of the current tab in BTab::DrawTab(). Also add a warning in the BTabView::DrawTab() method not to use the position and full parameters anymore, use BTabView::IndexOf(), BTabView::Selection(), and BTabView::TabCount() to get the info you need. Using a dynamic_cast to a BTabView in BeControlLook to determine if the view is derived from a BTabView didn't work in the case of WebPositive. Furthermore, WebPositive does custom tab drawing which needed to be updated for alternative control look. These index parameters passed from BTab to BeControlLook allow us to draw the tab like BeOS without relying on a dynamic_cast to BTabView to get the info. Reproduce the functionality described above for BTab in WebPositive's custom tabs. Eliminate no longer needed code in favor of using indexes. Update WebPositive custom tabs to use BControlLook::DrawTabFrame() instead of BControlLook::DrawInactiveTab() matching the update made in BTabView. In BeControlLook::DrawTabFrame() fill rect with base color, WebPositive doesn't draw any tab background, so it expects this work to be done for it. Eliminate hasFrames variable from WebPositive. Rename TabSelected(index) to UpdateSelection(index) in WebPositive to better reflect its purpose. Adjusted HaikuControlLook::DrawInactiveTab() to draw the tab borders more selectively. Only draw border if left border is set for top and bottom tabs or top border is set for left and right tabs. Undo no longer needed frame manipulation border drawing workaround in HaikuControlLook::DrawTabFrame(). Draw scroll bar triangle without using DrawArrowShape(). Unlike in HaikuControlLook, DrawArrowShape() is used to draw arrows in BOutlineListView and menus distinctly from how it draws arrows in scroll bars. Draw our distinct arrows in DrawSrollBarButtons() instead. This fixes overflow of time edit up-down arrows in Clock prefs and the collapse-expand arrow in Deskbar not being vertically centered. In DrawBorders() only inset if we actually draw the border. Fix alignment issues with DrawSliderThumb dots for example in MediaPlayer volume knobs. Draw using line arrays calling AddLine instead of StrokeLine in several places. DrawMenuBar() extends to draw final pixel which eliminates an extra lines at the end of menu bars. Truncate button labels better fixing a few issues for example keymap keyboard layout button labels. Button insets has been updated a bit to fix drawing issues with buttons missing a border. Using a dynamic_cast to a BButton to determine if a view is a button in BeControlLook didn't work in the case of the keymap label. Look for B_FLAT, B_HOVER, or B_DEFAULT_BUTTON flag in BeControlLook::DrawLabel() to draw the label inverted on click. Pass the B_FLAT flag from Keymap keys when drawing using BControlLook so that the label is inverted. Change-Id: I07631f4b006bdb9aeca2adc9cbdf2da54dae8e92 Reviewed-on: https://review.haiku-os.org/c/haiku/+/2866 Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
2020-06-02 00:15:29 +03:00
Any tab in the tab view that is not the first or selected tab.
2014-12-20 03:43:44 +03:00
\since BeOS R3
BeControlLook: Fix app integration drawing issues Update BTab::DrawTab() to pass the current index, the index of the selected tab, and the index of the first and last tabs into BControlLook::DrawActiveTab() and BControlLook::DrawInactiveTab(). This allows you to draw tabs differently in your BTab or BControlLook subclass in many different circumstances. Modify BControlLook API to add indexes to DrawActiveTab() and DrawInactiveTab() like so: void DrawActiveTab(..., int32 index = 0, int32 selected = -1, int32 first = 0, int32 last = 0); void DrawInactiveTab(..., int32 index = 0, int32 selected = -1, int32 first = 0, int32 last = 0); These extra indexes are not used by HaikuControlLook which relies only on if the tab is active or inactive to draw. Add IndexOf(BTab* tab) method to BTabView and document it to get the index of the current tab in BTab::DrawTab(). Also add a warning in the BTabView::DrawTab() method not to use the position and full parameters anymore, use BTabView::IndexOf(), BTabView::Selection(), and BTabView::TabCount() to get the info you need. Using a dynamic_cast to a BTabView in BeControlLook to determine if the view is derived from a BTabView didn't work in the case of WebPositive. Furthermore, WebPositive does custom tab drawing which needed to be updated for alternative control look. These index parameters passed from BTab to BeControlLook allow us to draw the tab like BeOS without relying on a dynamic_cast to BTabView to get the info. Reproduce the functionality described above for BTab in WebPositive's custom tabs. Eliminate no longer needed code in favor of using indexes. Update WebPositive custom tabs to use BControlLook::DrawTabFrame() instead of BControlLook::DrawInactiveTab() matching the update made in BTabView. In BeControlLook::DrawTabFrame() fill rect with base color, WebPositive doesn't draw any tab background, so it expects this work to be done for it. Eliminate hasFrames variable from WebPositive. Rename TabSelected(index) to UpdateSelection(index) in WebPositive to better reflect its purpose. Adjusted HaikuControlLook::DrawInactiveTab() to draw the tab borders more selectively. Only draw border if left border is set for top and bottom tabs or top border is set for left and right tabs. Undo no longer needed frame manipulation border drawing workaround in HaikuControlLook::DrawTabFrame(). Draw scroll bar triangle without using DrawArrowShape(). Unlike in HaikuControlLook, DrawArrowShape() is used to draw arrows in BOutlineListView and menus distinctly from how it draws arrows in scroll bars. Draw our distinct arrows in DrawSrollBarButtons() instead. This fixes overflow of time edit up-down arrows in Clock prefs and the collapse-expand arrow in Deskbar not being vertically centered. In DrawBorders() only inset if we actually draw the border. Fix alignment issues with DrawSliderThumb dots for example in MediaPlayer volume knobs. Draw using line arrays calling AddLine instead of StrokeLine in several places. DrawMenuBar() extends to draw final pixel which eliminates an extra lines at the end of menu bars. Truncate button labels better fixing a few issues for example keymap keyboard layout button labels. Button insets has been updated a bit to fix drawing issues with buttons missing a border. Using a dynamic_cast to a BButton to determine if a view is a button in BeControlLook didn't work in the case of the keymap label. Look for B_FLAT, B_HOVER, or B_DEFAULT_BUTTON flag in BeControlLook::DrawLabel() to draw the label inverted on click. Pass the B_FLAT flag from Keymap keys when drawing using BControlLook so that the label is inverted. Change-Id: I07631f4b006bdb9aeca2adc9cbdf2da54dae8e92 Reviewed-on: https://review.haiku-os.org/c/haiku/+/2866 Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
2020-06-02 00:15:29 +03:00
\deprecated This should not be used anymore.
\sa BTab::DrawTab()
2014-12-20 03:43:44 +03:00
*/
/*!
\class BTab
\ingroup interface
\ingroup libbe
2014-12-20 03:58:14 +03:00
\brief A tab that goes in a BTabView.
2014-12-20 03:43:44 +03:00
\since BeOS R3
*/
/*!
\fn BTab::BTab(BView* contentsView)
2014-12-20 03:43:44 +03:00
\brief Initializes a new BTab object as part of a \a tabView.
The BTab is enabled, but not selected nor the current focus. \a contentsView
2014-12-20 03:43:44 +03:00
is set as the tab's target view -- when the tab is selected, its target
view is activated.
\since BeOS R3
*/
/*!
\fn BTab::BTab(BMessage* archive)
\brief Archive Constructor.
\since BeOS R3
*/
/*!
\fn BTab::~BTab()
\brief Destructor.
*/
/*!
\fn BArchivable* BTab::Instantiate(BMessage* archive)
\brief Instantiates a BTab object from the passed in \a archive.
\since BeOS R3
*/
/*!
\fn status_t BTab::Archive(BMessage* data, bool deep) const
\brief Archives the object into the \a data message.
\param data A pointer to the BMessage object to archive the object into.
\param deep Whether or not to archive child views as well.
\return A status code, \c B_OK if everything went well or an error code
otherwise.
\retval B_OK The object was archived.
\retval B_NO_MEMORY Ran out of memory while archiving the object.
\since BeOS R3
*/
/*!
\fn status_t BTab::Perform(uint32 d, void* arg)
\brief Perform some action. (Internal Method)
\since BeOS R3
*/
/*!
\fn const char* BTab::Label() const
\brief Returns the tab's label (the target view's name).
2014-12-20 03:43:44 +03:00
\since BeOS R3
*/
/*!
\fn void BTab::SetLabel(const char* label)
\brief Sets the target view's name, and updates the BTab accordingly.
2014-12-20 03:43:44 +03:00
\since BeOS R3
*/
/*!
\class BTabView
\ingroup interface
\ingroup libbe
\brief A container for BTab objects to display all tabs.
2014-12-20 03:43:44 +03:00
\since BeOS R3
*/
/*!
\fn bool BTab::IsSelected() const
\brief Returns whether or not the tab is selected.
\since BeOS R3
*/
/*!
\fn void BTab::Select(BView* owner)
\brief Called by the BTabView when the tab is selected.
2014-12-20 03:43:44 +03:00
\param owner The view that the tab's view should be owned by.
2014-12-20 03:43:44 +03:00
\since BeOS R3
*/
/*!
\fn void BTab::Deselect()
\brief Called by the BTabView when the tab is de-selected.
2014-12-20 03:43:44 +03:00
\since BeOS R3
*/
/*!
\fn void BTab::SetEnabled(bool enable)
\brief Enables or disables the tab.
\since BeOS R3
*/
/*!
\fn bool BTab::IsEnabled() const
\brief Returns whether or not the tab is enabled.
*/
/*!
\fn void BTab::MakeFocus(bool focus)
\brief Makes the tab the window's focus view or removes it.
\since BeOS R3
*/
/*!
\fn bool BTab::IsFocus() const
\brief Returns whether or not the tab is the window's focus view.
*/
/*!
\fn void BTab::SetView(BView* view)
\brief Sets the view to be displayed for this tab.
*/
/*!
\fn BView* BTab::View() const
\brief Returns a pointer to the view to be displayed for this tab.
*/
/*!
\fn void BTab::DrawFocusMark(BView* owner, BRect frame)
\brief Draws the mark indicating that the BTab object is in focus.
This consists of a blue line drawn across the bottom of the tab frame
by default.
\since BeOS R3
*/
/*!
\fn void BTab::DrawLabel(BView* owner, BRect frame)
\brief Draws the tab's title.
\since BeOS R3
*/
/*!
\fn void BTab::DrawTab(BView* owner, BRect frame, tab_position position,
bool full)
BeControlLook: Fix app integration drawing issues Update BTab::DrawTab() to pass the current index, the index of the selected tab, and the index of the first and last tabs into BControlLook::DrawActiveTab() and BControlLook::DrawInactiveTab(). This allows you to draw tabs differently in your BTab or BControlLook subclass in many different circumstances. Modify BControlLook API to add indexes to DrawActiveTab() and DrawInactiveTab() like so: void DrawActiveTab(..., int32 index = 0, int32 selected = -1, int32 first = 0, int32 last = 0); void DrawInactiveTab(..., int32 index = 0, int32 selected = -1, int32 first = 0, int32 last = 0); These extra indexes are not used by HaikuControlLook which relies only on if the tab is active or inactive to draw. Add IndexOf(BTab* tab) method to BTabView and document it to get the index of the current tab in BTab::DrawTab(). Also add a warning in the BTabView::DrawTab() method not to use the position and full parameters anymore, use BTabView::IndexOf(), BTabView::Selection(), and BTabView::TabCount() to get the info you need. Using a dynamic_cast to a BTabView in BeControlLook to determine if the view is derived from a BTabView didn't work in the case of WebPositive. Furthermore, WebPositive does custom tab drawing which needed to be updated for alternative control look. These index parameters passed from BTab to BeControlLook allow us to draw the tab like BeOS without relying on a dynamic_cast to BTabView to get the info. Reproduce the functionality described above for BTab in WebPositive's custom tabs. Eliminate no longer needed code in favor of using indexes. Update WebPositive custom tabs to use BControlLook::DrawTabFrame() instead of BControlLook::DrawInactiveTab() matching the update made in BTabView. In BeControlLook::DrawTabFrame() fill rect with base color, WebPositive doesn't draw any tab background, so it expects this work to be done for it. Eliminate hasFrames variable from WebPositive. Rename TabSelected(index) to UpdateSelection(index) in WebPositive to better reflect its purpose. Adjusted HaikuControlLook::DrawInactiveTab() to draw the tab borders more selectively. Only draw border if left border is set for top and bottom tabs or top border is set for left and right tabs. Undo no longer needed frame manipulation border drawing workaround in HaikuControlLook::DrawTabFrame(). Draw scroll bar triangle without using DrawArrowShape(). Unlike in HaikuControlLook, DrawArrowShape() is used to draw arrows in BOutlineListView and menus distinctly from how it draws arrows in scroll bars. Draw our distinct arrows in DrawSrollBarButtons() instead. This fixes overflow of time edit up-down arrows in Clock prefs and the collapse-expand arrow in Deskbar not being vertically centered. In DrawBorders() only inset if we actually draw the border. Fix alignment issues with DrawSliderThumb dots for example in MediaPlayer volume knobs. Draw using line arrays calling AddLine instead of StrokeLine in several places. DrawMenuBar() extends to draw final pixel which eliminates an extra lines at the end of menu bars. Truncate button labels better fixing a few issues for example keymap keyboard layout button labels. Button insets has been updated a bit to fix drawing issues with buttons missing a border. Using a dynamic_cast to a BButton to determine if a view is a button in BeControlLook didn't work in the case of the keymap label. Look for B_FLAT, B_HOVER, or B_DEFAULT_BUTTON flag in BeControlLook::DrawLabel() to draw the label inverted on click. Pass the B_FLAT flag from Keymap keys when drawing using BControlLook so that the label is inverted. Change-Id: I07631f4b006bdb9aeca2adc9cbdf2da54dae8e92 Reviewed-on: https://review.haiku-os.org/c/haiku/+/2866 Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
2020-06-02 00:15:29 +03:00
\brief Draws the tab and label according to \a position and \a full.
2014-12-20 03:43:44 +03:00
BeControlLook: Fix app integration drawing issues Update BTab::DrawTab() to pass the current index, the index of the selected tab, and the index of the first and last tabs into BControlLook::DrawActiveTab() and BControlLook::DrawInactiveTab(). This allows you to draw tabs differently in your BTab or BControlLook subclass in many different circumstances. Modify BControlLook API to add indexes to DrawActiveTab() and DrawInactiveTab() like so: void DrawActiveTab(..., int32 index = 0, int32 selected = -1, int32 first = 0, int32 last = 0); void DrawInactiveTab(..., int32 index = 0, int32 selected = -1, int32 first = 0, int32 last = 0); These extra indexes are not used by HaikuControlLook which relies only on if the tab is active or inactive to draw. Add IndexOf(BTab* tab) method to BTabView and document it to get the index of the current tab in BTab::DrawTab(). Also add a warning in the BTabView::DrawTab() method not to use the position and full parameters anymore, use BTabView::IndexOf(), BTabView::Selection(), and BTabView::TabCount() to get the info you need. Using a dynamic_cast to a BTabView in BeControlLook to determine if the view is derived from a BTabView didn't work in the case of WebPositive. Furthermore, WebPositive does custom tab drawing which needed to be updated for alternative control look. These index parameters passed from BTab to BeControlLook allow us to draw the tab like BeOS without relying on a dynamic_cast to BTabView to get the info. Reproduce the functionality described above for BTab in WebPositive's custom tabs. Eliminate no longer needed code in favor of using indexes. Update WebPositive custom tabs to use BControlLook::DrawTabFrame() instead of BControlLook::DrawInactiveTab() matching the update made in BTabView. In BeControlLook::DrawTabFrame() fill rect with base color, WebPositive doesn't draw any tab background, so it expects this work to be done for it. Eliminate hasFrames variable from WebPositive. Rename TabSelected(index) to UpdateSelection(index) in WebPositive to better reflect its purpose. Adjusted HaikuControlLook::DrawInactiveTab() to draw the tab borders more selectively. Only draw border if left border is set for top and bottom tabs or top border is set for left and right tabs. Undo no longer needed frame manipulation border drawing workaround in HaikuControlLook::DrawTabFrame(). Draw scroll bar triangle without using DrawArrowShape(). Unlike in HaikuControlLook, DrawArrowShape() is used to draw arrows in BOutlineListView and menus distinctly from how it draws arrows in scroll bars. Draw our distinct arrows in DrawSrollBarButtons() instead. This fixes overflow of time edit up-down arrows in Clock prefs and the collapse-expand arrow in Deskbar not being vertically centered. In DrawBorders() only inset if we actually draw the border. Fix alignment issues with DrawSliderThumb dots for example in MediaPlayer volume knobs. Draw using line arrays calling AddLine instead of StrokeLine in several places. DrawMenuBar() extends to draw final pixel which eliminates an extra lines at the end of menu bars. Truncate button labels better fixing a few issues for example keymap keyboard layout button labels. Button insets has been updated a bit to fix drawing issues with buttons missing a border. Using a dynamic_cast to a BButton to determine if a view is a button in BeControlLook didn't work in the case of the keymap label. Look for B_FLAT, B_HOVER, or B_DEFAULT_BUTTON flag in BeControlLook::DrawLabel() to draw the label inverted on click. Pass the B_FLAT flag from Keymap keys when drawing using BControlLook so that the label is inverted. Change-Id: I07631f4b006bdb9aeca2adc9cbdf2da54dae8e92 Reviewed-on: https://review.haiku-os.org/c/haiku/+/2866 Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
2020-06-02 00:15:29 +03:00
This method draws the tab, then draws the tab's title by calling
DrawLabel(). The \a position of the tab may affect how the tab is
2020-10-12 06:50:11 +03:00
rendered -- for example the first tab may have a different appearance
BeControlLook: Fix app integration drawing issues Update BTab::DrawTab() to pass the current index, the index of the selected tab, and the index of the first and last tabs into BControlLook::DrawActiveTab() and BControlLook::DrawInactiveTab(). This allows you to draw tabs differently in your BTab or BControlLook subclass in many different circumstances. Modify BControlLook API to add indexes to DrawActiveTab() and DrawInactiveTab() like so: void DrawActiveTab(..., int32 index = 0, int32 selected = -1, int32 first = 0, int32 last = 0); void DrawInactiveTab(..., int32 index = 0, int32 selected = -1, int32 first = 0, int32 last = 0); These extra indexes are not used by HaikuControlLook which relies only on if the tab is active or inactive to draw. Add IndexOf(BTab* tab) method to BTabView and document it to get the index of the current tab in BTab::DrawTab(). Also add a warning in the BTabView::DrawTab() method not to use the position and full parameters anymore, use BTabView::IndexOf(), BTabView::Selection(), and BTabView::TabCount() to get the info you need. Using a dynamic_cast to a BTabView in BeControlLook to determine if the view is derived from a BTabView didn't work in the case of WebPositive. Furthermore, WebPositive does custom tab drawing which needed to be updated for alternative control look. These index parameters passed from BTab to BeControlLook allow us to draw the tab like BeOS without relying on a dynamic_cast to BTabView to get the info. Reproduce the functionality described above for BTab in WebPositive's custom tabs. Eliminate no longer needed code in favor of using indexes. Update WebPositive custom tabs to use BControlLook::DrawTabFrame() instead of BControlLook::DrawInactiveTab() matching the update made in BTabView. In BeControlLook::DrawTabFrame() fill rect with base color, WebPositive doesn't draw any tab background, so it expects this work to be done for it. Eliminate hasFrames variable from WebPositive. Rename TabSelected(index) to UpdateSelection(index) in WebPositive to better reflect its purpose. Adjusted HaikuControlLook::DrawInactiveTab() to draw the tab borders more selectively. Only draw border if left border is set for top and bottom tabs or top border is set for left and right tabs. Undo no longer needed frame manipulation border drawing workaround in HaikuControlLook::DrawTabFrame(). Draw scroll bar triangle without using DrawArrowShape(). Unlike in HaikuControlLook, DrawArrowShape() is used to draw arrows in BOutlineListView and menus distinctly from how it draws arrows in scroll bars. Draw our distinct arrows in DrawSrollBarButtons() instead. This fixes overflow of time edit up-down arrows in Clock prefs and the collapse-expand arrow in Deskbar not being vertically centered. In DrawBorders() only inset if we actually draw the border. Fix alignment issues with DrawSliderThumb dots for example in MediaPlayer volume knobs. Draw using line arrays calling AddLine instead of StrokeLine in several places. DrawMenuBar() extends to draw final pixel which eliminates an extra lines at the end of menu bars. Truncate button labels better fixing a few issues for example keymap keyboard layout button labels. Button insets has been updated a bit to fix drawing issues with buttons missing a border. Using a dynamic_cast to a BButton to determine if a view is a button in BeControlLook didn't work in the case of the keymap label. Look for B_FLAT, B_HOVER, or B_DEFAULT_BUTTON flag in BeControlLook::DrawLabel() to draw the label inverted on click. Pass the B_FLAT flag from Keymap keys when drawing using BControlLook so that the label is inverted. Change-Id: I07631f4b006bdb9aeca2adc9cbdf2da54dae8e92 Reviewed-on: https://review.haiku-os.org/c/haiku/+/2866 Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
2020-06-02 00:15:29 +03:00
than the other tabs. You may override this method to draw tabs
differently in your BTab subclass.
2014-12-20 03:43:44 +03:00
\param owner The view that owns the tab.
\param frame The frame rectangle to draw in.
\param position May affect how the tab is rendered. Choices include:
BeControlLook: Fix app integration drawing issues Update BTab::DrawTab() to pass the current index, the index of the selected tab, and the index of the first and last tabs into BControlLook::DrawActiveTab() and BControlLook::DrawInactiveTab(). This allows you to draw tabs differently in your BTab or BControlLook subclass in many different circumstances. Modify BControlLook API to add indexes to DrawActiveTab() and DrawInactiveTab() like so: void DrawActiveTab(..., int32 index = 0, int32 selected = -1, int32 first = 0, int32 last = 0); void DrawInactiveTab(..., int32 index = 0, int32 selected = -1, int32 first = 0, int32 last = 0); These extra indexes are not used by HaikuControlLook which relies only on if the tab is active or inactive to draw. Add IndexOf(BTab* tab) method to BTabView and document it to get the index of the current tab in BTab::DrawTab(). Also add a warning in the BTabView::DrawTab() method not to use the position and full parameters anymore, use BTabView::IndexOf(), BTabView::Selection(), and BTabView::TabCount() to get the info you need. Using a dynamic_cast to a BTabView in BeControlLook to determine if the view is derived from a BTabView didn't work in the case of WebPositive. Furthermore, WebPositive does custom tab drawing which needed to be updated for alternative control look. These index parameters passed from BTab to BeControlLook allow us to draw the tab like BeOS without relying on a dynamic_cast to BTabView to get the info. Reproduce the functionality described above for BTab in WebPositive's custom tabs. Eliminate no longer needed code in favor of using indexes. Update WebPositive custom tabs to use BControlLook::DrawTabFrame() instead of BControlLook::DrawInactiveTab() matching the update made in BTabView. In BeControlLook::DrawTabFrame() fill rect with base color, WebPositive doesn't draw any tab background, so it expects this work to be done for it. Eliminate hasFrames variable from WebPositive. Rename TabSelected(index) to UpdateSelection(index) in WebPositive to better reflect its purpose. Adjusted HaikuControlLook::DrawInactiveTab() to draw the tab borders more selectively. Only draw border if left border is set for top and bottom tabs or top border is set for left and right tabs. Undo no longer needed frame manipulation border drawing workaround in HaikuControlLook::DrawTabFrame(). Draw scroll bar triangle without using DrawArrowShape(). Unlike in HaikuControlLook, DrawArrowShape() is used to draw arrows in BOutlineListView and menus distinctly from how it draws arrows in scroll bars. Draw our distinct arrows in DrawSrollBarButtons() instead. This fixes overflow of time edit up-down arrows in Clock prefs and the collapse-expand arrow in Deskbar not being vertically centered. In DrawBorders() only inset if we actually draw the border. Fix alignment issues with DrawSliderThumb dots for example in MediaPlayer volume knobs. Draw using line arrays calling AddLine instead of StrokeLine in several places. DrawMenuBar() extends to draw final pixel which eliminates an extra lines at the end of menu bars. Truncate button labels better fixing a few issues for example keymap keyboard layout button labels. Button insets has been updated a bit to fix drawing issues with buttons missing a border. Using a dynamic_cast to a BButton to determine if a view is a button in BeControlLook didn't work in the case of the keymap label. Look for B_FLAT, B_HOVER, or B_DEFAULT_BUTTON flag in BeControlLook::DrawLabel() to draw the label inverted on click. Pass the B_FLAT flag from Keymap keys when drawing using BControlLook so that the label is inverted. Change-Id: I07631f4b006bdb9aeca2adc9cbdf2da54dae8e92 Reviewed-on: https://review.haiku-os.org/c/haiku/+/2866 Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
2020-06-02 00:15:29 +03:00
- \c B_TAB_FIRST The first tab
- \c B_TAB_FRONT The selected or active tab
- \c B_TAB_ANY Tab that is not first or front
\param full Whether or not to completely draw the tab. All tabs were full
except for the tab before the selected tab on BeOS R5.
\warning The \a position and \a full parameters should no longer be used.
This information can be gathered from BTabView by calling the
BTabView::IndexOf(), BTabView::Selection(), and
BTabView::CountTabs() methods.
2014-12-20 03:43:44 +03:00
\since BeOS R3
*/
/*!
\fn BTabView::BTabView(const char* name, button_width width, uint32 flags)
\brief Initializes a new BTabView object for use as part of a BLayout.
\param name The name of the tab view.
\param width The tab width flag to use. Options include:
- \c B_WIDTH_AS_USUAL
- \c B_WIDTH_FROM_WIDEST
- \c B_WIDTH_FROM_LABEL
\param flags \a flags passed to BView.
\since Haiku R1
*/
/*!
\fn BTabView::BTabView(BRect frame, const char* name, button_width width,
uint32 resizeMask, uint32 flags)
\brief Initializes a new BTabView object.
\param frame The frame rectangle.
\param name The name of the tab view.
\param width The tab width flag to use. Options include:
- \c B_WIDTH_AS_USUAL
- \c B_WIDTH_FROM_WIDEST
- \c B_WIDTH_FROM_LABEL
\param resizeMask Resizing mask, passed to BView.
\param flags \a flags passed to BView.
\since BeOS R3
*/
/*!
\fn BTabView::BTabView(BMessage* archive)
\brief Creates a BTabView object from the passed in \a archive.
\since BeOS R3
*/
/*!
\fn BTabView::~BTabView()
\brief Frees the memory allocated by each tab then destroys the object.
\since BeOS R3
*/
/*!
\name Archiving
*/
//! @{
/*!
\fn BArchivable* BTabView::Instantiate(BMessage* archive)
\brief Instantiates a BTabView object from the passed in \a archive.
\since BeOS R3
*/
/*!
\fn status_t BTabView::Archive(BMessage* data, bool deep) const
\brief Archives the object into the \a data message.
\param data A pointer to the BMessage object to archive the object into.
\param deep Whether or not to archive child views as well.
\return A status code, \c B_OK if everything went well or an error code
otherwise.
\retval B_OK The object was archived.
\retval B_NO_MEMORY Ran out of memory while archiving the object.
\since BeOS R3
*/
/*!
\fn status_t BTabView::AllUnarchived(const BMessage* from)
\brief Hook method called when all views have been unarchived.
\copydetails BView::AllUnarchived()
*/
//! @}
/*!
\fn status_t BTabView::Perform(perform_code code, void* _data)
\brief Perform some action. (Internal Method)
*/
/*!
\name Hook Methods
*/
//! @{
/*!
\fn void BTabView::AllAttached()
\copydoc BView::AllAttached()
*/
/*!
\fn void BTabView::AllDetached()
\copydoc BView::AllDetached()
*/
/*!
\fn void BTabView::AttachedToWindow()
\copydoc BView::AttachedToWindow()
*/
/*!
\fn void BTabView::DetachedFromWindow()
\copydoc BView::DetachedFromWindow()
*/
/*!
\fn void BTabView::Draw(BRect updateRect)
\brief Draws the focus tab and the tab view frame.
\since BeOS R3
*/
/*!
\fn BRect BTabView::DrawTabs()
\brief Draws all the tabs in the BTabView and returns the frame rectangle
of the currently selected tab.
\since BeOS R3
*/
/*!
\fn void BTabView::DrawBox(BRect selectedTabRect)
2014-12-20 03:43:44 +03:00
\brief Draws the box that encloses the container view.
\param selectedTabRect The frame rectangle of the currently selected tab.
2014-12-20 03:43:44 +03:00
\since BeOS R3
*/
/*!
\fn void BTabView::FrameResized(float newWidth, float newHeight)
\copydoc BView::FrameResized()
*/
/*!
\fn void BTabView::KeyDown(const char* bytes, int32 numBytes)
\brief Handles keyboard navigation for the BTabView.
Down and left arrow keys move the focus tab left, up and right
arrow keys move the focus tab right. The space bar and enter keys
select the currently focused tab.
\sa BView::KeyDown()
\since BeOS R3
*/
/*!
\fn void BTabView::MessageReceived(BMessage* message)
\brief Handles scripting messages for the tab view.
\copydetails BView::MessageReceived()
*/
/*!
\fn void BTabView::MouseDown(BPoint where)
\brief Selects the tab that the user clicked on (if any).
\sa BView::MouseDown()
\since BeOS R3
*/
/*!
\fn void BTabView::MouseUp(BPoint where)
\copydoc BView::MouseUp()
*/
/*!
\fn void BTabView::MouseMoved(BPoint where, uint32 code,
const BMessage* dragMessage)
\copydoc BView::MouseMoved()
*/
/*!
\fn void BTabView::Pulse()
\copydoc BView::Pulse()
*/
/*!
\fn void BTabView::Select(int32 index)
\brief Selects the tab at the given \a index making it the selected tab.
\param index The zero-based tab index of the tab to select.
\since BeOS R3
*/
/*!
\fn int32 BTabView::Selection() const
BeControlLook: Fix app integration drawing issues Update BTab::DrawTab() to pass the current index, the index of the selected tab, and the index of the first and last tabs into BControlLook::DrawActiveTab() and BControlLook::DrawInactiveTab(). This allows you to draw tabs differently in your BTab or BControlLook subclass in many different circumstances. Modify BControlLook API to add indexes to DrawActiveTab() and DrawInactiveTab() like so: void DrawActiveTab(..., int32 index = 0, int32 selected = -1, int32 first = 0, int32 last = 0); void DrawInactiveTab(..., int32 index = 0, int32 selected = -1, int32 first = 0, int32 last = 0); These extra indexes are not used by HaikuControlLook which relies only on if the tab is active or inactive to draw. Add IndexOf(BTab* tab) method to BTabView and document it to get the index of the current tab in BTab::DrawTab(). Also add a warning in the BTabView::DrawTab() method not to use the position and full parameters anymore, use BTabView::IndexOf(), BTabView::Selection(), and BTabView::TabCount() to get the info you need. Using a dynamic_cast to a BTabView in BeControlLook to determine if the view is derived from a BTabView didn't work in the case of WebPositive. Furthermore, WebPositive does custom tab drawing which needed to be updated for alternative control look. These index parameters passed from BTab to BeControlLook allow us to draw the tab like BeOS without relying on a dynamic_cast to BTabView to get the info. Reproduce the functionality described above for BTab in WebPositive's custom tabs. Eliminate no longer needed code in favor of using indexes. Update WebPositive custom tabs to use BControlLook::DrawTabFrame() instead of BControlLook::DrawInactiveTab() matching the update made in BTabView. In BeControlLook::DrawTabFrame() fill rect with base color, WebPositive doesn't draw any tab background, so it expects this work to be done for it. Eliminate hasFrames variable from WebPositive. Rename TabSelected(index) to UpdateSelection(index) in WebPositive to better reflect its purpose. Adjusted HaikuControlLook::DrawInactiveTab() to draw the tab borders more selectively. Only draw border if left border is set for top and bottom tabs or top border is set for left and right tabs. Undo no longer needed frame manipulation border drawing workaround in HaikuControlLook::DrawTabFrame(). Draw scroll bar triangle without using DrawArrowShape(). Unlike in HaikuControlLook, DrawArrowShape() is used to draw arrows in BOutlineListView and menus distinctly from how it draws arrows in scroll bars. Draw our distinct arrows in DrawSrollBarButtons() instead. This fixes overflow of time edit up-down arrows in Clock prefs and the collapse-expand arrow in Deskbar not being vertically centered. In DrawBorders() only inset if we actually draw the border. Fix alignment issues with DrawSliderThumb dots for example in MediaPlayer volume knobs. Draw using line arrays calling AddLine instead of StrokeLine in several places. DrawMenuBar() extends to draw final pixel which eliminates an extra lines at the end of menu bars. Truncate button labels better fixing a few issues for example keymap keyboard layout button labels. Button insets has been updated a bit to fix drawing issues with buttons missing a border. Using a dynamic_cast to a BButton to determine if a view is a button in BeControlLook didn't work in the case of the keymap label. Look for B_FLAT, B_HOVER, or B_DEFAULT_BUTTON flag in BeControlLook::DrawLabel() to draw the label inverted on click. Pass the B_FLAT flag from Keymap keys when drawing using BControlLook so that the label is inverted. Change-Id: I07631f4b006bdb9aeca2adc9cbdf2da54dae8e92 Reviewed-on: https://review.haiku-os.org/c/haiku/+/2866 Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
2020-06-02 00:15:29 +03:00
\brief Returns the index of the selected tab or -1 if not found.
2014-12-20 03:43:44 +03:00
\since BeOS R3
*/
/*!
\fn void BTabView::WindowActivated(bool active)
\copydoc BView::WindowActivated()
*/
//! @}
/*!
\fn void BTabView::MakeFocus(bool focus)
\brief Highlight or unhighlight the selection when the tab view acquires
or loses its focus state.
\copydetails BView::MakeFocus()
*/
/*!
\fn void BTabView::SetFocusTab(int32 tab, bool focus)
\brief Sets the focus state of the specified \a tab.
\param tab The index of the tab to set the focus state of.
\param focus \c true to set focus, \c false to remove it.
\since BeOS R3
*/
/*!
\fn int32 BTabView::FocusTab() const
\brief Returns the index of the current focus tab.
\since BeOS R3
*/
/*!
\fn BRect BTabView::TabFrame(int32 index) const
\brief Returns the frame rectangle of the tab at the specified \a index.
\since BeOS R3
*/
/*!
\fn void BTabView::SetFlags(uint32 flags)
\copydoc BView::SetFlags()
*/
/*!
\fn void BTabView::SetResizingMode(uint32 mode)
\copydoc BView::SetResizingMode()
*/
/*!
\fn void BTabView::ResizeToPreferred()
\copydoc BView::ResizeToPreferred()
*/
/*!
\fn void BTabView::GetPreferredSize(float* _width, float* _height)
\copydoc BView::GetPreferredSize()
*/
/*!
\fn BSize BTabView::MinSize()
\brief Returns the tab view's minimum size in a BLayout.
\since Haiku R1
*/
/*!
\fn BSize BTabView::MaxSize()
\brief Returns the tab view's maximum size in a BLayout.
\since Haiku R1
*/
/*!
\fn BSize BTabView::PreferredSize()
\brief Returns the tab view's preferred size in a BLayout.
\since Haiku R1
*/
/*!
\fn void BTabView::FrameMoved(BPoint newPosition)
\copydoc BView::FrameMoved()
*/
/*!
\fn void BTabView::FrameResized(float newWidth, float newHeight)
\copydoc BView::FrameResized()
*/
2014-12-20 03:43:44 +03:00
/*!
\fn BHandler* BTabView::ResolveSpecifier(BMessage* message, int32 index,
BMessage* specifier, int32 what, const char* property)
\copydoc BHandler::ResolveSpecifier()
*/
/*!
\fn status_t BTabView::GetSupportedSuites(BMessage* message)
\copydoc BHandler::GetSupportedSuites()
*/
/*!
\fn void BTabView::AddTab(BView* target, BTab* tab)
\brief Adds the specified \a tab to the BTabView.
The tab is added to the end of the tab list. The new tab's target view is
set to \a target. If \a tab is \c NULL, a new BTab object is constructed
and added to the BTabView. You can get a pointer to the new tab by calling
the TabAt() method.
If you choose to reimplement AddTab(), you should call this parent method
at the end of your method.
\sa BTabView::TabAt()
\since BeOS R3
*/
/*!
\fn BTab* BTabView::RemoveTab(int32 index)
\brief Removes the tab at the specified \a index from the BTabView and
returns a pointer to the BTab object.
The BTab object is not deleted, if you don't need it anymore you should delete it.
\since BeOS R3
*/
/*!
\fn BTab* BTabView::TabAt(int32 index) const
\brief Returns a pointer to the BTab object at the specified \a index.
\since BeOS R3
*/
/*!
\fn void BTabView::SetTabWidth(button_width width)
\brief Sets the width of the tabs in the BTabView
\a width is one of the following:
- \c B_WIDTH_FROM_WIDEST Each tab's width is determined from the width of the widest tab.
- \c B_WIDTH_AS_USUAL The default tab width is used for all tabs.
- \c B_WIDTH_FROM_LABEL The label of each tab determines the tab width.
\since BeOS R3
*/
/*!
\fn button_width BTabView::TabWidth() const
\brief Returns the current tab width flag.
\since BeOS R3
*/
/*!
\fn void BTabView::SetTabHeight(float height)
\brief Sets the height of the tabs to \a height.
\a height should be an integral value.
\since BeOS R3
*/
/*!
\fn float BTabView::TabHeight() const
\brief Returns the current tab height.
\since BeOS R3
*/
/*!
\fn void BTabView::SetBorder(border_style borderStyle)
\brief Sets the border style of the tab view to \a borderStyle.
\param borderStyle One of the following:
- \c B_FANCY_BORDER (the default)
- \c B_PLAIN_BORDER a plain line border,
- \c B_NO_BORDER do not draw a border.
2014-12-20 03:43:44 +03:00
\since Haiku R1
*/
/*!
\fn border_style BTabView::Border() const
\brief Returns the current border_style flag.
\since Haiku R1
*/
/*!
\fn BView* BTabView::ContainerView() const
\brief Returns a pointer to the tab view's container view.
\since Haiku R1
*/
/*!
\fn int32 BTabView::CountTabs() const
\brief Returns the number of tabs in the tab view.
\since Haiku R1
*/
/*!
\fn BView* BTabView::ViewForTab(int32 tabIndex) const
\brief Returns the BView of the tab at the specified \a tabIndex.
\since Haiku R1
*/
BeControlLook: Fix app integration drawing issues Update BTab::DrawTab() to pass the current index, the index of the selected tab, and the index of the first and last tabs into BControlLook::DrawActiveTab() and BControlLook::DrawInactiveTab(). This allows you to draw tabs differently in your BTab or BControlLook subclass in many different circumstances. Modify BControlLook API to add indexes to DrawActiveTab() and DrawInactiveTab() like so: void DrawActiveTab(..., int32 index = 0, int32 selected = -1, int32 first = 0, int32 last = 0); void DrawInactiveTab(..., int32 index = 0, int32 selected = -1, int32 first = 0, int32 last = 0); These extra indexes are not used by HaikuControlLook which relies only on if the tab is active or inactive to draw. Add IndexOf(BTab* tab) method to BTabView and document it to get the index of the current tab in BTab::DrawTab(). Also add a warning in the BTabView::DrawTab() method not to use the position and full parameters anymore, use BTabView::IndexOf(), BTabView::Selection(), and BTabView::TabCount() to get the info you need. Using a dynamic_cast to a BTabView in BeControlLook to determine if the view is derived from a BTabView didn't work in the case of WebPositive. Furthermore, WebPositive does custom tab drawing which needed to be updated for alternative control look. These index parameters passed from BTab to BeControlLook allow us to draw the tab like BeOS without relying on a dynamic_cast to BTabView to get the info. Reproduce the functionality described above for BTab in WebPositive's custom tabs. Eliminate no longer needed code in favor of using indexes. Update WebPositive custom tabs to use BControlLook::DrawTabFrame() instead of BControlLook::DrawInactiveTab() matching the update made in BTabView. In BeControlLook::DrawTabFrame() fill rect with base color, WebPositive doesn't draw any tab background, so it expects this work to be done for it. Eliminate hasFrames variable from WebPositive. Rename TabSelected(index) to UpdateSelection(index) in WebPositive to better reflect its purpose. Adjusted HaikuControlLook::DrawInactiveTab() to draw the tab borders more selectively. Only draw border if left border is set for top and bottom tabs or top border is set for left and right tabs. Undo no longer needed frame manipulation border drawing workaround in HaikuControlLook::DrawTabFrame(). Draw scroll bar triangle without using DrawArrowShape(). Unlike in HaikuControlLook, DrawArrowShape() is used to draw arrows in BOutlineListView and menus distinctly from how it draws arrows in scroll bars. Draw our distinct arrows in DrawSrollBarButtons() instead. This fixes overflow of time edit up-down arrows in Clock prefs and the collapse-expand arrow in Deskbar not being vertically centered. In DrawBorders() only inset if we actually draw the border. Fix alignment issues with DrawSliderThumb dots for example in MediaPlayer volume knobs. Draw using line arrays calling AddLine instead of StrokeLine in several places. DrawMenuBar() extends to draw final pixel which eliminates an extra lines at the end of menu bars. Truncate button labels better fixing a few issues for example keymap keyboard layout button labels. Button insets has been updated a bit to fix drawing issues with buttons missing a border. Using a dynamic_cast to a BButton to determine if a view is a button in BeControlLook didn't work in the case of the keymap label. Look for B_FLAT, B_HOVER, or B_DEFAULT_BUTTON flag in BeControlLook::DrawLabel() to draw the label inverted on click. Pass the B_FLAT flag from Keymap keys when drawing using BControlLook so that the label is inverted. Change-Id: I07631f4b006bdb9aeca2adc9cbdf2da54dae8e92 Reviewed-on: https://review.haiku-os.org/c/haiku/+/2866 Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
2020-06-02 00:15:29 +03:00
/*!
\fn int32 BTabView::IndexOf(Tab* tab) const
\brief Returns the index of \a tab or -1 if not found.
\since Haiku R1
*/