Implement #8671.
Smarter Zoom behavior for TeamsWindow - resize such that the team list view's horizontal scrollbar isn't needed.
This commit is contained in:
@@ -18,6 +18,7 @@
|
||||
#include <LayoutBuilder.h>
|
||||
#include <ListView.h>
|
||||
#include <Path.h>
|
||||
#include <Screen.h>
|
||||
#include <ScrollView.h>
|
||||
|
||||
#include "MessageCodes.h"
|
||||
@@ -70,6 +71,23 @@ TeamsWindow::Create(SettingsManager* settingsManager)
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
TeamsWindow::Zoom(BPoint, float, float)
|
||||
{
|
||||
BSize preferredSize = fTeamsListView->PreferredSize();
|
||||
ResizeBy(preferredSize.Width() - Bounds().Width(),
|
||||
0.0);
|
||||
|
||||
// if the new size would extend us past the screen border,
|
||||
// move sufficiently to the left to bring us back within the bounds
|
||||
// + a bit of extra margin so we're not flush against the edge.
|
||||
BScreen screen;
|
||||
float offset = screen.Frame().right - Frame().right;
|
||||
if (offset < 0)
|
||||
MoveBy(offset - 5.0, 0.0);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
TeamsWindow::MessageReceived(BMessage* message)
|
||||
{
|
||||
|
||||
@@ -25,6 +25,7 @@ public:
|
||||
static TeamsWindow* Create(SettingsManager* settingsManager);
|
||||
// throws
|
||||
|
||||
virtual void Zoom(BPoint origin, float width, float height);
|
||||
virtual void MessageReceived(BMessage* message);
|
||||
virtual bool QuitRequested();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user