|
|
#pragma once
|
|
|
|
|
|
#include "iDlgBaseEx.h"
|
|
|
#include "iRibbonXmlTab.h"
|
|
|
#include "iGuiRibbon_global.h"
|
|
|
|
|
|
namespace Ui {
|
|
|
class iWxRibbon;
|
|
|
}
|
|
|
|
|
|
class QMenu;
|
|
|
|
|
|
class I_GUI_RIBBON_EXPORT iWxRibbon : public iDlgBaseEx
|
|
|
{
|
|
|
Q_OBJECT
|
|
|
|
|
|
public:
|
|
|
|
|
|
// 如果自行传入sXmlName(文件名,不带后缀),且bToolbarExt为true,则为ToolBar扩展模式
|
|
|
explicit iWxRibbon(QString sXmlName = "", \
|
|
|
bool bToolbarExt = false, \
|
|
|
QWidget *parent = 0);
|
|
|
~iWxRibbon();
|
|
|
|
|
|
void initUI();
|
|
|
|
|
|
// 类Wps文件模式定制
|
|
|
void setWpsLike(bool b);
|
|
|
|
|
|
// 返回部分指针变量
|
|
|
vecRibbonTabPtr* getRibbonStruts();
|
|
|
QVector<QWidget*>* getSubCtrls();
|
|
|
QVector<QAction *>* getMenuActions();
|
|
|
|
|
|
// 根据辅助信息返回cmd
|
|
|
iRibbonXmlCmd* getCmdByExtInfo(QString sExtInfo);
|
|
|
|
|
|
// 根据ID返回cmd
|
|
|
iRibbonXmlCmd* getCmdByID(QString sID);
|
|
|
|
|
|
//ZXF202409得到按钮(为了更新按钮的子项例如窗口个数管理)
|
|
|
QWidget* getSubCtrl(QString sID);
|
|
|
|
|
|
//更新按钮(主要是子项)
|
|
|
bool refreshSubCtrl(QString sID, QStringList listSubWnds, QVector<bool> vecShows);
|
|
|
|
|
|
// 最近打开
|
|
|
bool refreshRecentProjects(QString& sPath); //最近打开
|
|
|
bool fillUIOfRecentProjects(); //更新最近打开菜单项
|
|
|
bool removeFromRecentProjects(QString sUrl);
|
|
|
|
|
|
protected:
|
|
|
|
|
|
// paint
|
|
|
virtual void paintEvent(QPaintEvent *);
|
|
|
|
|
|
private slots:
|
|
|
|
|
|
void on_tabWxMain_tabCloseRequested(int index);
|
|
|
void on_tabWxMain_currentChanged(int index);
|
|
|
void on_tabWxMain_customContextMenuRequested(const QPoint &pos);
|
|
|
|
|
|
void slotTabItemDoubleClicked(int n);
|
|
|
void slotGroupActivated(int n);
|
|
|
|
|
|
void slotBtnClicked(); //Btn
|
|
|
void slotMenuItemClicked(); //文件菜单Item
|
|
|
void slotListCtrlIndexChanged(int); //Combox ListWx
|
|
|
void slotCheckCtrlClicked(bool); //CheckBox, RadioBox
|
|
|
|
|
|
|
|
|
void slotFileClicked(); //File
|
|
|
|
|
|
void slotOpentRecent();
|
|
|
|
|
|
signals:
|
|
|
|
|
|
/// @title File按钮信号触发
|
|
|
void sigRibbonFileActivated();
|
|
|
|
|
|
/// @title Ribbon信号触发
|
|
|
/// @param pCtrl触发的子控件
|
|
|
/// @param pInfo关联的Ribbon配置信息(来自xml)
|
|
|
void sigRibbonActioned(QWidget* pCtrl,
|
|
|
iRibbonXmlCmd* pInfo,
|
|
|
QVariant o);
|
|
|
|
|
|
/// @title Ribbon文件菜单信号触发
|
|
|
/// @param sID菜单ID
|
|
|
/// @param sName菜单名称
|
|
|
void sigRibbonFileMenuClicked(QString sID, QString sName);
|
|
|
|
|
|
/// @title 触发信号由外界处理最近文档
|
|
|
void sigFileRecentActivated(QString sUrl);
|
|
|
|
|
|
/// @title Ribbon信号触发
|
|
|
/// @param pCtrl触发的子控件
|
|
|
/// @param pInfo关联的Ribbon配置信息(来自xml)
|
|
|
/// @param listValues显示部分
|
|
|
/// @param listIDs
|
|
|
void sigRibbonGetListValues(QWidget* pCtrl,
|
|
|
iRibbonXmlCmd* pInfo,
|
|
|
QStringList& listValues,
|
|
|
QStringList& listIDs,
|
|
|
int& nCurSel);
|
|
|
void sigRibbonListWxCurChanged(QWidget* pCtrl,
|
|
|
iRibbonXmlCmd* pInfo,
|
|
|
int nCurSel);
|
|
|
void sigRibbonCheckWxClicked(QWidget* pCtrl,
|
|
|
iRibbonXmlCmd* pInfo,
|
|
|
bool bSelect);
|
|
|
|
|
|
// 某一Group被激活
|
|
|
void sigRibbonGroupActivated(iRibbonXmlGroup* pGroup);
|
|
|
|
|
|
// 20190425
|
|
|
// 允许外界对FileMenu进行调整
|
|
|
// 触发此信号时,pMenu已经填入xml中配置的菜单项
|
|
|
void sigAdjustFileMenu(QMenu*& pMenu);
|
|
|
|
|
|
private:
|
|
|
|
|
|
// load Xml And Ini
|
|
|
void loadIniInfos();
|
|
|
void loadXmlStructs();
|
|
|
|
|
|
// 初始化
|
|
|
void initUI_TabWx();
|
|
|
void initUI_Menu(QMenu*& pMenu);
|
|
|
QWidget* createTabBy(iRibbonXmlTab* pTab);
|
|
|
QWidget* createGroupBy(iRibbonXmlGroup* pGroup);
|
|
|
QWidget* createCmdBy(iRibbonXmlCmd* pCmd);
|
|
|
QWidget* createCmdBy_Btn(iRibbonXmlCmd* pCmd);
|
|
|
QWidget* createCmdBy_Combo(iRibbonXmlCmd* pCmd);
|
|
|
QWidget* createCmdBy_Check(iRibbonXmlCmd* pCmd);
|
|
|
QWidget* createCmdBy_Radio(iRibbonXmlCmd* pCmd);
|
|
|
QWidget* createCmdBy_Text(iRibbonXmlCmd* pCmd);
|
|
|
QWidget* createCmdBy_Label(iRibbonXmlCmd* pCmd);
|
|
|
QWidget* createCmdBy_ListWx(iRibbonXmlCmd* pCmd);
|
|
|
|
|
|
//新增加边界框
|
|
|
QWidget* createCmdBy_LineEdit(iRibbonXmlCmd* pCmd);
|
|
|
|
|
|
bool dealwithCmdSubBy(iRibbonXmlCmd* pCmd, QToolButton*& pBtn);
|
|
|
|
|
|
// 切换正常模式和简缩模式
|
|
|
void swapTabMode(); //
|
|
|
|
|
|
// 绘制Logo
|
|
|
void drawAppInfo(QPainter* painter);
|
|
|
|
|
|
// 获取当前Tab页中的所有Group的宽度
|
|
|
int getCurTabValidWidth();
|
|
|
|
|
|
// 虚拟按钮的响应
|
|
|
// 如果返回true,则不再触发信号,否则触发
|
|
|
virtual bool runByVirtualBtn();
|
|
|
|
|
|
private:
|
|
|
|
|
|
Ui::iWxRibbon *ui;
|
|
|
|
|
|
QString m_sXmlName; //可以外部设定,只是文件名,不带xml后缀
|
|
|
bool m_bToolbarExt;//类ToolBar模式
|
|
|
|
|
|
// 简缩模式相关
|
|
|
bool m_bSimple;
|
|
|
int m_nLastSel;
|
|
|
|
|
|
// 类Wps文件模式定制
|
|
|
bool m_bWpsLike;
|
|
|
|
|
|
// 配置化结构体
|
|
|
vecRibbonTabPtr m_vecTabXmls;
|
|
|
|
|
|
// 模块相关,从ini中读取出来
|
|
|
QString m_sIcon;
|
|
|
QString m_sAppDescCH;
|
|
|
QString m_sAppDescEN;
|
|
|
|
|
|
// 所有的控件
|
|
|
QVector<QWidget*> m_vecSubCtrls;
|
|
|
QVector<QAction*> m_vecMenuActions;
|
|
|
|
|
|
// 最近打开项目
|
|
|
enum { MaxRecentProjects = 5 };
|
|
|
QAction* m_oRecentProjectActs[MaxRecentProjects];
|
|
|
QStringList m_listRencentProjects;
|
|
|
QMenu* m_pMenuRecent;
|
|
|
};
|