Terminal: Use BControlLook for scrollbar sizing.
Improves appearance under HiDPI.
This commit is contained in:
@@ -22,6 +22,7 @@
|
|||||||
#include <BitmapButton.h>
|
#include <BitmapButton.h>
|
||||||
#include <Button.h>
|
#include <Button.h>
|
||||||
#include <Catalog.h>
|
#include <Catalog.h>
|
||||||
|
#include <ControlLook.h>
|
||||||
#include <Locale.h>
|
#include <Locale.h>
|
||||||
#include <Message.h>
|
#include <Message.h>
|
||||||
#include <Messenger.h>
|
#include <Messenger.h>
|
||||||
@@ -52,7 +53,7 @@ SmartTabView::SmartTabView(BRect frame, const char* name, button_width width,
|
|||||||
ContainerView()->ResizeTo(frame.Width(), frame.Height());
|
ContainerView()->ResizeTo(frame.Width(), frame.Height());
|
||||||
|
|
||||||
BRect buttonRect(frame);
|
BRect buttonRect(frame);
|
||||||
buttonRect.left = frame.right - B_V_SCROLL_BAR_WIDTH + 1;
|
buttonRect.left = frame.right - be_control_look->GetScrollBarWidth(B_VERTICAL) + 1;
|
||||||
buttonRect.bottom = frame.top + TabHeight() - 1;
|
buttonRect.bottom = frame.top + TabHeight() - 1;
|
||||||
fFullScreenButton = new BBitmapButton(kWindowIconBits, kWindowIconWidth,
|
fFullScreenButton = new BBitmapButton(kWindowIconBits, kWindowIconWidth,
|
||||||
kWindowIconHeight, kWindowIconFormat, new BMessage(FULLSCREEN));
|
kWindowIconHeight, kWindowIconFormat, new BMessage(FULLSCREEN));
|
||||||
|
|||||||
@@ -26,6 +26,7 @@
|
|||||||
#include <Alert.h>
|
#include <Alert.h>
|
||||||
#include <Application.h>
|
#include <Application.h>
|
||||||
#include <Catalog.h>
|
#include <Catalog.h>
|
||||||
|
#include <ControlLook.h>
|
||||||
#include <CharacterSet.h>
|
#include <CharacterSet.h>
|
||||||
#include <CharacterSetRoster.h>
|
#include <CharacterSetRoster.h>
|
||||||
#include <Clipboard.h>
|
#include <Clipboard.h>
|
||||||
@@ -949,7 +950,7 @@ TermWindow::MessageReceived(BMessage *message)
|
|||||||
|
|
||||||
for (int32 i = fTabView->CountTabs() - 1; i >= 0; i--)
|
for (int32 i = fTabView->CountTabs() - 1; i >= 0; i--)
|
||||||
_TermViewAt(i)->ScrollBar()->ResizeBy(0,
|
_TermViewAt(i)->ScrollBar()->ResizeBy(0,
|
||||||
(B_H_SCROLL_BAR_HEIGHT - 1));
|
(be_control_look->GetScrollBarWidth(B_VERTICAL) - 1));
|
||||||
|
|
||||||
fMenuBar->Hide();
|
fMenuBar->Hide();
|
||||||
fTabView->ResizeBy(0, mbHeight);
|
fTabView->ResizeBy(0, mbHeight);
|
||||||
@@ -969,7 +970,7 @@ TermWindow::MessageReceived(BMessage *message)
|
|||||||
|
|
||||||
for (int32 i = fTabView->CountTabs() - 1; i >= 0; i--)
|
for (int32 i = fTabView->CountTabs() - 1; i >= 0; i--)
|
||||||
_TermViewAt(i)->ScrollBar()->ResizeBy(0,
|
_TermViewAt(i)->ScrollBar()->ResizeBy(0,
|
||||||
-(B_H_SCROLL_BAR_HEIGHT - 1));
|
-(be_control_look->GetScrollBarWidth(B_VERTICAL) - 1));
|
||||||
|
|
||||||
ResizeTo(fSavedFrame.Width(), fSavedFrame.Height());
|
ResizeTo(fSavedFrame.Width(), fSavedFrame.Height());
|
||||||
MoveTo(fSavedFrame.left, fSavedFrame.top);
|
MoveTo(fSavedFrame.left, fSavedFrame.top);
|
||||||
@@ -1325,7 +1326,7 @@ TermWindow::_AddTab(Arguments* args, const BString& currentDirectory)
|
|||||||
containerView, view, fSessions.IsEmpty());
|
containerView, view, fSessions.IsEmpty());
|
||||||
if (!fFullScreen)
|
if (!fFullScreen)
|
||||||
scrollView->ScrollBar(B_VERTICAL)
|
scrollView->ScrollBar(B_VERTICAL)
|
||||||
->ResizeBy(0, -(B_H_SCROLL_BAR_HEIGHT - 1));
|
->ResizeBy(0, -(be_control_look->GetScrollBarWidth(B_VERTICAL) - 1));
|
||||||
|
|
||||||
if (fSessions.IsEmpty())
|
if (fSessions.IsEmpty())
|
||||||
fTabView->SetScrollView(scrollView);
|
fTabView->SetScrollView(scrollView);
|
||||||
@@ -1360,7 +1361,7 @@ TermWindow::_AddTab(Arguments* args, const BString& currentDirectory)
|
|||||||
containerView->GetPreferredSize(&viewWidth, &viewHeight);
|
containerView->GetPreferredSize(&viewWidth, &viewHeight);
|
||||||
|
|
||||||
// Resize Window
|
// Resize Window
|
||||||
ResizeTo(viewWidth + B_V_SCROLL_BAR_WIDTH,
|
ResizeTo(viewWidth + be_control_look->GetScrollBarWidth(B_HORIZONTAL),
|
||||||
viewHeight + fMenuBar->Bounds().Height() + 1);
|
viewHeight + fMenuBar->Bounds().Height() + 1);
|
||||||
// NOTE: Width is one pixel too small, since the scroll view
|
// NOTE: Width is one pixel too small, since the scroll view
|
||||||
// is one pixel wider than its parent.
|
// is one pixel wider than its parent.
|
||||||
@@ -1741,7 +1742,7 @@ TermWindow::_ResizeView(TermView *view)
|
|||||||
float height;
|
float height;
|
||||||
view->Parent()->GetPreferredSize(&width, &height);
|
view->Parent()->GetPreferredSize(&width, &height);
|
||||||
|
|
||||||
width += B_V_SCROLL_BAR_WIDTH;
|
width += be_control_look->GetScrollBarWidth(B_HORIZONTAL);
|
||||||
// NOTE: Width is one pixel too small, since the scroll view
|
// NOTE: Width is one pixel too small, since the scroll view
|
||||||
// is one pixel wider than its parent.
|
// is one pixel wider than its parent.
|
||||||
if (fMenuBar != NULL)
|
if (fMenuBar != NULL)
|
||||||
|
|||||||
Reference in New Issue
Block a user