1 // TortoiseGitMerge - a Diff/Patch program
3 // Copyright (C) 2023 - TortoiseGit
4 // Copyright (C) 2017 - TortoiseSVN
6 // This program is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU General Public License
8 // as published by the Free Software Foundation; either version 2
9 // of the License, or (at your option) any later version.
11 // This program is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 // GNU General Public License for more details.
16 // You should have received a copy of the GNU General Public License
17 // along with this program; if not, write to the Free Software Foundation,
18 // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
22 class CNativeRibbonDynamicItemInfo
25 CNativeRibbonDynamicItemInfo(UINT cmdId
, const CString
& text
, UINT imageId
)
32 const CString
& GetLabel() const { return m_Text
; }
33 UINT
GetCommandId() const { return m_CmdId
; }
34 UINT
GetImageId() const { return m_ImageId
; }
41 class CNativeRibbonApp
: public IUIApplication
, public IUICommandHandler
44 CNativeRibbonApp(CFrameWnd
* pFrame
, IUIFramework
* pFramework
);
47 void SetSettingsFileName(const CString
& file
)
49 m_SettingsFileName
= file
;
52 void UpdateCmdUI(BOOL bDisableIfNoHandler
);
53 int GetRibbonHeight();
54 void SetItems(UINT cmdId
, const std::list
<CNativeRibbonDynamicItemInfo
>& items
);
58 STDMETHOD(QueryInterface
)(REFIID riid
, void** ppvObject
);
59 STDMETHOD_(ULONG
, AddRef
)(void);
60 STDMETHOD_(ULONG
, Release
)(void);
63 STDMETHOD(OnViewChanged
)(UINT32 viewId
, UI_VIEWTYPE typeID
, IUnknown
* view
, UI_VIEWVERB verb
, INT32 uReasonCode
);
65 STDMETHOD(OnCreateUICommand
)(UINT32 commandId
, UI_COMMANDTYPE typeID
, IUICommandHandler
** commandHandler
);
67 STDMETHOD(OnDestroyUICommand
)(UINT32 commandId
, UI_COMMANDTYPE typeID
, IUICommandHandler
* commandHandler
);
70 STDMETHOD(Execute
)(UINT32 commandId
, UI_EXECUTIONVERB verb
, const PROPERTYKEY
* key
, const PROPVARIANT
* currentValue
, IUISimplePropertySet
* commandExecutionProperties
);
72 STDMETHOD(UpdateProperty
)(UINT32 commandId
, REFPROPERTYKEY key
, const PROPVARIANT
* currentValue
, PROPVARIANT
* newValue
);
74 HRESULT
SaveRibbonViewSettings(IUIRibbon
* pRibbonView
, const CString
& fileName
);
75 HRESULT
LoadRibbonViewSettings(IUIRibbon
* pRibbonView
, const CString
& fileName
);
76 CComPtr
<IUICollection
> GetUICommandItemsSource(UINT commandId
);
77 void SetUICommandItemsSource(UINT commandId
, IUICollection
* pItems
);
78 static UINT
GetCommandIdProperty(IUISimplePropertySet
* propertySet
);
81 CFrameWnd
* m_pFrame
= nullptr;
82 CComPtr
<IUIFramework
> m_pFramework
;
83 std::list
<UINT32
> m_commandIds
;
84 std::list
<UINT32
> m_collectionCommandIds
;
85 ULONG m_cRefCount
= 0;
86 CString m_SettingsFileName
;