haiku/src/apps/terminal/TermScrollView.cpp
Philippe Houdoin b90b61272e Fixed scrollbars & window resize knob layout issue:
- active view at fullscreen enter and exit was not necessary the same one!
- all view's scrollbars are now resized at fullscreen switch
- new tab's scrollbar was sized for window mode, even when added while in
  fullscreen mode...


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@39689 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-12-01 10:51:21 +00:00

66 lines
1.4 KiB
C++

/*
* Copyright 2008, Ingo Weinhold, ingo_weinhold@gmx.de.
* Distributed under the terms of the MIT License.
*/
// NOTE: Nasty hack to get access to BScrollView's private parts.
#include <ScrollBar.h>
#define private protected
#include <ScrollView.h>
#undef private
#include "TermScrollView.h"
#include <Message.h>
class TermScrollBar : public BScrollBar {
public:
TermScrollBar(BRect frame, const char *name, BView *target,
float min, float max, orientation direction)
:
BScrollBar(frame, name, target, min, max, direction)
{
}
virtual void ValueChanged(float newValue)
{
if (BView* target = Target())
target->ScrollTo(0, newValue);
}
};
TermScrollView::TermScrollView(const char* name, BView* child, BView* target,
bool overlapTop, uint32 resizingMode)
:
BScrollView(name, child, resizingMode, 0, false, true, B_NO_BORDER)
{
child->TargetedByScrollView(NULL);
// replace the vertical scroll bar with our own
if (fVerticalScrollBar != NULL) {
BRect frame(fVerticalScrollBar->Frame());
RemoveChild(fVerticalScrollBar);
delete fVerticalScrollBar;
// Overlap one pixel at the top (if required) with the menu for
// aesthetical reasons.
if (overlapTop)
frame.top--;
TermScrollBar* scrollBar = new TermScrollBar(frame, "_VSB_", target, 0,
1000, B_VERTICAL);
AddChild(scrollBar);
fVerticalScrollBar = scrollBar;
}
target->TargetedByScrollView(this);
}
TermScrollView::~TermScrollView()
{
}