bestkakkoii 发表于 2024-3-19 11:48:40

关于炫彩界面类的模块使用

本帖最后由 bestkakkoii 于 2024-3-19 12:00 编辑

有关CXWindow类(窗口类)

/*
    建议可以把CXWindow窗口事件弄个纯虚函数
    这样固定事件名称只要继承就直接可以使用比较方便
    用户有继承就内部就调用,没继承就不调用,无需另外绑定
    点IDE设计器那边添加事件的时后帮他把继承函数写上去就好
    比如:virtual 固定事件函数名(...) override { return 0; }
*/

class CXWindow : public CXObjectUI
{

    virtual int PaintEvent(HWINDOW hWindow, HDRAW hDraw, BOOL* pBlockMessage) = 0;

    virtual int PaintEndEvent(HWINDOW hWindow, HDRAW hDraw, BOOL* pBlockMessage) = 0;

    virtual int CloseEvent(HWINDOW hWindow, BOOL* pBlockMessage) = 0;

    virtual int DistoryEvent(HWINDOW hWindow, BOOL* pBlockMessage) = 0;

    virtual int NonClientAreaDistoryEvent(HWINDOW hWindow, BOOL* pBlockMessage) = 0;

    virtual int MouseMoveEvent(HWINDOW hWindow, int nFlags, POINT* pPt, BOOL* pBlockMessage) = 0;

    virtual int MouseLeftButtonDownEvent(HWINDOW hWindow, int nFlags, POINT* pPt, BOOL* pBlockMessage) = 0;

    virtual int MouseLeftButtonUpEvent(HWINDOW hWindow, int nFlags, POINT* pPt, BOOL* pBlockMessage) = 0;

    virtual int MouseRightButtonDownEvent(HWINDOW hWindow, int nFlags, POINT* pPt, BOOL* pBlockMessage) = 0;

    virtual int MouseRightButtonUpEvent(HWINDOW hWindow, int nFlags, POINT* pPt, BOOL* pBlockMessage) = 0;

    virtual int MouseLeftButtonDoubleClickEvent(HWINDOW hWindow, int nFlags, POINT* pPt, BOOL* pBlockMessage) = 0;

    virtual int MouseRightButtonDoubleClickEvent(HWINDOW hWindow, int nFlags, POINT* pPt, BOOL* pBlockMessage) = 0;

    virtual int MouseWheelMoveEvent(HWINDOW hWindow, int nFlags, POINT* pPt, BOOL* pBlockMessage) = 0;

    virtual int Event(HWINDOW hWindow, BOOL* pBlockMessage) = 0;

    virtual int MouseEnterEvent(HWINDOW hWindow, int nFlags, POINT* pPt, BOOL* pBlockMessage) = 0;

    virtual int MouseLeaveEvent(HWINDOW hWindow, BOOL* pBlockMessage) = 0;

    virtual int ResizeEvent(HWINDOW hWindow, int nFlags, SIZE* pSize, BOOL* pBlockMessage) = 0;

    virtual int TimerEvent(HWINDOW hWindow, int nIDEvent, BOOL* pBlockMessage) = 0;

    virtual int SetFocusEvent(HWINDOW hWindow, BOOL* pBlockMessage) = 0;

    virtual int LoseFocusEvent(HWINDOW hWindow, BOOL* pBlockMessage) = 0;

    virtual int KeyDownEvent(HWINDOW hWindow, int wParam, int lParam, BOOL* pBlockMessage) = 0;

    virtual int KeyUpEvent(HWINDOW hWindow, HWND hWnd, BOOL* pBlockMessage) = 0;

    virtual int SetCursorEvent(HWINDOW hWindow, int wParam, int lParam, BOOL* pBlockMessage) = 0;

    virtual int CharInputEvent(HWINDOW hWindow, int wParam, int lParam, BOOL* pBlockMessage) = 0;

    virtual int DropEvent(HWINDOW hWindow, HDROP hDropInfo, BOOL* pBlockMessage) = 0;

    virtual int NativeEvent(HWINDOW hWindow, int message, int wParam, int lParam, BOOL* pBlockMessage) = 0;

    virtual int XCTimerEvent(HWINDOW hWindow, int nTimerID, BOOL* pBlockMessage) = 0;

    virtual int MenuPopEvent(HWINDOW hWindow, HMENUX hMenu, BOOL* pBlockMessage) = 0;

    virtual int MenuPopWindowEvent(HWINDOW hWindow, HMENUX hMenu, menu_popupWnd_* pInfo, BOOL* pBlockMessage) = 0;

    virtual int MenuSelectionEvent(HWINDOW hWindow, int nID, BOOL* pBlockMessage) = 0;

    virtual int MenuCloseEvent(HWINDOW hWindow, BOOL* pBlockMessage) = 0;

    virtual int MenuPaintEvent(HWINDOW hWindow, HDRAW hDraw, menu_drawBackground_* pInfo, BOOL* pBlockMessage) = 0;

    virtual int MenuItemPaintEvent(HWINDOW hWindow, HDRAW hDraw, menu_drawItem_* pInfo, BOOL* pBlockMessage) = 0;

    virtual int TrayIconEvent(HWINDOW hWindow, int wParam, int lParam, BOOL* pBlockMessage) = 0;

};

有关CXList类(列表类)/*
那些控件 比如列表(CXList)最好每一个单元格都有自己的类指针

同上,固定事件采用继承的方式
*/

clas CXList : public CXScrollView
{
    virtual int ItemClickEvent(POINT* pPt, CXListItem* pItem, BOOL* pBlockEvent) = 0;
    virtual int ItemDoubleClickEvent(POINT* pPt, CXListItem* pItem, BOOL* pBlockEvent) = 0;
};

/*
    有关 CXListItem 定义大致如下
*/

class CXListItem
{
    CXListItem() = default
    CXListItem(const CXText& text, const CXText& tip = L"")
    HWINDOW parent() const;
    int row() const;
    int column() const;
    CXFont font() const; // CXFont接受 字体名称、和其他各种细节设置
    CXText text() const;
    // CXColor 支持 RGB(0, 0, 0), RGBA(0, 0, 0, 0), #000, #000000, #00000000, COLORREF ..
    CXColor background() const
    CXColor color() const
    CXVariant data() const // CXVariant union多类型保存
    bool IsSelected() const;
    void SetFont(const Font& font);
    void SetText(const CXText& text);
    void SetTextAlignment(Alignment alignment)
    void SetIcon(const CXIcon& icon); // CXIcon 支持本地路径、RC、元素句柄 ...
    void SetColor(const CXColor& color); .
    void SetBackgroundColor(const CXColor& color);
    void SetToolTip(const CXText& text, int timeout = -1);
    void SetData(const CXVariant& value) // CXVariant union多类型保存
};







页: [1]
查看完整版本: 关于炫彩界面类的模块使用