tdf#139429 Convert Style previews widget to IconView
- this adds labels to easily identify the styles - easier to work with many styles - nice native widget in gtk3 - double click opens the style settings - added Command callback fro iconview Change-Id: I08743515cbd2a4e4bd592d1509e48bbe2a43b129 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/110408 Tested-by: Jenkins Reviewed-by: Szymon Kłos <szymon.klos@collabora.com>
This commit is contained in:
parent
b11db88d01
commit
fd9b52502d
7 changed files with 129 additions and 280 deletions
|
@ -1253,6 +1253,7 @@ private:
|
|||
protected:
|
||||
Link<IconView&, void> m_aSelectionChangeHdl;
|
||||
Link<IconView&, bool> m_aItemActivatedHdl;
|
||||
Link<const CommandEvent&, bool> m_aCommandHdl;
|
||||
|
||||
void signal_selection_changed() { m_aSelectionChangeHdl.Call(*this); }
|
||||
bool signal_item_activated() { return m_aItemActivatedHdl.Call(*this); }
|
||||
|
@ -1289,6 +1290,8 @@ public:
|
|||
*/
|
||||
void connect_item_activated(const Link<IconView&, bool>& rLink) { m_aItemActivatedHdl = rLink; }
|
||||
|
||||
void connect_command(const Link<const CommandEvent&, bool>& rLink) { m_aCommandHdl = rLink; }
|
||||
|
||||
virtual OUString get_selected_id() const = 0;
|
||||
|
||||
virtual void clear() = 0;
|
||||
|
|
|
@ -40,24 +40,17 @@ public:
|
|||
void StateChanged(SfxItemState eState, const SfxPoolItem* pState) override;
|
||||
};
|
||||
|
||||
class StyleItemController : public weld::CustomWidgetController
|
||||
class StyleItemController
|
||||
{
|
||||
static constexpr unsigned LEFT_MARGIN = 8;
|
||||
|
||||
SfxStyleFamily m_eStyleFamily;
|
||||
std::pair<OUString, OUString> m_aStyleName;
|
||||
bool m_bSelected;
|
||||
css::uno::Reference<css::frame::XDispatchProvider> m_xDispatchProvider;
|
||||
|
||||
public:
|
||||
StyleItemController(
|
||||
const std::pair<OUString, OUString>& aStyleName,
|
||||
const css::uno::Reference<css::frame::XDispatchProvider>& xDispatchProvider);
|
||||
StyleItemController(const std::pair<OUString, OUString>& aStyleName);
|
||||
|
||||
void Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect) override;
|
||||
|
||||
bool MouseButtonDown(const MouseEvent& rMEvt) override;
|
||||
bool Command(const CommandEvent& rEvent) override;
|
||||
void Paint(vcl::RenderContext& rRenderContext);
|
||||
|
||||
void SetStyle(const std::pair<OUString, OUString>& sStyleName);
|
||||
|
||||
|
@ -77,23 +70,21 @@ class StylesPreviewWindow_Base
|
|||
protected:
|
||||
static constexpr unsigned STYLES_COUNT = 6;
|
||||
|
||||
std::unique_ptr<StyleItemController> m_xStyleControllers[STYLES_COUNT];
|
||||
std::unique_ptr<weld::CustomWeld> m_xStyleControllersWeld[STYLES_COUNT];
|
||||
css::uno::Reference<css::frame::XDispatchProvider> m_xDispatchProvider;
|
||||
|
||||
std::unique_ptr<weld::IconView> m_xStylesView;
|
||||
|
||||
StyleStatusListener* m_pStatusListener;
|
||||
css::uno::Reference<css::lang::XComponent> m_xStatusListener;
|
||||
|
||||
std::unique_ptr<weld::Toolbar> m_xUp;
|
||||
std::unique_ptr<weld::Toolbar> m_xDown;
|
||||
|
||||
std::vector<std::pair<OUString, OUString>> m_aDefaultStyles;
|
||||
std::vector<std::pair<OUString, OUString>> m_aAllStyles;
|
||||
|
||||
unsigned m_nStyleIterator;
|
||||
OUString m_sSelectedStyle;
|
||||
|
||||
DECL_LINK(GoUp, const OString&, void);
|
||||
DECL_LINK(GoDown, const OString&, void);
|
||||
DECL_LINK(Selected, weld::IconView&, void);
|
||||
DECL_LINK(DoubleClick, weld::IconView&, bool);
|
||||
DECL_LINK(DoCommand, const CommandEvent&, bool);
|
||||
|
||||
public:
|
||||
StylesPreviewWindow_Base(
|
||||
|
@ -106,8 +97,7 @@ public:
|
|||
private:
|
||||
void Update();
|
||||
void UpdateStylesList();
|
||||
void MakeCurrentStyleVisible();
|
||||
std::pair<OUString, OUString> GetVisibleStyle(unsigned nPosition);
|
||||
bool Command(const CommandEvent& rEvent);
|
||||
};
|
||||
|
||||
class StylesPreviewWindow_Impl : public InterimItemWindow, public StylesPreviewWindow_Base
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
#include <sfx2/sfxsids.hrc>
|
||||
#include <sfx2/tplpitem.hxx>
|
||||
#include <sfx2/viewsh.hxx>
|
||||
#include <vcl/virdev.hxx>
|
||||
|
||||
#include <editeng/editids.hrc>
|
||||
#include <editeng/fontitem.hxx>
|
||||
|
@ -71,18 +72,13 @@ void StyleStatusListener::StateChanged(SfxItemState /*eState*/, const SfxPoolIte
|
|||
m_pPreviewControl->Select(pStateItem->GetStyleName());
|
||||
}
|
||||
|
||||
StyleItemController::StyleItemController(
|
||||
const std::pair<OUString, OUString>& aStyleName,
|
||||
const css::uno::Reference<css::frame::XDispatchProvider>& xDispatchProvider)
|
||||
StyleItemController::StyleItemController(const std::pair<OUString, OUString>& aStyleName)
|
||||
: m_eStyleFamily(SfxStyleFamily::Para)
|
||||
, m_aStyleName(aStyleName)
|
||||
, m_bSelected(false)
|
||||
, m_xDispatchProvider(xDispatchProvider)
|
||||
{
|
||||
}
|
||||
|
||||
void StyleItemController::Paint(vcl::RenderContext& rRenderContext,
|
||||
const tools::Rectangle& /*rRect*/)
|
||||
void StyleItemController::Paint(vcl::RenderContext& rRenderContext)
|
||||
{
|
||||
rRenderContext.Push(PushFlags::FILLCOLOR | PushFlags::FONT | PushFlags::TEXTCOLOR);
|
||||
|
||||
|
@ -91,51 +87,19 @@ void StyleItemController::Paint(vcl::RenderContext& rRenderContext,
|
|||
rRenderContext.Pop();
|
||||
}
|
||||
|
||||
void StyleItemController::SetStyle(const std::pair<OUString, OUString>& sStyleName)
|
||||
{
|
||||
m_aStyleName = sStyleName;
|
||||
Invalidate();
|
||||
}
|
||||
|
||||
void StyleItemController::Select(bool bSelect)
|
||||
{
|
||||
m_bSelected = bSelect;
|
||||
Invalidate();
|
||||
}
|
||||
|
||||
bool StyleItemController::MouseButtonDown(const MouseEvent& rMEvt)
|
||||
{
|
||||
if (rMEvt.IsLeft())
|
||||
{
|
||||
css::uno::Sequence<css::beans::PropertyValue> aArgs(2);
|
||||
aArgs[0].Value <<= m_aStyleName.second;
|
||||
aArgs[1].Name = "Family";
|
||||
aArgs[1].Value <<= sal_Int16(m_eStyleFamily);
|
||||
|
||||
aArgs[0].Name = "Template";
|
||||
SfxToolBoxControl::Dispatch(m_xDispatchProvider, ".uno:StyleApply", aArgs);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool StyleItemController::Command(const CommandEvent& rEvent)
|
||||
bool StylesPreviewWindow_Base::Command(const CommandEvent& rEvent)
|
||||
{
|
||||
if (rEvent.GetCommand() != CommandEventId::ContextMenu)
|
||||
return CustomWidgetController::Command(rEvent);
|
||||
return false;
|
||||
|
||||
std::unique_ptr<weld::Builder> xBuilder(
|
||||
Application::CreateBuilder(GetDrawingArea(), "svx/ui/stylemenu.ui"));
|
||||
Application::CreateBuilder(m_xStylesView.get(), "svx/ui/stylemenu.ui"));
|
||||
std::unique_ptr<weld::Menu> xMenu(xBuilder->weld_menu("menu"));
|
||||
std::string_view rIdent = xMenu->popup_at_rect(
|
||||
GetDrawingArea(), tools::Rectangle(rEvent.GetMousePosPixel(), Size(1, 1)));
|
||||
m_xStylesView.get(), tools::Rectangle(rEvent.GetMousePosPixel(), Size(1, 1)));
|
||||
if (rIdent == "update" || rIdent == "edit")
|
||||
{
|
||||
css::uno::Sequence<css::beans::PropertyValue> aArgs(2);
|
||||
aArgs[0].Name = "Param";
|
||||
aArgs[0].Value <<= m_aStyleName.second;
|
||||
aArgs[1].Name = "Family";
|
||||
aArgs[1].Value <<= sal_Int16(m_eStyleFamily);
|
||||
css::uno::Sequence<css::beans::PropertyValue> aArgs(0);
|
||||
|
||||
SfxToolBoxControl::Dispatch(m_xDispatchProvider,
|
||||
rIdent == "update" ? OUString(".uno:StyleUpdateByExample")
|
||||
|
@ -259,24 +223,13 @@ void StyleItemController::DrawEntry(vcl::RenderContext& rRenderContext)
|
|||
|
||||
Size aSize(rRenderContext.GetOutputSizePixel());
|
||||
tools::Rectangle aFullRect(Point(0, 0), aSize);
|
||||
aSize = Size(aSize.getWidth() - 6, aSize.getHeight() - 6);
|
||||
tools::Rectangle aContentRect(aFullRect);
|
||||
|
||||
Color aOriginalColor = rRenderContext.GetFillColor();
|
||||
Color aOriginalLineColor = rRenderContext.GetLineColor();
|
||||
vcl::Region aOriginalClipRegion(aFullRect);
|
||||
|
||||
if (m_bSelected)
|
||||
{
|
||||
aContentRect = tools::Rectangle(Point(3, 3), aSize);
|
||||
DrawSelection(rRenderContext);
|
||||
}
|
||||
|
||||
DrawContentBackground(rRenderContext, aContentRect, aOriginalColor);
|
||||
|
||||
vcl::Region aClipRegion(aContentRect);
|
||||
rRenderContext.SetClipRegion(aClipRegion);
|
||||
|
||||
std::unique_ptr<const SfxItemSet> const pItemSet(pStyle->GetItemSetForPreview());
|
||||
if (!pItemSet)
|
||||
return;
|
||||
|
@ -326,7 +279,6 @@ void StyleItemController::DrawEntry(vcl::RenderContext& rRenderContext)
|
|||
|
||||
rRenderContext.SetFillColor(aOriginalColor);
|
||||
rRenderContext.SetLineColor(aOriginalLineColor);
|
||||
rRenderContext.SetClipRegion(aOriginalClipRegion);
|
||||
}
|
||||
|
||||
void StyleItemController::DrawContentBackground(vcl::RenderContext& rRenderContext,
|
||||
|
@ -386,30 +338,51 @@ void StyleItemController::DrawText(vcl::RenderContext& rRenderContext)
|
|||
StylesPreviewWindow_Base::StylesPreviewWindow_Base(
|
||||
weld::Builder& xBuilder, std::vector<std::pair<OUString, OUString>>& aDefaultStyles,
|
||||
const css::uno::Reference<css::frame::XDispatchProvider>& xDispatchProvider)
|
||||
: m_xUp(xBuilder.weld_toolbar("uptoolbar"))
|
||||
, m_xDown(xBuilder.weld_toolbar("downtoolbar"))
|
||||
: m_xDispatchProvider(xDispatchProvider)
|
||||
, m_xStylesView(xBuilder.weld_icon_view("stylesview"))
|
||||
, m_aDefaultStyles(aDefaultStyles)
|
||||
, m_nStyleIterator(0)
|
||||
{
|
||||
for (unsigned int i = 0; i < STYLES_COUNT; i++)
|
||||
{
|
||||
auto aStyle
|
||||
= i < aDefaultStyles.size() ? aDefaultStyles[i] : std::pair<OUString, OUString>("", "");
|
||||
m_xStyleControllers[i].reset(new StyleItemController(aStyle, xDispatchProvider));
|
||||
|
||||
OUString sIdOUString = "style" + OUString::number(i + 1);
|
||||
OString sId = OUStringToOString(sIdOUString, RTL_TEXTENCODING_ASCII_US);
|
||||
|
||||
m_xStyleControllersWeld[i].reset(
|
||||
new weld::CustomWeld(xBuilder, sId, *m_xStyleControllers[i]));
|
||||
m_xStyleControllersWeld[i]->set_size_request(128, 28);
|
||||
}
|
||||
|
||||
m_xUp->connect_clicked(LINK(this, StylesPreviewWindow_Base, GoUp));
|
||||
m_xDown->connect_clicked(LINK(this, StylesPreviewWindow_Base, GoDown));
|
||||
m_xStylesView->connect_selection_changed(LINK(this, StylesPreviewWindow_Base, Selected));
|
||||
m_xStylesView->connect_item_activated(LINK(this, StylesPreviewWindow_Base, DoubleClick));
|
||||
m_xStylesView->connect_command(LINK(this, StylesPreviewWindow_Base, DoCommand));
|
||||
|
||||
m_pStatusListener = new StyleStatusListener(this, xDispatchProvider);
|
||||
m_xStatusListener.set(static_cast<cppu::OWeakObject*>(m_pStatusListener), css::uno::UNO_QUERY);
|
||||
|
||||
Update();
|
||||
}
|
||||
|
||||
IMPL_LINK(StylesPreviewWindow_Base, Selected, weld::IconView&, rIconView, void)
|
||||
{
|
||||
OUString sStyleName = rIconView.get_selected_text();
|
||||
|
||||
css::uno::Sequence<css::beans::PropertyValue> aArgs(2);
|
||||
aArgs[0].Value <<= sStyleName;
|
||||
aArgs[1].Name = "Family";
|
||||
aArgs[1].Value <<= sal_Int16(SfxStyleFamily::Para);
|
||||
|
||||
aArgs[0].Name = "Template";
|
||||
SfxToolBoxControl::Dispatch(m_xDispatchProvider, ".uno:StyleApply", aArgs);
|
||||
}
|
||||
|
||||
IMPL_LINK(StylesPreviewWindow_Base, DoubleClick, weld::IconView&, rIconView, bool)
|
||||
{
|
||||
OUString sStyleName = rIconView.get_selected_text();
|
||||
|
||||
css::uno::Sequence<css::beans::PropertyValue> aArgs(2);
|
||||
aArgs[0].Name = "Param";
|
||||
aArgs[0].Value <<= sStyleName;
|
||||
aArgs[1].Name = "Family";
|
||||
aArgs[1].Value <<= sal_Int16(SfxStyleFamily::Para);
|
||||
|
||||
SfxToolBoxControl::Dispatch(m_xDispatchProvider, ".uno:EditStyle", aArgs);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
IMPL_LINK(StylesPreviewWindow_Base, DoCommand, const CommandEvent&, rPos, bool)
|
||||
{
|
||||
return Command(rPos);
|
||||
}
|
||||
|
||||
StylesPreviewWindow_Base::~StylesPreviewWindow_Base()
|
||||
|
@ -427,56 +400,25 @@ StylesPreviewWindow_Base::~StylesPreviewWindow_Base()
|
|||
m_pStatusListener = nullptr;
|
||||
}
|
||||
|
||||
std::pair<OUString, OUString> StylesPreviewWindow_Base::GetVisibleStyle(unsigned nPosition)
|
||||
{
|
||||
if (nPosition >= STYLES_COUNT || !m_aAllStyles.size())
|
||||
return std::make_pair<OUString, OUString>("", "");
|
||||
|
||||
return m_aAllStyles[(m_nStyleIterator + nPosition) % m_aAllStyles.size()];
|
||||
}
|
||||
|
||||
void StylesPreviewWindow_Base::Select(const OUString& rStyleName)
|
||||
{
|
||||
m_sSelectedStyle = rStyleName;
|
||||
|
||||
UpdateStylesList();
|
||||
MakeCurrentStyleVisible();
|
||||
Update();
|
||||
}
|
||||
|
||||
void StylesPreviewWindow_Base::MakeCurrentStyleVisible()
|
||||
{
|
||||
if (!m_aAllStyles.size())
|
||||
return;
|
||||
|
||||
unsigned nNewIterator = m_nStyleIterator;
|
||||
auto aFound = std::find_if(m_aAllStyles.begin(), m_aAllStyles.end(), [this](auto it) {
|
||||
return it.first == m_sSelectedStyle || it.second == m_sSelectedStyle;
|
||||
});
|
||||
if (aFound != m_aAllStyles.end())
|
||||
nNewIterator = aFound - m_aAllStyles.begin();
|
||||
|
||||
bool bIsAlreadyVisible
|
||||
= nNewIterator >= m_nStyleIterator % m_aAllStyles.size()
|
||||
&& nNewIterator < m_nStyleIterator % m_aAllStyles.size() + STYLES_COUNT;
|
||||
if (!bIsAlreadyVisible)
|
||||
m_nStyleIterator = nNewIterator;
|
||||
}
|
||||
|
||||
void StylesPreviewWindow_Base::Update()
|
||||
{
|
||||
UpdateStylesList();
|
||||
|
||||
for (unsigned int i = 0; i < STYLES_COUNT; i++)
|
||||
for (unsigned long i = 0; i < m_aAllStyles.size(); ++i)
|
||||
{
|
||||
std::pair<OUString, OUString> sStyleName = GetVisibleStyle(i);
|
||||
m_xStyleControllers[i]->SetStyle(sStyleName);
|
||||
m_xStyleControllersWeld[i]->set_tooltip_text(sStyleName.second);
|
||||
|
||||
if (sStyleName.first == m_sSelectedStyle || sStyleName.second == m_sSelectedStyle)
|
||||
m_xStyleControllers[i]->Select(true);
|
||||
else
|
||||
m_xStyleControllers[i]->Select(false);
|
||||
if (m_aAllStyles[i].first == m_sSelectedStyle || m_aAllStyles[i].second == m_sSelectedStyle)
|
||||
{
|
||||
m_xStylesView->select(i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -503,22 +445,19 @@ void StylesPreviewWindow_Base::UpdateStylesList()
|
|||
pStyle = xIter->Next();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
IMPL_LINK(StylesPreviewWindow_Base, GoUp, const OString&, /*rItem*/, void)
|
||||
{
|
||||
if (m_nStyleIterator == 0)
|
||||
m_nStyleIterator = m_aAllStyles.size();
|
||||
else
|
||||
m_nStyleIterator = m_nStyleIterator - 2;
|
||||
m_xStylesView->clear();
|
||||
for (auto& rStyle : m_aAllStyles)
|
||||
{
|
||||
ScopedVclPtr<VirtualDevice> pImg = VclPtr<VirtualDevice>::Create();
|
||||
const Size aSize(100, 30);
|
||||
pImg->SetOutputSizePixel(aSize);
|
||||
|
||||
Update();
|
||||
}
|
||||
StyleItemController aStyleController(rStyle);
|
||||
aStyleController.Paint(*pImg);
|
||||
|
||||
IMPL_LINK(StylesPreviewWindow_Base, GoDown, const OString&, /*rItem*/, void)
|
||||
{
|
||||
m_nStyleIterator = m_nStyleIterator + 2;
|
||||
Update();
|
||||
m_xStylesView->append(rStyle.first, rStyle.second, pImg);
|
||||
}
|
||||
}
|
||||
|
||||
StylesPreviewWindow_Impl::StylesPreviewWindow_Impl(
|
||||
|
@ -528,10 +467,6 @@ StylesPreviewWindow_Impl::StylesPreviewWindow_Impl(
|
|||
reinterpret_cast<sal_uInt64>(SfxViewShell::Current()))
|
||||
, StylesPreviewWindow_Base(*m_xBuilder, aDefaultStyles, xDispatchProvider)
|
||||
{
|
||||
m_xUp->set_stack_background();
|
||||
m_xDown->set_stack_background();
|
||||
m_xContainer->set_stack_background();
|
||||
|
||||
SetOptimalSize();
|
||||
}
|
||||
|
||||
|
@ -539,11 +474,7 @@ StylesPreviewWindow_Impl::~StylesPreviewWindow_Impl() { disposeOnce(); }
|
|||
|
||||
void StylesPreviewWindow_Impl::dispose()
|
||||
{
|
||||
m_xUp.reset();
|
||||
m_xDown.reset();
|
||||
|
||||
for (unsigned int i = 0; i < STYLES_COUNT; i++)
|
||||
m_xStyleControllersWeld[i].reset();
|
||||
m_xStylesView.reset();
|
||||
|
||||
InterimItemWindow::dispose();
|
||||
}
|
||||
|
|
|
@ -1,150 +1,55 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!-- Generated with glade 3.22.2 -->
|
||||
<!-- Generated with glade 3.20.4 -->
|
||||
<interface domain="svx">
|
||||
<requires lib="gtk+" version="3.20"/>
|
||||
<object class="GtkTreeStore" id="liststore1">
|
||||
<columns>
|
||||
<!-- column-name expander -->
|
||||
<column type="GdkPixbuf"/>
|
||||
<!-- column-name text -->
|
||||
<column type="gchararray"/>
|
||||
<!-- column-name id -->
|
||||
<column type="gchararray"/>
|
||||
</columns>
|
||||
</object>
|
||||
<object class="GtkBox" id="ApplyStyleBox">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="hexpand">True</property>
|
||||
<property name="spacing">6</property>
|
||||
<child>
|
||||
<object class="GtkBox">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="valign">center</property>
|
||||
<property name="spacing">3</property>
|
||||
<child>
|
||||
<!-- n-columns=1 n-rows=1 -->
|
||||
<object class="GtkGrid" id="stylescontainer">
|
||||
<object class="GtkScrolledWindow">
|
||||
<property name="width_request">360</property>
|
||||
<property name="height_request">65</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="valign">center</property>
|
||||
<property name="hscrollbar_policy">never</property>
|
||||
<property name="vscrollbar_policy">always</property>
|
||||
<property name="shadow_type">in</property>
|
||||
<property name="min_content_width">70</property>
|
||||
<child>
|
||||
<object class="GtkDrawingArea" id="style4">
|
||||
<object class="GtkIconView" id="stylesview">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="margin">0</property>
|
||||
<property name="model">liststore1</property>
|
||||
<property name="columns">3</property>
|
||||
<property name="item_width">70</property>
|
||||
<property name="pixbuf-column">0</property>
|
||||
<property name="text-column">1</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
<property name="top_attach">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkDrawingArea" id="style3">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
<property name="top_attach">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkDrawingArea" id="style2">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">0</property>
|
||||
<property name="top_attach">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkDrawingArea" id="style1">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">0</property>
|
||||
<property name="top_attach">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkDrawingArea" id="style5">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">2</property>
|
||||
<property name="top_attach">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkDrawingArea" id="style6">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">2</property>
|
||||
<property name="top_attach">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">True</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkBox">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="valign">center</property>
|
||||
<property name="orientation">vertical</property>
|
||||
<child>
|
||||
<object class="GtkToolbar" id="uptoolbar">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="toolbar_style">icons</property>
|
||||
<child>
|
||||
<object class="GtkToolButton" id="up">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="label" translatable="yes" context="stylespreview|up">Previous</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="icon_name">cmd/sc_prevrecord.png</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="homogeneous">True</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkToolbar" id="downtoolbar">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="toolbar_style">icons</property>
|
||||
<child>
|
||||
<object class="GtkToolButton" id="down">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="label" translatable="yes" context="stylespreview|down">Next</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="icon_name">cmd/sc_nextrecord.png</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="homogeneous">True</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">1</property>
|
||||
<property name="fill">False</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
|
|
|
@ -1719,6 +1719,7 @@ private:
|
|||
DECL_LINK(SelectHdl, SvTreeListBox*, void);
|
||||
DECL_LINK(DeSelectHdl, SvTreeListBox*, void);
|
||||
DECL_LINK(DoubleClickHdl, SvTreeListBox*, bool);
|
||||
DECL_LINK(CommandHdl, const CommandEvent&, bool);
|
||||
|
||||
public:
|
||||
SalInstanceIconView(::IconView* pIconView, SalInstanceBuilder* pBuilder, bool bTakeOwnership);
|
||||
|
|
|
@ -5104,6 +5104,7 @@ SalInstanceIconView::SalInstanceIconView(::IconView* pIconView, SalInstanceBuild
|
|||
m_xIconView->SetSelectHdl(LINK(this, SalInstanceIconView, SelectHdl));
|
||||
m_xIconView->SetDeselectHdl(LINK(this, SalInstanceIconView, DeSelectHdl));
|
||||
m_xIconView->SetDoubleClickHdl(LINK(this, SalInstanceIconView, DoubleClickHdl));
|
||||
m_xIconView->SetPopupMenuHdl(LINK(this, SalInstanceIconView, CommandHdl));
|
||||
}
|
||||
|
||||
void SalInstanceIconView::freeze()
|
||||
|
@ -5366,6 +5367,11 @@ IMPL_LINK_NOARG(SalInstanceIconView, DoubleClickHdl, SvTreeListBox*, bool)
|
|||
return !signal_item_activated();
|
||||
}
|
||||
|
||||
IMPL_LINK(SalInstanceIconView, CommandHdl, const CommandEvent&, rEvent, bool)
|
||||
{
|
||||
return m_aCommandHdl.Call(rEvent);
|
||||
}
|
||||
|
||||
double SalInstanceSpinButton::toField(int nValue) const
|
||||
{
|
||||
return static_cast<double>(nValue) / Power10(get_digits());
|
||||
|
|
|
@ -12465,10 +12465,21 @@ private:
|
|||
gint m_nIdCol;
|
||||
gulong m_nSelectionChangedSignalId;
|
||||
gulong m_nItemActivatedSignalId;
|
||||
gulong m_nPopupMenu;
|
||||
ImplSVEvent* m_pSelectionChangeEvent;
|
||||
|
||||
DECL_LINK(async_signal_selection_changed, void*, void);
|
||||
|
||||
bool signal_command(const CommandEvent& rCEvt)
|
||||
{
|
||||
return m_aCommandHdl.Call(rCEvt);
|
||||
}
|
||||
|
||||
virtual bool signal_popup_menu(const CommandEvent& rCEvt) override
|
||||
{
|
||||
return signal_command(rCEvt);
|
||||
}
|
||||
|
||||
void launch_signal_selection_changed()
|
||||
{
|
||||
//tdf#117991 selection change is sent before the focus change, and focus change
|
||||
|
@ -12573,6 +12584,7 @@ public:
|
|||
, m_nSelectionChangedSignalId(g_signal_connect(pIconView, "selection-changed",
|
||||
G_CALLBACK(signalSelectionChanged), this))
|
||||
, m_nItemActivatedSignalId(g_signal_connect(pIconView, "item-activated", G_CALLBACK(signalItemActivated), this))
|
||||
, m_nPopupMenu(g_signal_connect(pIconView, "popup-menu", G_CALLBACK(signalPopupMenu), this))
|
||||
, m_pSelectionChangeEvent(nullptr)
|
||||
{
|
||||
m_nIdCol = m_nTextCol + 1;
|
||||
|
@ -12843,6 +12855,7 @@ public:
|
|||
|
||||
g_signal_handler_disconnect(m_pIconView, m_nItemActivatedSignalId);
|
||||
g_signal_handler_disconnect(m_pIconView, m_nSelectionChangedSignalId);
|
||||
g_signal_handler_disconnect(m_pIconView, m_nPopupMenu);
|
||||
}
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in a new issue