FButtonGroup now inherits from FScrollView
This commit is contained in:
parent
3f8ed6e78e
commit
b35d225ff5
|
@ -1,3 +1,9 @@
|
||||||
|
2017-02-19 Markus Gans <guru.mail@muenster.de>
|
||||||
|
* New FWidget methods setMinimumWidth(), setMinimumHeight(),
|
||||||
|
setMaximumWidth() and setMaximumHeight()
|
||||||
|
* FButtonGroup now inherits from FScrollView. This supports
|
||||||
|
many buttons to be displayed in a smaller frame.
|
||||||
|
|
||||||
2017-02-18 Markus Gans <guru.mail@muenster.de>
|
2017-02-18 Markus Gans <guru.mail@muenster.de>
|
||||||
* Allows a window to have more than one FScrollView widget
|
* Allows a window to have more than one FScrollView widget
|
||||||
|
|
||||||
|
|
|
@ -14,9 +14,8 @@
|
||||||
// constructor and destructor
|
// constructor and destructor
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
FButtonGroup::FButtonGroup(FWidget* parent)
|
FButtonGroup::FButtonGroup(FWidget* parent)
|
||||||
: FWidget(parent)
|
: FScrollView(parent)
|
||||||
, text()
|
, text()
|
||||||
, border(true)
|
|
||||||
, buttonlist()
|
, buttonlist()
|
||||||
{
|
{
|
||||||
init();
|
init();
|
||||||
|
@ -24,9 +23,8 @@ FButtonGroup::FButtonGroup(FWidget* parent)
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
FButtonGroup::FButtonGroup (const FString& txt, FWidget* parent)
|
FButtonGroup::FButtonGroup (const FString& txt, FWidget* parent)
|
||||||
: FWidget(parent)
|
: FScrollView(parent)
|
||||||
, text(txt)
|
, text(txt)
|
||||||
, border(true)
|
|
||||||
, buttonlist()
|
, buttonlist()
|
||||||
{
|
{
|
||||||
init();
|
init();
|
||||||
|
@ -88,17 +86,6 @@ bool FButtonGroup::setEnable (bool on)
|
||||||
return on;
|
return on;
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
|
||||||
bool FButtonGroup::setBorder(bool on)
|
|
||||||
{
|
|
||||||
if ( on )
|
|
||||||
border = true;
|
|
||||||
else
|
|
||||||
border = false;
|
|
||||||
|
|
||||||
return on;
|
|
||||||
}
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FButtonGroup::setText (const FString& txt)
|
void FButtonGroup::setText (const FString& txt)
|
||||||
{
|
{
|
||||||
|
@ -203,7 +190,7 @@ void FButtonGroup::hide()
|
||||||
|
|
||||||
for (int y=0; y < getHeight(); y++)
|
for (int y=0; y < getHeight(); y++)
|
||||||
{
|
{
|
||||||
setPrintPos (1, 1+y);
|
FWidget::setPrintPos (1, 1+y);
|
||||||
print (blank);
|
print (blank);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -426,14 +413,13 @@ void FButtonGroup::draw()
|
||||||
setReverse(true);
|
setReverse(true);
|
||||||
|
|
||||||
setColor();
|
setColor();
|
||||||
|
clearArea();
|
||||||
if ( border )
|
|
||||||
drawBorder();
|
|
||||||
|
|
||||||
drawLabel();
|
|
||||||
|
|
||||||
if ( isMonochron() )
|
if ( isMonochron() )
|
||||||
setReverse(false);
|
setReverse(false);
|
||||||
|
|
||||||
|
FScrollView::draw();
|
||||||
|
drawLabel();
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
@ -459,6 +445,7 @@ void FButtonGroup::drawLabel()
|
||||||
|
|
||||||
isActive = ((flags & fc::active) != 0);
|
isActive = ((flags & fc::active) != 0);
|
||||||
isNoUnderline = ((flags & fc::no_underline) != 0);
|
isNoUnderline = ((flags & fc::no_underline) != 0);
|
||||||
|
unsetViewportPrint();
|
||||||
|
|
||||||
// find hotkey position in string
|
// find hotkey position in string
|
||||||
// + generate a new string without the '&'-sign
|
// + generate a new string without the '&'-sign
|
||||||
|
@ -476,10 +463,10 @@ void FButtonGroup::drawLabel()
|
||||||
if ( hotkeypos != -1 )
|
if ( hotkeypos != -1 )
|
||||||
length--;
|
length--;
|
||||||
|
|
||||||
if ( border )
|
if ( hasBorder() )
|
||||||
setPrintPos (2, 1);
|
FWidget::setPrintPos (2, 1);
|
||||||
else
|
else
|
||||||
setPrintPos (0, 1);
|
FWidget::setPrintPos (0, 1);
|
||||||
|
|
||||||
if ( isEnabled() )
|
if ( isEnabled() )
|
||||||
setColor(wc.label_emphasis_fg, wc.label_bg);
|
setColor(wc.label_emphasis_fg, wc.label_bg);
|
||||||
|
@ -506,6 +493,7 @@ void FButtonGroup::drawLabel()
|
||||||
print ( LabelText[z] );
|
print ( LabelText[z] );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
setViewportPrint();
|
||||||
delete[] LabelText;
|
delete[] LabelText;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -524,16 +512,12 @@ bool FButtonGroup::isRadioButton(FToggleButton* button) const
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FButtonGroup::init()
|
void FButtonGroup::init()
|
||||||
{
|
{
|
||||||
setTopPadding(1);
|
|
||||||
setLeftPadding(1);
|
|
||||||
setBottomPadding(1);
|
|
||||||
setRightPadding(1);
|
|
||||||
|
|
||||||
if ( isEnabled() )
|
if ( isEnabled() )
|
||||||
flags |= fc::active;
|
flags |= fc::active;
|
||||||
|
|
||||||
setForegroundColor (wc.label_fg);
|
setForegroundColor (wc.label_fg);
|
||||||
setBackgroundColor (wc.label_bg);
|
setBackgroundColor (wc.label_bg);
|
||||||
|
setMinimumSize (7, 4);
|
||||||
buttonlist.clear(); // no buttons yet
|
buttonlist.clear(); // no buttons yet
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -28,7 +28,7 @@
|
||||||
#ifndef _FBUTTONGROUP_H
|
#ifndef _FBUTTONGROUP_H
|
||||||
#define _FBUTTONGROUP_H
|
#define _FBUTTONGROUP_H
|
||||||
|
|
||||||
#include "fwidget.h"
|
#include "fscrollview.h"
|
||||||
|
|
||||||
|
|
||||||
// class forward declaration
|
// class forward declaration
|
||||||
|
@ -41,7 +41,7 @@ class FToggleButton;
|
||||||
#pragma pack(push)
|
#pragma pack(push)
|
||||||
#pragma pack(1)
|
#pragma pack(1)
|
||||||
|
|
||||||
class FButtonGroup : public FWidget
|
class FButtonGroup : public FScrollView
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
// Constructors
|
// Constructors
|
||||||
|
@ -62,9 +62,6 @@ class FButtonGroup : public FWidget
|
||||||
bool setEnable();
|
bool setEnable();
|
||||||
bool unsetEnable();
|
bool unsetEnable();
|
||||||
bool setDisable();
|
bool setDisable();
|
||||||
bool setBorder(bool);
|
|
||||||
bool setBorder();
|
|
||||||
bool unsetBorder();
|
|
||||||
void setText (const FString&);
|
void setText (const FString&);
|
||||||
|
|
||||||
// Inquiries
|
// Inquiries
|
||||||
|
@ -111,7 +108,6 @@ class FButtonGroup : public FWidget
|
||||||
|
|
||||||
// Data Members
|
// Data Members
|
||||||
FString text;
|
FString text;
|
||||||
bool border;
|
|
||||||
FObjectList buttonlist;
|
FObjectList buttonlist;
|
||||||
};
|
};
|
||||||
#pragma pack(pop)
|
#pragma pack(pop)
|
||||||
|
@ -134,14 +130,6 @@ inline bool FButtonGroup::unsetEnable()
|
||||||
inline bool FButtonGroup::setDisable()
|
inline bool FButtonGroup::setDisable()
|
||||||
{ return setEnable(false); }
|
{ return setEnable(false); }
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
|
||||||
inline bool FButtonGroup::setBorder()
|
|
||||||
{ return setBorder(true); }
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
|
||||||
inline bool FButtonGroup::unsetBorder()
|
|
||||||
{ return setBorder(false); }
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline FString& FButtonGroup::getText()
|
inline FString& FButtonGroup::getText()
|
||||||
{ return text; }
|
{ return text; }
|
||||||
|
|
|
@ -70,10 +70,12 @@ void FRadioButton::drawRadioButton()
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
print ('(');
|
print ('(');
|
||||||
|
|
||||||
if ( isCygwinTerminal() )
|
if ( isCygwinTerminal() )
|
||||||
print (0x04);
|
print (0x04);
|
||||||
else
|
else
|
||||||
print (fc::Bullet); // Bullet ●
|
print (fc::Bullet); // Bullet ●
|
||||||
|
|
||||||
print (')');
|
print (')');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -285,11 +285,12 @@ void FScrollbar::drawButtons()
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FScrollbar::drawBar()
|
void FScrollbar::drawBar()
|
||||||
{
|
|
||||||
if ( slider_pos != current_slider_pos )
|
|
||||||
{
|
{
|
||||||
int z;
|
int z;
|
||||||
|
|
||||||
|
if ( slider_pos == current_slider_pos || length < 3 )
|
||||||
|
return;
|
||||||
|
|
||||||
if ( bar_orientation == fc::vertical )
|
if ( bar_orientation == fc::vertical )
|
||||||
{
|
{
|
||||||
setColor (wc.scrollbar_fg, wc.scrollbar_bg);
|
setColor (wc.scrollbar_fg, wc.scrollbar_bg);
|
||||||
|
@ -392,7 +393,6 @@ void FScrollbar::drawBar()
|
||||||
if ( isMonochron() )
|
if ( isMonochron() )
|
||||||
setReverse(false);
|
setReverse(false);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FScrollbar::onMouseDown (FMouseEvent* ev)
|
void FScrollbar::onMouseDown (FMouseEvent* ev)
|
||||||
|
@ -418,6 +418,8 @@ void FScrollbar::onMouseDown (FMouseEvent* ev)
|
||||||
// process LeftButton
|
// process LeftButton
|
||||||
scroll_type = getClickedScrollType(mouse_x, mouse_y);
|
scroll_type = getClickedScrollType(mouse_x, mouse_y);
|
||||||
|
|
||||||
|
if ( scroll_type == FScrollbar::noScroll )
|
||||||
|
{
|
||||||
if ( bar_orientation == fc::vertical )
|
if ( bar_orientation == fc::vertical )
|
||||||
{
|
{
|
||||||
if ( mouse_y > slider_pos+1 && mouse_y <= slider_pos+slider_length+1 )
|
if ( mouse_y > slider_pos+1 && mouse_y <= slider_pos+slider_length+1 )
|
||||||
|
@ -439,6 +441,7 @@ void FScrollbar::onMouseDown (FMouseEvent* ev)
|
||||||
|
|
||||||
if ( slider_click_pos > 0 )
|
if ( slider_click_pos > 0 )
|
||||||
scroll_type = FScrollbar::scrollJump;
|
scroll_type = FScrollbar::scrollJump;
|
||||||
|
}
|
||||||
|
|
||||||
if ( scroll_type == FScrollbar::scrollPageBackward
|
if ( scroll_type == FScrollbar::scrollPageBackward
|
||||||
|| scroll_type == FScrollbar::scrollPageForward )
|
|| scroll_type == FScrollbar::scrollPageForward )
|
||||||
|
@ -609,6 +612,9 @@ void FScrollbar::init()
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FScrollbar::draw()
|
void FScrollbar::draw()
|
||||||
{
|
{
|
||||||
|
if ( length < 2 )
|
||||||
|
return;
|
||||||
|
|
||||||
drawButtons();
|
drawButtons();
|
||||||
current_slider_pos = -1;
|
current_slider_pos = -1;
|
||||||
drawBar();
|
drawBar();
|
||||||
|
|
|
@ -187,7 +187,7 @@ void FScrollView::setPos (int x, int y, bool adjust)
|
||||||
void FScrollView::setWidth (int w, bool adjust)
|
void FScrollView::setWidth (int w, bool adjust)
|
||||||
{
|
{
|
||||||
FWidget::setWidth (w, adjust);
|
FWidget::setWidth (w, adjust);
|
||||||
viewport_geometry.setWidth(w);
|
viewport_geometry.setWidth(w - vertical_border_spacing - nf_offset);
|
||||||
calculateScrollbarPos();
|
calculateScrollbarPos();
|
||||||
|
|
||||||
if ( getScrollWidth() < getViewportWidth() )
|
if ( getScrollWidth() < getViewportWidth() )
|
||||||
|
@ -198,7 +198,7 @@ void FScrollView::setWidth (int w, bool adjust)
|
||||||
void FScrollView::setHeight (int h, bool adjust)
|
void FScrollView::setHeight (int h, bool adjust)
|
||||||
{
|
{
|
||||||
FWidget::setHeight (h, adjust);
|
FWidget::setHeight (h, adjust);
|
||||||
viewport_geometry.setHeight(h);
|
viewport_geometry.setHeight(h - horizontal_border_spacing);
|
||||||
calculateScrollbarPos();
|
calculateScrollbarPos();
|
||||||
|
|
||||||
if ( getScrollHeight() < getViewportHeight() )
|
if ( getScrollHeight() < getViewportHeight() )
|
||||||
|
@ -209,7 +209,8 @@ void FScrollView::setHeight (int h, bool adjust)
|
||||||
void FScrollView::setSize (int w, int h, bool adjust)
|
void FScrollView::setSize (int w, int h, bool adjust)
|
||||||
{
|
{
|
||||||
FWidget::setSize (w, h, adjust);
|
FWidget::setSize (w, h, adjust);
|
||||||
viewport_geometry.setSize(w, h);
|
viewport_geometry.setSize ( w - vertical_border_spacing - nf_offset
|
||||||
|
, h - horizontal_border_spacing );
|
||||||
calculateScrollbarPos();
|
calculateScrollbarPos();
|
||||||
|
|
||||||
if ( getScrollWidth() < getViewportWidth()
|
if ( getScrollWidth() < getViewportWidth()
|
||||||
|
@ -223,7 +224,8 @@ void FScrollView::setGeometry (int x, int y, int w, int h, bool adjust)
|
||||||
FWidget::setGeometry (x, y, w, h, adjust);
|
FWidget::setGeometry (x, y, w, h, adjust);
|
||||||
scroll_geometry.setPos ( getTermX() + getLeftPadding() - 1
|
scroll_geometry.setPos ( getTermX() + getLeftPadding() - 1
|
||||||
, getTermY() + getTopPadding() - 1 );
|
, getTermY() + getTopPadding() - 1 );
|
||||||
viewport_geometry.setSize(w, h);
|
viewport_geometry.setSize ( w - vertical_border_spacing - nf_offset
|
||||||
|
, h - horizontal_border_spacing );
|
||||||
calculateScrollbarPos();
|
calculateScrollbarPos();
|
||||||
|
|
||||||
if ( getScrollWidth() < getViewportWidth()
|
if ( getScrollWidth() < getViewportWidth()
|
||||||
|
@ -296,6 +298,8 @@ void FScrollView::scrollTo (int x, int y)
|
||||||
short& yoffset = viewport_geometry.y1_ref();
|
short& yoffset = viewport_geometry.y1_ref();
|
||||||
short xoffset_end = short(getScrollWidth() - getViewportWidth());
|
short xoffset_end = short(getScrollWidth() - getViewportWidth());
|
||||||
short yoffset_end = short(getScrollHeight() - getViewportHeight());
|
short yoffset_end = short(getScrollHeight() - getViewportHeight());
|
||||||
|
int save_width = viewport_geometry.getWidth();
|
||||||
|
int save_height = viewport_geometry.getHeight();
|
||||||
x--;
|
x--;
|
||||||
y--;
|
y--;
|
||||||
|
|
||||||
|
@ -317,6 +321,8 @@ void FScrollView::scrollTo (int x, int y)
|
||||||
if ( xoffset > xoffset_end )
|
if ( xoffset > xoffset_end )
|
||||||
xoffset = xoffset_end;
|
xoffset = xoffset_end;
|
||||||
|
|
||||||
|
viewport_geometry.setWidth(save_width);
|
||||||
|
viewport_geometry.setHeight(save_height);
|
||||||
hbar->setValue (xoffset);
|
hbar->setValue (xoffset);
|
||||||
vbar->setValue (yoffset);
|
vbar->setValue (yoffset);
|
||||||
drawHBar();
|
drawHBar();
|
||||||
|
@ -377,6 +383,8 @@ void FScrollView::onKeyPress (FKeyEvent* ev)
|
||||||
short yoffset_before = yoffset;
|
short yoffset_before = yoffset;
|
||||||
short xoffset_end = short(getScrollWidth() - getViewportWidth());
|
short xoffset_end = short(getScrollWidth() - getViewportWidth());
|
||||||
short yoffset_end = short(getScrollHeight() - getViewportHeight());
|
short yoffset_end = short(getScrollHeight() - getViewportHeight());
|
||||||
|
int save_width = viewport_geometry.getWidth();
|
||||||
|
int save_height = viewport_geometry.getHeight();
|
||||||
|
|
||||||
switch ( key )
|
switch ( key )
|
||||||
{
|
{
|
||||||
|
@ -445,6 +453,8 @@ void FScrollView::onKeyPress (FKeyEvent* ev)
|
||||||
if ( isVisible() && viewport
|
if ( isVisible() && viewport
|
||||||
&& (xoffset_before != xoffset || yoffset_before != yoffset) )
|
&& (xoffset_before != xoffset || yoffset_before != yoffset) )
|
||||||
{
|
{
|
||||||
|
viewport_geometry.setWidth(save_width);
|
||||||
|
viewport_geometry.setHeight(save_height);
|
||||||
viewport->has_changes = true;
|
viewport->has_changes = true;
|
||||||
setTopPadding (1 - yoffset);
|
setTopPadding (1 - yoffset);
|
||||||
setLeftPadding (1 - xoffset);
|
setLeftPadding (1 - xoffset);
|
||||||
|
@ -469,6 +479,7 @@ void FScrollView::onWheel (FWheelEvent* ev)
|
||||||
bool hasChanges = false;
|
bool hasChanges = false;
|
||||||
short& yoffset = viewport_geometry.y1_ref();
|
short& yoffset = viewport_geometry.y1_ref();
|
||||||
short yoffset_before = yoffset;
|
short yoffset_before = yoffset;
|
||||||
|
int save_height = viewport_geometry.getHeight();
|
||||||
int wheel = ev->getWheel();
|
int wheel = ev->getWheel();
|
||||||
|
|
||||||
switch ( wheel )
|
switch ( wheel )
|
||||||
|
@ -507,6 +518,7 @@ void FScrollView::onWheel (FWheelEvent* ev)
|
||||||
|
|
||||||
if ( isVisible() && viewport && yoffset_before != yoffset )
|
if ( isVisible() && viewport && yoffset_before != yoffset )
|
||||||
{
|
{
|
||||||
|
viewport_geometry.setHeight(save_height);
|
||||||
viewport->has_changes = true;
|
viewport->has_changes = true;
|
||||||
setTopPadding (1 - yoffset);
|
setTopPadding (1 - yoffset);
|
||||||
setBottomPadding (1 - (getScrollHeight() - getViewportHeight() - yoffset));
|
setBottomPadding (1 - (getScrollHeight() - getViewportHeight() - yoffset));
|
||||||
|
@ -551,28 +563,31 @@ void FScrollView::onChildFocusIn (FFocusEvent*)
|
||||||
// Scrolls the viewport so that the focused widget is visible
|
// Scrolls the viewport so that the focused widget is visible
|
||||||
|
|
||||||
FRect widget_geometry;
|
FRect widget_geometry;
|
||||||
|
FRect vp_geometry;
|
||||||
FWidget* focus_widget = FWidget::getFocusWidget();
|
FWidget* focus_widget = FWidget::getFocusWidget();
|
||||||
|
|
||||||
if ( ! focus_widget )
|
if ( ! focus_widget )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
widget_geometry = focus_widget->getGeometryWithShadow();
|
widget_geometry = focus_widget->getGeometryWithShadow();
|
||||||
|
vp_geometry = viewport_geometry;
|
||||||
|
vp_geometry.move(1,1);
|
||||||
|
|
||||||
if ( ! viewport_geometry.contains(widget_geometry) )
|
if ( ! vp_geometry.contains(widget_geometry) )
|
||||||
{
|
{
|
||||||
int x, y;
|
int x, y;
|
||||||
int vx = viewport_geometry.getX();
|
int vx = vp_geometry.getX();
|
||||||
int vy = viewport_geometry.getY();
|
int vy = vp_geometry.getY();
|
||||||
int wx = widget_geometry.getX();
|
int wx = widget_geometry.getX();
|
||||||
int wy = widget_geometry.getY();
|
int wy = widget_geometry.getY();
|
||||||
|
|
||||||
if ( wx > vx )
|
if ( wx > vx )
|
||||||
x = widget_geometry.getX2() - viewport_geometry.getWidth() + 3;
|
x = widget_geometry.getX2() - vp_geometry.getWidth() + 1;
|
||||||
else
|
else
|
||||||
x = wx;
|
x = wx;
|
||||||
|
|
||||||
if ( wy > vy )
|
if ( wy > vy )
|
||||||
y = widget_geometry.getY2() - viewport_geometry.getHeight() + 3;
|
y = widget_geometry.getY2() - vp_geometry.getHeight() + 1;
|
||||||
else
|
else
|
||||||
y = wy;
|
y = wy;
|
||||||
|
|
||||||
|
@ -837,6 +852,7 @@ void FScrollView::cb_VBarChange (FWidget*, void*)
|
||||||
short& yoffset = viewport_geometry.y1_ref();
|
short& yoffset = viewport_geometry.y1_ref();
|
||||||
short yoffset_before = yoffset;
|
short yoffset_before = yoffset;
|
||||||
short yoffset_end = short(getScrollHeight() - getViewportHeight());
|
short yoffset_end = short(getScrollHeight() - getViewportHeight());
|
||||||
|
int save_height = viewport_geometry.getHeight();
|
||||||
scrollType = vbar->getScrollType();
|
scrollType = vbar->getScrollType();
|
||||||
|
|
||||||
switch ( scrollType )
|
switch ( scrollType )
|
||||||
|
@ -912,6 +928,7 @@ void FScrollView::cb_VBarChange (FWidget*, void*)
|
||||||
|
|
||||||
if ( isVisible() && viewport && yoffset_before != yoffset )
|
if ( isVisible() && viewport && yoffset_before != yoffset )
|
||||||
{
|
{
|
||||||
|
viewport_geometry.setHeight(save_height);
|
||||||
viewport->has_changes = true;
|
viewport->has_changes = true;
|
||||||
setTopPadding (1 - yoffset);
|
setTopPadding (1 - yoffset);
|
||||||
setBottomPadding (1 - (getScrollHeight() - getViewportHeight() - yoffset));
|
setBottomPadding (1 - (getScrollHeight() - getViewportHeight() - yoffset));
|
||||||
|
@ -940,6 +957,7 @@ void FScrollView::cb_HBarChange (FWidget*, void*)
|
||||||
short& xoffset = viewport_geometry.x1_ref();
|
short& xoffset = viewport_geometry.x1_ref();
|
||||||
short xoffset_before = xoffset;
|
short xoffset_before = xoffset;
|
||||||
short xoffset_end = short(getScrollWidth() - getViewportWidth());
|
short xoffset_end = short(getScrollWidth() - getViewportWidth());
|
||||||
|
int save_width = viewport_geometry.getWidth();
|
||||||
scrollType = hbar->getScrollType();
|
scrollType = hbar->getScrollType();
|
||||||
|
|
||||||
switch ( scrollType )
|
switch ( scrollType )
|
||||||
|
@ -1015,6 +1033,7 @@ void FScrollView::cb_HBarChange (FWidget*, void*)
|
||||||
|
|
||||||
if ( isVisible() && viewport && xoffset_before != xoffset )
|
if ( isVisible() && viewport && xoffset_before != xoffset )
|
||||||
{
|
{
|
||||||
|
viewport_geometry.setWidth(save_width);
|
||||||
viewport->has_changes = true;
|
viewport->has_changes = true;
|
||||||
setLeftPadding (1 - xoffset);
|
setLeftPadding (1 - xoffset);
|
||||||
setRightPadding (1 - (getScrollWidth() - getViewportWidth() - xoffset) + nf_offset);
|
setRightPadding (1 - (getScrollWidth() - getViewportWidth() - xoffset) + nf_offset);
|
||||||
|
|
|
@ -204,7 +204,11 @@ class FWidget : public FVTerm
|
||||||
virtual void setGeometry (const FRect&, bool = true);
|
virtual void setGeometry (const FRect&, bool = true);
|
||||||
virtual void setGeometry (int, int, int, int, bool = true);
|
virtual void setGeometry (int, int, int, int, bool = true);
|
||||||
virtual void setShadowSize (int, int);
|
virtual void setShadowSize (int, int);
|
||||||
|
void setMinimumWidth (int);
|
||||||
|
void setMinimumHeight (int);
|
||||||
void setMinimumSize (int, int);
|
void setMinimumSize (int, int);
|
||||||
|
void setMaximumWidth (int);
|
||||||
|
void setMaximumHeight (int);
|
||||||
void setMaximumSize (int, int);
|
void setMaximumSize (int, int);
|
||||||
void setFixedSize (int, int);
|
void setFixedSize (int, int);
|
||||||
bool setCursorPos (const FPoint&);
|
bool setCursorPos (const FPoint&);
|
||||||
|
@ -771,10 +775,26 @@ inline void FWidget::setGeometry (const FRect& box, bool adjust)
|
||||||
inline void FWidget::setShadowSize (int right, int bottom)
|
inline void FWidget::setShadowSize (int right, int bottom)
|
||||||
{ wshadow.setPoint (right, bottom); }
|
{ wshadow.setPoint (right, bottom); }
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
inline void FWidget::setMinimumWidth (int min_width)
|
||||||
|
{ size_hints.setMinimum (min_width, size_hints.min_height); }
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
inline void FWidget::setMinimumHeight (int min_height)
|
||||||
|
{ size_hints.setMinimum (size_hints.min_width, min_height); }
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline void FWidget::setMinimumSize (int min_width, int min_height)
|
inline void FWidget::setMinimumSize (int min_width, int min_height)
|
||||||
{ size_hints.setMinimum (min_width, min_height); }
|
{ size_hints.setMinimum (min_width, min_height); }
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
inline void FWidget::setMaximumWidth (int max_width)
|
||||||
|
{ size_hints.setMaximum (max_width, size_hints.max_height); }
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
inline void FWidget::setMaximumHeight (int max_height)
|
||||||
|
{ size_hints.setMaximum (size_hints.max_width, max_height); }
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
inline void FWidget::setMaximumSize (int max_width, int max_height)
|
inline void FWidget::setMaximumSize (int max_width, int max_height)
|
||||||
{ size_hints.setMaximum (max_width, max_height); }
|
{ size_hints.setMaximum (max_width, max_height); }
|
||||||
|
|
Loading…
Reference in New Issue