rename and explain the MENUBUTTON_MENUMODE_TIMED stuff
Change-Id: Ifc6ddfb0cc249e537c01f28bab84b42c6b1577d9
This commit is contained in:
@@ -279,7 +279,7 @@ RemoteFilesDialog::RemoteFilesDialog( vcl::Window* pParent, PickerFlags nBits )
|
|||||||
m_pName_ed->SetGetFocusHdl( LINK( this, RemoteFilesDialog, FileNameGetFocusHdl ) );
|
m_pName_ed->SetGetFocusHdl( LINK( this, RemoteFilesDialog, FileNameGetFocusHdl ) );
|
||||||
m_pName_ed->SetModifyHdl( LINK( this, RemoteFilesDialog, FileNameModifyHdl ) );
|
m_pName_ed->SetModifyHdl( LINK( this, RemoteFilesDialog, FileNameModifyHdl ) );
|
||||||
|
|
||||||
m_pAddService_btn->SetMenuMode( MENUBUTTON_MENUMODE_TIMED );
|
m_pAddService_btn->SetDelayMenu( true );
|
||||||
m_pAddMenu = m_pAddService_btn->GetPopupMenu();
|
m_pAddMenu = m_pAddService_btn->GetPopupMenu();
|
||||||
m_pAddService_btn->SetClickHdl( LINK( this, RemoteFilesDialog, AddServiceHdl ) );
|
m_pAddService_btn->SetClickHdl( LINK( this, RemoteFilesDialog, AddServiceHdl ) );
|
||||||
m_pAddService_btn->SetSelectHdl( LINK( this, RemoteFilesDialog, EditServiceMenuHdl ) );
|
m_pAddService_btn->SetSelectHdl( LINK( this, RemoteFilesDialog, EditServiceMenuHdl ) );
|
||||||
|
@@ -95,7 +95,7 @@ SvtFileDialogURLSelector::SvtFileDialogURLSelector( vcl::Window* _pParent, SvtFi
|
|||||||
{
|
{
|
||||||
SetStyle( GetStyle() | WB_NOPOINTERFOCUS | WB_RECTSTYLE | WB_SMALLSTYLE );
|
SetStyle( GetStyle() | WB_NOPOINTERFOCUS | WB_RECTSTYLE | WB_SMALLSTYLE );
|
||||||
SetModeImage( _pDlg->GetButtonImage( _nButtonId ) );
|
SetModeImage( _pDlg->GetButtonImage( _nButtonId ) );
|
||||||
SetMenuMode( MENUBUTTON_MENUMODE_TIMED );
|
SetDelayMenu( true );
|
||||||
SetDropDown( PushButtonDropdownStyle::Toolbox );
|
SetDropDown( PushButtonDropdownStyle::Toolbox );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -28,8 +28,6 @@ class PopupMenu;
|
|||||||
class VclBuilder;
|
class VclBuilder;
|
||||||
class VclSimpleEvent;
|
class VclSimpleEvent;
|
||||||
|
|
||||||
#define MENUBUTTON_MENUMODE_TIMED ((sal_uInt16)0x0001)
|
|
||||||
|
|
||||||
class VCL_DLLPUBLIC MenuButton : public PushButton
|
class VCL_DLLPUBLIC MenuButton : public PushButton
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
@@ -38,7 +36,7 @@ private:
|
|||||||
Timer* mpMenuTimer;
|
Timer* mpMenuTimer;
|
||||||
VclPtr<PopupMenu> mpMenu;
|
VclPtr<PopupMenu> mpMenu;
|
||||||
sal_uInt16 mnCurItemId;
|
sal_uInt16 mnCurItemId;
|
||||||
sal_uInt16 mnMenuMode;
|
bool mbDelayMenu;
|
||||||
Link<MenuButton*,void> maActivateHdl;
|
Link<MenuButton*,void> maActivateHdl;
|
||||||
Link<MenuButton*,void> maSelectHdl;
|
Link<MenuButton*,void> maSelectHdl;
|
||||||
|
|
||||||
@@ -65,7 +63,13 @@ public:
|
|||||||
|
|
||||||
void ExecuteMenu();
|
void ExecuteMenu();
|
||||||
|
|
||||||
void SetMenuMode(sal_uInt16 nMode) { mnMenuMode = nMode; }
|
//if false then the whole button launches the menu
|
||||||
|
//if true, then the button has a separator
|
||||||
|
//where the right portion launches the menu immediately
|
||||||
|
//where the left portion activates the underlying Button handlers
|
||||||
|
//before launching the menu in an idle, allowing it to be cancelled
|
||||||
|
//before being shown
|
||||||
|
void SetDelayMenu(bool bDelay) { mbDelayMenu = bDelay; }
|
||||||
|
|
||||||
void SetPopupMenu( PopupMenu* pNewMenu );
|
void SetPopupMenu( PopupMenu* pNewMenu );
|
||||||
PopupMenu* GetPopupMenu() const { return mpMenu; }
|
PopupMenu* GetPopupMenu() const { return mpMenu; }
|
||||||
|
@@ -262,8 +262,8 @@ void BackingWindow::initControls()
|
|||||||
mpLocalView->SetStyle( mpLocalView->GetStyle() | WB_VSCROLL);
|
mpLocalView->SetStyle( mpLocalView->GetStyle() | WB_VSCROLL);
|
||||||
mpLocalView->Hide();
|
mpLocalView->Hide();
|
||||||
|
|
||||||
mpTemplateButton->SetMenuMode( MENUBUTTON_MENUMODE_TIMED );
|
mpTemplateButton->SetDelayMenu(true);
|
||||||
mpRecentButton->SetMenuMode( MENUBUTTON_MENUMODE_TIMED );
|
mpRecentButton->SetDelayMenu(true);
|
||||||
|
|
||||||
//set handlers
|
//set handlers
|
||||||
mpLocalView->setCreateContextMenuHdl(LINK(this, BackingWindow, CreateContextMenuHdl));
|
mpLocalView->setCreateContextMenuHdl(LINK(this, BackingWindow, CreateContextMenuHdl));
|
||||||
|
@@ -33,7 +33,7 @@ void MenuButton::ImplInitMenuButtonData()
|
|||||||
mpMenuTimer = nullptr;
|
mpMenuTimer = nullptr;
|
||||||
mpMenu = nullptr;
|
mpMenu = nullptr;
|
||||||
mnCurItemId = 0;
|
mnCurItemId = 0;
|
||||||
mnMenuMode = 0;
|
mbDelayMenu = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void MenuButton::ImplInit( vcl::Window* pParent, WinBits nStyle )
|
void MenuButton::ImplInit( vcl::Window* pParent, WinBits nStyle )
|
||||||
@@ -105,7 +105,7 @@ IMPL_LINK_NOARG(MenuButton, ImplMenuTimeoutHdl, Timer *, void)
|
|||||||
void MenuButton::MouseButtonDown( const MouseEvent& rMEvt )
|
void MenuButton::MouseButtonDown( const MouseEvent& rMEvt )
|
||||||
{
|
{
|
||||||
bool bExecute = true;
|
bool bExecute = true;
|
||||||
if ( mnMenuMode & MENUBUTTON_MENUMODE_TIMED )
|
if (mbDelayMenu)
|
||||||
{
|
{
|
||||||
// If the separated dropdown symbol is not hit, delay the popup execution
|
// If the separated dropdown symbol is not hit, delay the popup execution
|
||||||
if( mnDDStyle != PushButtonDropdownStyle::MenuButton || // no separator at all
|
if( mnDDStyle != PushButtonDropdownStyle::MenuButton || // no separator at all
|
||||||
@@ -141,7 +141,7 @@ void MenuButton::KeyInput( const KeyEvent& rKEvt )
|
|||||||
sal_uInt16 nCode = aKeyCode.GetCode();
|
sal_uInt16 nCode = aKeyCode.GetCode();
|
||||||
if ( (nCode == KEY_DOWN) && aKeyCode.IsMod2() )
|
if ( (nCode == KEY_DOWN) && aKeyCode.IsMod2() )
|
||||||
ExecuteMenu();
|
ExecuteMenu();
|
||||||
else if ( !(mnMenuMode & MENUBUTTON_MENUMODE_TIMED) &&
|
else if ( !mbDelayMenu &&
|
||||||
!aKeyCode.GetModifier() &&
|
!aKeyCode.GetModifier() &&
|
||||||
((nCode == KEY_RETURN) || (nCode == KEY_SPACE)) )
|
((nCode == KEY_RETURN) || (nCode == KEY_SPACE)) )
|
||||||
ExecuteMenu();
|
ExecuteMenu();
|
||||||
|
Reference in New Issue
Block a user