Kaydet (Commit) 7e86cfab authored tarafından Caolán McNamara's avatar Caolán McNamara

replace sclo-ScExtIButton with MenuButton

Change-Id: I1f03bebe465e76f7e62f707937b9289e17b76605
Reviewed-on: https://gerrit.libreoffice.org/61328
Tested-by: Jenkins
Reviewed-by: 's avatarCaolán McNamara <caolanm@redhat.com>
Tested-by: 's avatarCaolán McNamara <caolanm@redhat.com>
üst 32dfaf1e
......@@ -477,10 +477,6 @@
generic-name="IntellectualPropertyPartEdit" parent="GtkEntry"
icon-name="widget-gtk-textentry"/>
<glade-widget-class title="Combo Image Button" name="sclo-ScExtIButton"
generic-name="Combo Image Button" parent="GtkButton"
icon-name="widget-gtk-button"/>
<glade-widget-class title="Open Document ListBox" name="dbulo-OpenDocumentListBox"
generic-name="Open Document ListBox" parent="GtkComboBox"
icon-name="widget-gtk-combobox"/>
......
......@@ -67,7 +67,7 @@ private:
VclPtr<ListBox> m_pLbDefined;
VclPtr<FixedText> m_pFtCustomHF;
VclPtr<PushButton> m_pBtnText;
VclPtr<ScExtIButton> m_pBtnFile;
VclPtr<MenuButton> m_pBtnFile;
VclPtr<PushButton> m_pBtnTable;
VclPtr<PushButton> m_pBtnPage;
VclPtr<PushButton> m_pBtnLastPage;
......@@ -99,7 +99,7 @@ private:
static bool IsExtFileNameEntry(const EditTextObject* pTextObj);
DECL_LINK( ListHdl_Impl, ListBox&, void);
DECL_LINK( ClickHdl, Button*, void );
DECL_LINK( MenuHdl, ScExtIButton&, void );
DECL_LINK( MenuHdl, MenuButton*, void );
};
class ScRightHeaderEditPage : public ScHFEditPage
......
......@@ -24,6 +24,7 @@
#include <svx/pageitem.hxx>
#include <vcl/group.hxx>
#include <vcl/lstbox.hxx>
#include <vcl/menubtn.hxx>
#include <vcl/timer.hxx>
#include <vcl/virdev.hxx>
#include <scdllapi.h>
......@@ -97,38 +98,6 @@ private:
std::function<void (ScEditWindow&)> m_GetFocusLink;
};
class SC_DLLPUBLIC ScExtIButton final : public ImageButton
{
Idle aIdle;
VclPtr<PopupMenu> pPopupMenu;
Link<ScExtIButton&,void> aMLink;
sal_uInt16 nSelected;
OString aSelectedIdent;
DECL_DLLPRIVATE_LINK( TimerHdl, Timer*, void );
virtual void MouseButtonDown( const MouseEvent& rMEvt ) override;
virtual void MouseButtonUp( const MouseEvent& rMEvt) override;
virtual void Click() override;
void StartPopup();
public:
ScExtIButton(vcl::Window* pParent, WinBits nBits );
virtual ~ScExtIButton() override;
virtual void dispose() override;
void SetPopupMenu(PopupMenu* pPopUp);
sal_uInt16 GetSelected() const { return nSelected;}
const OString& GetSelectedIdent() const { return aSelectedIdent;}
void SetMenuHdl( const Link<ScExtIButton&,void>& rLink ) { aMLink = rLink; }
virtual bool PreNotify( NotifyEvent& rNEvt ) override;
};
#endif // INCLUDED_SC_SOURCE_UI_INC_TPHFEDIT_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
......@@ -91,7 +91,7 @@ ScHFEditPage::ScHFEditPage( vcl::Window* pParent,
m_pBtnFile->SetPopupMenu(get_menu("popup"));
m_pLbDefined->SetSelectHdl( LINK( this, ScHFEditPage, ListHdl_Impl ) );
m_pBtnFile->SetMenuHdl( LINK( this, ScHFEditPage, MenuHdl ) );
m_pBtnFile->SetSelectHdl( LINK( this, ScHFEditPage, MenuHdl ) );
m_pBtnText->SetClickHdl( LINK( this, ScHFEditPage, ClickHdl ) );
m_pBtnPage->SetClickHdl( LINK( this, ScHFEditPage, ClickHdl ) );
m_pBtnLastPage->SetClickHdl( LINK( this, ScHFEditPage, ClickHdl ) );
......@@ -799,13 +799,12 @@ IMPL_LINK( ScHFEditPage, ClickHdl, Button*, pBtn, void )
m_pEditFocus->GrabFocus();
}
IMPL_LINK( ScHFEditPage, MenuHdl, ScExtIButton&, rBtn, void )
IMPL_LINK(ScHFEditPage, MenuHdl, MenuButton*, pBtn, void)
{
if (!m_pEditFocus)
return;
SAL_WARN_IF(rBtn.GetSelected() == 0, "sc.ui", "nothing selected");
OString sSelectedId = rBtn.GetSelectedIdent();
OString sSelectedId = pBtn->GetCurItemIdent();
if (sSelectedId == "title")
{
......
......@@ -335,97 +335,4 @@ css::uno::Reference< css::accessibility::XAccessible > ScEditWindow::CreateAcces
return pAcc;
}
ScExtIButton::ScExtIButton(vcl::Window* pParent, WinBits nBits )
: ImageButton(pParent,nBits),
aIdle("sc pagedlg ScExtIButton"),
pPopupMenu(nullptr)
{
nSelected=0;
aIdle.SetPriority(TaskPriority::LOWEST);
SetDropDown(PushButtonDropdownStyle::Toolbox);
}
ScExtIButton::~ScExtIButton()
{
disposeOnce();
}
void ScExtIButton::dispose()
{
pPopupMenu.clear();
ImageButton::dispose();
}
VCL_BUILDER_FACTORY_ARGS(ScExtIButton, 0 /* WB_BORDER|WB_TABSTOP */)
void ScExtIButton::SetPopupMenu(PopupMenu* pPopUp)
{
pPopupMenu=pPopUp;
}
void ScExtIButton::MouseButtonDown( const MouseEvent& rMEvt )
{
if(!aIdle.IsActive())
{
aIdle.SetInvokeHandler(LINK( this, ScExtIButton, TimerHdl));
aIdle.Start();
}
ImageButton::MouseButtonDown(rMEvt );
}
void ScExtIButton::MouseButtonUp( const MouseEvent& rMEvt)
{
aIdle.Stop();
aIdle.ClearInvokeHandler();
ImageButton::MouseButtonUp(rMEvt );
}
void ScExtIButton::Click()
{
aIdle.Stop();
aIdle.ClearInvokeHandler();
ImageButton::Click();
}
void ScExtIButton::StartPopup()
{
nSelected=0;
aSelectedIdent.clear();
if(pPopupMenu!=nullptr)
{
SetPressed( true );
EndSelection();
Point aPoint(0,0);
aPoint.setY(GetOutputSizePixel().Height() );
nSelected = pPopupMenu->Execute( this, aPoint );
if(nSelected)
{
aSelectedIdent = pPopupMenu->GetItemIdent(nSelected);
aMLink.Call(*this);
}
SetPressed( false);
}
}
bool ScExtIButton::PreNotify( NotifyEvent& rNEvt )
{
MouseNotifyEvent nSwitch=rNEvt.GetType();
if(nSwitch==MouseNotifyEvent::MOUSEBUTTONUP)
{
MouseButtonUp(*rNEvt.GetMouseEvent());
}
return ImageButton::PreNotify(rNEvt );
}
IMPL_LINK_NOARG(ScExtIButton, TimerHdl, Timer *, void)
{
StartPopup();
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
......@@ -239,10 +239,11 @@
</packing>
</child>
<child>
<object class="sclo-ScExtIButton" id="buttonBTN_FILE">
<object class="GtkMenuButton" id="buttonBTN_FILE">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="receives_default">True</property>
<property name="has_tooltip">True</property>
<property name="tooltip_text" translatable="yes" context="headerfootercontent|buttonBTN_FILE|tooltip_text">Title</property>
<property name="image">imageBTN_FILE</property>
</object>
......@@ -260,7 +261,6 @@
<property name="has_tooltip">True</property>
<property name="tooltip_text" translatable="yes" context="headerfootercontent|buttonBTN_TABLE|tooltip_text">Sheet Name</property>
<property name="image">imageBTN_TABLE</property>
<property name="yalign">0.47999998927116394</property>
</object>
<packing>
<property name="expand">False</property>
......@@ -291,7 +291,6 @@
<property name="has_tooltip">True</property>
<property name="tooltip_text" translatable="yes" context="headerfootercontent|buttonBTN_PAGES|tooltip_text">Pages</property>
<property name="image">imageBTN_PAGES</property>
<property name="yalign">0.49000000953674316</property>
</object>
<packing>
<property name="expand">False</property>
......@@ -307,7 +306,6 @@
<property name="has_tooltip">True</property>
<property name="tooltip_text" translatable="yes" context="headerfootercontent|buttonBTN_DATE|tooltip_text">Date</property>
<property name="image">imageBTN_DATE</property>
<property name="yalign">0.37000000476837158</property>
</object>
<packing>
<property name="expand">False</property>
......@@ -323,7 +321,6 @@
<property name="has_tooltip">True</property>
<property name="tooltip_text" translatable="yes" context="headerfootercontent|buttonBTN_TIME|tooltip_text">Time</property>
<property name="image">imageBTN_TIME</property>
<property name="yalign">0.41999998688697815</property>
</object>
<packing>
<property name="expand">False</property>
......
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