Kaydet (Commit) 4b339818 authored tarafından Caolán McNamara's avatar Caolán McNamara

add a VclViewport

like GtkViewport so that the scrolled region will be clipped,
which also has the side-effect of stopping glade clobbering
the non view-port scrolled .ui files on editing

Change-Id: Ic64174b3a35b77f068e0085cdc7721aeb33f1d82
üst eba5e5b6
......@@ -172,7 +172,7 @@ private:
FixedText* m_pchecking;
Throbber* m_pthrobber;
FixedText* m_pUpdate;
VclScrolledWindow* m_pContainer;
VclViewport* m_pContainer;
UpdateDialog::CheckListBox* m_pUpdates;
CheckBox* m_pAll;
FixedText* m_pDescription;
......
......@@ -144,10 +144,15 @@
</packing>
</child>
<child>
<object class="GtkScrolledWindow" id="UPDATES_CONTAINER">
<object class="GtkScrolledWindow" id="scrolledwindow1">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="shadow_type">in</property>
<child>
<object class="GtkViewport" id="UPDATES_CONTAINER">
<property name="visible">True</property>
</object>
</child>
</object>
<packing>
<property name="expand">True</property>
......
......@@ -576,6 +576,17 @@ private:
ScrollBarBox m_aScrollBarBox;
};
class VCL_DLLPUBLIC VclViewport : public VclBin
{
public:
VclViewport(Window *pParent, WinBits nStyle = WB_HIDE | WB_CLIPCHILDREN)
: VclBin(pParent, nStyle)
{
}
protected:
virtual void setAllocation(const Size &rAllocation) SAL_OVERRIDE;
};
//Enforces that its children are always the same size as itself.
//Intercepts any Commands intended for its children.
//
......
......@@ -321,7 +321,7 @@ namespace rptui
return;
long nConditionHeight = m_aConditions[0]->get_preferred_size().Height();
Point aConditionPos(0, -1 * nConditionHeight * impl_getFirstVisibleConditionIndex());
m_pScrollWindow->get_child()->SetPosPixel(aConditionPos);
m_pConditionPlayground->SetPosPixel(aConditionPos);
}
void ConditionalFormattingDialog::impl_layoutAll()
......
......@@ -92,6 +92,9 @@
<property name="vscrollbar_policy">always</property>
<property name="shadow_type">in</property>
<child>
<object class="GtkViewport" id="viewport1">
<property name="visible">True</property>
<child>
<object class="GtkBox" id="condPlaygroundDrawingarea">
<property name="visible">True</property>
<property name="can_focus">False</property>
......@@ -102,6 +105,8 @@
<placeholder/>
</child>
</object>
</child>
</object>
</child>
</object>
<packing>
......
......@@ -188,15 +188,20 @@
<property name="vexpand">True</property>
<property name="vscrollbar_policy">always</property>
<child>
<object class="GtkBox" id="sheetsBox">
<object class="GtkViewport" id="viewport1">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="hexpand">True</property>
<property name="vexpand">True</property>
<property name="orientation">vertical</property>
<property name="spacing">6</property>
<child>
<placeholder/>
<object class="GtkBox" id="sheetsBox">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="hexpand">True</property>
<property name="vexpand">True</property>
<property name="orientation">vertical</property>
<property name="spacing">6</property>
<child>
<placeholder/>
</child>
</object>
</child>
</object>
</child>
......
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.16.1 -->
<interface>
<!-- interface-requires gtk+ 3.0 -->
<requires lib="gtk+" version="3.0"/>
<object class="GtkScrolledWindow" id="SortCriteriaPage">
<property name="visible">True</property>
<property name="can_focus">True</property>
......@@ -9,14 +10,22 @@
<property name="hscrollbar_policy">never</property>
<property name="shadow_type">in</property>
<child>
<object class="GtkBox" id="SortKeyWindow">
<object class="GtkViewport" id="viewport2">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="hexpand">True</property>
<property name="vexpand">True</property>
<property name="orientation">vertical</property>
<child>
<placeholder/>
<object class="GtkBox" id="SortKeyWindow">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="hexpand">True</property>
<property name="vexpand">True</property>
<property name="orientation">vertical</property>
<child>
<placeholder/>
</child>
</object>
</child>
</object>
</child>
......
......@@ -25,14 +25,17 @@
</child>
<child>
<object class="GtkScrolledWindow" id="CmisScroll">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="hexpand">True</property>
<property name="vexpand">True</property>
<property name="hscrollbar_policy">never</property>
<property name="shadow_type">in</property>
<child>
<object class="GtkBox" id="CmisWindow">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="hexpand">True</property>
<property name="vexpand">True</property>
<property name="hscrollbar_policy">never</property>
<property name="shadow_type">in</property>
<child>
<object class="GtkViewport" id="viewport1">
<property name="visible">True</property>
<child>
<object class="GtkBox" id="CmisWindow">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="hexpand">True</property>
......@@ -41,8 +44,10 @@
<child>
<placeholder/>
</child>
</object>
</child>
</object>
</child>
</object>
</child>
</object>
<packing>
<property name="left_attach">0</property>
......
......@@ -231,6 +231,9 @@
<property name="vexpand">True</property>
<property name="vscrollbar_policy">always</property>
<property name="shadow_type">in</property>
<child>
<object class="GtkViewport" id="viewport1">
<property name="visible">True</property>
<child>
<object class="GtkGrid" id="grid4">
<property name="visible">True</property>
......@@ -582,6 +585,8 @@
</child>
</object>
</child>
</object>
</child>
</object>
</child>
</object>
......
......@@ -122,6 +122,9 @@
<property name="hscrollbar_policy">never</property>
<property name="vscrollbar_policy">always</property>
<property name="shadow_type">in</property>
<child>
<object class="GtkViewport" id="viewport1">
<property name="visible">True</property>
<child>
<object class="GtkGrid" id="grid1">
<property name="visible">True</property>
......@@ -230,6 +233,8 @@
</child>
</object>
</child>
</object>
</child>
</object>
<packing>
<property name="expand">False</property>
......
......@@ -1159,7 +1159,7 @@ Window *VclBuilder::makeObject(Window *pParent, const OString &name, const OStri
}
}
if (bIsPlaceHolder || name == "GtkTreeSelection" || name == "GtkViewport")
if (bIsPlaceHolder || name == "GtkTreeSelection")
return NULL;
extractButtonImage(id, rMap, name == "GtkRadioButton");
......@@ -1473,6 +1473,10 @@ Window *VclBuilder::makeObject(Window *pParent, const OString &name, const OStri
{
pWindow = new VclScrolledWindow(pParent);
}
else if (name == "GtkViewport")
{
pWindow = new VclViewport(pParent);
}
else if (name == "GtkEventBox")
{
pWindow = new VclEventBox(pParent);
......
......@@ -1613,6 +1613,13 @@ VclScrolledWindow::VclScrolledWindow(Window *pParent, WinBits nStyle)
IMPL_LINK_NOARG(VclScrolledWindow, ScrollBarHdl)
{
Window *pChild = get_child();
if (!pChild)
return 1;
assert(dynamic_cast<VclViewport*>(pChild) && "scrolledwindow child should be a Viewport");
pChild = pChild->GetWindow(WINDOW_FIRSTCHILD);
if (!pChild)
return 1;
......@@ -1698,7 +1705,9 @@ void VclScrolledWindow::setAllocation(const Size &rAllocation)
long nAvailWidth = rAllocation.Width();
// vert. ScrollBar
if (GetStyle() & WB_AUTOVSCROLL)
{
m_aVScroll.Show(nAvailHeight < aChildReq.Height());
}
if (m_aVScroll.IsVisible())
nAvailWidth -= getLayoutRequisition(m_aVScroll).Width();
......@@ -1754,12 +1763,8 @@ void VclScrolledWindow::setAllocation(const Size &rAllocation)
if (pChild && pChild->IsVisible())
{
Point aChildPos(pChild->GetPosPixel());
if (!m_aHScroll.IsVisible())
aChildPos.X() = 0;
if (!m_aVScroll.IsVisible())
aChildPos.Y() = 0;
setLayoutAllocation(*pChild, aChildPos, aChildAllocation);
assert(dynamic_cast<VclViewport*>(pChild) && "scrolledwindow child should be a Viewport");
setLayoutAllocation(*pChild, Point(0, 0), aInnerSize);
}
if (!m_bUserManagedScrolling)
......@@ -1803,6 +1808,18 @@ bool VclScrolledWindow::Notify(NotifyEvent& rNEvt)
return nDone || VclBin::Notify( rNEvt );
}
void VclViewport::setAllocation(const Size &rAllocation)
{
Window *pChild = get_child();
if (pChild && pChild->IsVisible())
{
Size aReq(getLayoutRequisition(*pChild));
aReq.Width() = std::max(aReq.Width(), rAllocation.Width());
aReq.Height() = std::max(aReq.Height(), rAllocation.Height());
setLayoutAllocation(*pChild, Point(0, 0), aReq);
}
}
const Window *VclEventBox::get_child() const
{
const WindowImpl* pWindowImpl = ImplGetWindowImpl();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment