Kaydet (Commit) 29a2ff58 authored tarafından Caolán McNamara's avatar Caolán McNamara

we can just use a PopupMenu* here

rather than a ScPopupMenu*, we don't use anything added by
ScPopupMenu to PopupMenu.

While I'm at it, expose the wrapped selected identity of
the popup through the drop-down menu button

Change-Id: Id92f4a03fca19140e624d577f888135c5b227192
üst 201f5fb6
......@@ -98,9 +98,10 @@ class SC_DLLPUBLIC ScExtIButton : public ImageButton
private:
Timer aTimer;
ScPopupMenu* pPopupMenu;
PopupMenu* pPopupMenu;
Link aMLink;
sal_uInt16 nSelected;
sal_uInt16 nSelected;
OString aSelectedIdent;
SC_DLLPRIVATE DECL_LINK( TimerHdl, void*);
......@@ -116,9 +117,10 @@ public:
ScExtIButton(Window* pParent, const ResId& rResId );
void SetPopupMenu(ScPopupMenu* pPopUp);
void SetPopupMenu(PopupMenu* pPopUp);
sal_uInt16 GetSelected();
sal_uInt16 GetSelected() const;
OString GetSelectedIdent() const;
void SetMenuHdl( const Link& rLink ) { aMLink = rLink; }
const Link& GetMenuHdl() const { return aMLink; }
......
......@@ -348,16 +348,21 @@ ScExtIButton::ScExtIButton(Window* pParent, const ResId& rResId )
SetDropDown( true);
}
void ScExtIButton::SetPopupMenu(ScPopupMenu* pPopUp)
void ScExtIButton::SetPopupMenu(PopupMenu* pPopUp)
{
pPopupMenu=pPopUp;
}
sal_uInt16 ScExtIButton::GetSelected()
sal_uInt16 ScExtIButton::GetSelected() const
{
return nSelected;
}
OString ScExtIButton::GetSelectedIdent() const
{
return aSelectedIdent;
}
void ScExtIButton::MouseButtonDown( const MouseEvent& rMEvt )
{
if(!aTimer.IsActive())
......@@ -368,6 +373,7 @@ void ScExtIButton::MouseButtonDown( const MouseEvent& rMEvt )
ImageButton::MouseButtonDown(rMEvt );
}
void ScExtIButton::MouseButtonUp( const MouseEvent& rMEvt)
{
aTimer.Stop();
......@@ -385,6 +391,7 @@ void ScExtIButton::Click()
void ScExtIButton::StartPopup()
{
nSelected=0;
aSelectedIdent = OString();
if(pPopupMenu!=NULL)
{
......@@ -393,12 +400,14 @@ void ScExtIButton::StartPopup()
Point aPoint(0,0);
aPoint.Y()=GetOutputSizePixel().Height();
nSelected=pPopupMenu->Execute( this, aPoint );
nSelected = pPopupMenu->Execute( this, aPoint );
if(nSelected)
{
aSelectedIdent = pPopupMenu->GetItemIdent(nSelected);
aMLink.Call(this);
}
SetPressed( false);
}
}
......
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