xj qian
2024-06-25 46bf65da8237cb34a62bbe0d6d4b8ba2bb2dc7b1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
#pragma once
#include "kcontrol.hpp"
#include "win32/win.hpp"
using KXMLDOMElementt=Hxsoft::XFrame::KXMLDOMDocument;
using KXMLDOMElement=Hxsoft::XFrame::KXMLDOMElement;
namespace Hxsoft{ namespace XFrame
{
    #define LayerFlow_None            0x00000001        //not layer space
    #define LayerFlow_WE            0x00000002
    #define LayerFlow_NS            0x00000004
    #define LayerFlow_FreeForm        0x00000008
    #define LayerFlow_Control        0x00000010
    #define LayerFlow_HtmlFlow        0x00000020
    #define LayerFlow_Sheets        0x00000040
    #define LayerFlow_Hidden        0x00000080        //not show but layer space
    #define LayerFlow_UnLayer        0x00000100        //not show and not layer space
    
    #define    LayerFlow_NotLayerNode    (LayerFlow_None | LayerFlow_UnLayer)
    #define LayerFlow_LayerChild    (LayerFlow_WE|LayerFlow_NS|LayerFlow_FreeForm|LayerFlow_Sheets| LayerFlow_HtmlFlow )
 
    class IXFControl;
    class IXPage;
    class IXNode
    {
    public:
        LPCWSTR GetNodeName();
        LPCWSTR GetNodeID();
    public:
        int SetNodeName(LPCWSTR pNodeName);
        int SetNodeID(LPCWSTR pNodeID);
    public:
        LPCWSTR GetCaption();
        int SetCaption(LPCWSTR pCaption);
    public:
        IXNode * GetNodeByID(LPCWSTR pStrNodeID);
        IXNode * GetNodeByName(LPCWSTR pStrName);
    public:
        IXNode * GetXNode();
        IXPage * GetXPage();
        KXMLDOMElement  GetElement();
    public:
        IXNode * GetRootNode();
        BOOL IsControlNode();
        BOOL IsControlNode(IXNode *pNode);
    public:
        IXFControl * GetControl();
    public:
        int SetXNode(IXNode * pNode,bool bReCeate = true);
        int SetElement(IXNode * pNode,bool bReCeate = false);
    public:
        int RemoveControl();
        int CreateControl(HWND hWnd);
    public:
        int RemoveChild();
        int RemoveChild(IXNode * pParentNode);
    public:
        IXNode * CreateNode(KXMLDOMElement pElement,bool setClassName = true);
    public:
        int TransToControl(LPCWSTR pControlClass);
        int TransToControl(IXNode * pNode,LPCWSTR pControlClass);
    public:
        RECT & GetAreaRect();
        RECT & GetContentRect();
    public:
        int SetAreaRect(RECT & rc);
        int SetContentRect(RECT & rc);
    public:
        //adjust or size rect
        int AdjustRect(); //adjust content rect,adjust child node or brother node
        int AdjustRect(RECT rect); //adjust content rect,adjust child node or brother node
        int AdjustRect(int dx); //adjust content rect,adjust child node or brother node
        int CalcContentRect();    //calc content rect
 
        int CreateNodeControl(HWND    hWnd);
        int AdjustCtrlRect();
    public:
        //draw 
        int DrawNode(HDC hDC);
    public:
        IXNode * GetParentNode();
        int GetChildNodesCount();
        IXNode* GetChild(int nItem); //from 0
        bool RemoveChildNode(int nIndex);
        IXNode* InsertChildNode(int nIndex, LPTSTR pXml);
        IXNode* InsertChildNode(int nIndex, KXMLDOMElement  pElement );
    public:
        DWORD GetLayerFlow();
        int SetLayerFlow(DWORD dwLayerFlow);
        DWORD GetLayerFlow(IXNode * pNode);
        int SetLayerFlow(IXNode * pNode,DWORD dwLayerFlow);
 
    public:
        static IXNode * CreateInstance();
        static int ReleaseInstance(IXNode * pNode);
    public:
        LPTSTR GetXml();
    public:
        HWND GetHWND();
 
    public:
        int SetWidthHeight(int width, int height);
        int MoveTo(LPTSTR Name);
    };
}}