FrameWindow-框架窗口

FrameWindow 框架窗口

框架窗口,支持窗格布局,窗格停靠码头,窗格浮动,窗格拖动,窗格合并等自由组合,并且包含一个主视图.

消息格式请参加文档 事件.

步骤

  1. 初始化UI库 XInitXCGUI().
  2. 创建窗口 XFrameWnd_Create().
  3. 创建窗格 XPane_Create().
  4. 添加窗格 XFrameWnd_AddPane().
  5. 显示窗口 XWnd_Show().
  6. 运行程序 XRunXCGUI().
  7. 释放UI库 XExitXCGUI().

代码示例

#pragma comment(lib, "XCGUI.lib")
#include "xcgui.h"
class CFrameWindow_Demo
{
public:
HWINDOW m_hWindow;
HELE m_hPane1;
HELE m_hPane2;
HELE m_hPane3;
CFrameWindow_Demo()
{
m_hPane1=NULL;
m_hPane2=NULL;
m_hPane3=NULL;
Init();
}
void Init()
{
m_hWindow = XFrameWnd_Create(0, 0, 600, 400, L"炫彩界面库窗口",NULL, window_style_default);
m_hPane1=XPane_Create(L"111",200,200,m_hWindow); //创建窗格
m_hPane2=XPane_Create(L"222222222222",200,200,m_hWindow);
m_hPane3=XPane_Create(L"333",200,200,m_hWindow);
XFrameWnd_AddPane(m_hWindow,NULL,m_hPane1,pane_align_left); //添加窗格
XFrameWnd_AddPane(m_hWindow,NULL,m_hPane3,pane_align_right);
XFrameWnd_MergePane(m_hWindow, m_hPane1, m_hPane2); //合并窗格
//XFrameWnd_SetView(m_hWindow,XEle_Create(0,0,100,100,m_hWindow)); //设置主视图
XWnd_RegEventCPP(m_hWindow,WM_RBUTTONUP,&CFrameWindow_Demo::OnWndRButtonUp);
XWnd_RegEventCPP(m_hWindow, XWM_MENU_SELECT, &CFrameWindow_Demo::OnWndMenuSelect);
XWnd_AdjustLayout(m_hWindow);
XWnd_ShowWindow(m_hWindow,SW_SHOW);
}
int OnWndRButtonUp(UINT nFlags,POINT *pPt,BOOL *pbHandled)
{
POINT pt=*pPt;
//创建弹出菜单
HMENUX hMenu=XMenu_Create();
XMenu_AddItem(hMenu,201,L"窗格1");
XMenu_AddItem(hMenu,202,L"窗格2");
XMenu_AddItem(hMenu,203,L"窗格3");
ClientToScreen(XWnd_GetHWND(m_hWindow),&pt);
XMenu_Popup(hMenu,XWnd_GetHWND(m_hWindow),pt.x,pt.y);
return 0;
}
int OnWndMenuSelect(int nID,BOOL *pbHandled)
{
XTRACE("menu id %d \n", nID);
switch(nID)
{
case 201:
{
if(NULL==m_hPane1) return 0;
if(XPane_IsShowPane(m_hPane1))
XPane_HidePane(m_hPane1);
else
XPane_ShowPane(m_hPane1);
}break;
case 202:
{
if(NULL==m_hPane2) return 0;
if(XPane_IsShowPane(m_hPane2))
XPane_HidePane(m_hPane2);
else
XPane_ShowPane(m_hPane2);
}break;
case 203:
{
if(NULL==m_hPane3) return 0;
if(XPane_IsShowPane(m_hPane3))
XPane_HidePane(m_hPane3);
else
XPane_ShowPane(m_hPane3);
}break;
}
return 0;
}
};
int WINAPI wWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCmdLine, int nCmdShow)
{
//XC_ShowLayoutFrame(TRUE);
CFrameWindow_Demo MyWindow;
return 0;
}
@ pane_align_left
左侧
Definition: XCGUI.h:1592
@ pane_align_right
右侧
Definition: XCGUI.h:1596
@ window_style_default
窗口样式-控制按钮: 居中 图标, 标题, 关闭按钮, 最大化按钮, 最小化按钮
Definition: XCGUI.h:398
BOOL WINAPI XPane_IsShowPane(HELE hEle)
窗格_是否显示 判断窗格是否显示.
Definition: PaneUI.cpp:847
HELE WINAPI XPane_Create(const wchar_t *pName, int nWidth, int nHeight, HWINDOW hFrameWnd)
窗格_创建 创建窗格元素.
Definition: PaneUI.cpp:789
void WINAPI XPane_HidePane(HELE hEle, BOOL bGroupDelay)
窗格_隐藏 隐藏窗格.
Definition: PaneUI.cpp:897
void WINAPI XPane_ShowPane(HELE hEle, BOOL bGroupActivate)
窗格_显示 显示窗格.
Definition: PaneUI.cpp:907
void WINAPI XExitXCGUI()
炫彩_退出 退出界面库释放资源. 不可在dllmain()中卸载, 否则会死锁
Definition: App.cpp:572
void WINAPI XRunXCGUI()
炫彩_运行 运行消息循环,当炫彩窗口数量为0时退出.
Definition: App.cpp:564
BOOL WINAPI XInitXCGUI(BOOL bD2D)
炫彩_初始化 初始化界面库.
Definition: App.cpp:557
XWnd_RegEventCPP(hWindow, nEvent, memberFunction)
窗口_注册事件CPP 注册窗口事件,将类成员函数作为事件响应函数.函数省略参数窗口自身句柄hWindow.
#define XWM_MENU_SELECT
菜单选择
Definition: XCGUI.h:714
HWINDOW WINAPI XFrameWnd_Create(int x, int y, int cx, int cy, const wchar_t *pTitle, HWND hWndParent, int XCStyle)
框架窗口_创建 创建框架窗口
Definition: FrameWndUI.cpp:2502
BOOL WINAPI XFrameWnd_MergePane(HWINDOW hWindow, HELE hPaneDest, HELE hPaneNew)
框架窗口_合并窗格 合并窗格.
Definition: FrameWndUI.cpp:2682
BOOL WINAPI XFrameWnd_AddPane(HWINDOW hWindow, HELE hPaneDest, HELE hPaneNew, pane_align_ align)
框架窗口_添加窗格 添加窗格到框架窗口.
Definition: FrameWndUI.cpp:2670
BOOL WINAPI XMenu_Popup(HMENUX hMenu, HWND hParentWnd, int x, int y, HELE hParentEle, menu_popup_position_ nPosition)
菜单_弹出 弹出菜单.
Definition: MenuUI.cpp:923
HMENUX WINAPI XMenu_Create()
菜单_创建 创建菜单.默认弹出菜单窗口关闭后自动销毁.
Definition: MenuUI.cpp:762
void WINAPI XMenu_AddItem(HMENUX hMenu, int nID, const wchar_t *pText, int nParentID, int nFlags)
菜单_添加项 添加菜单项.
Definition: MenuUI.cpp:777
HWND WINAPI XWnd_GetHWND(HWINDOW hWindow)
窗口_取HWND 获取HWND句柄.
Definition: WindowUI.cpp:6168
void WINAPI XWnd_AdjustLayout(HWINDOW hWindow)
窗口_调整布局 调整窗口布局, 当窗口显示状态才有效.
Definition: WindowUI.cpp:6718
BOOL WINAPI XWnd_ShowWindow(HWINDOW hWindow, int nCmdShow)
@窗口_显示扩展 显示隐藏及控制窗口最大化还原等
Definition: WindowUI.cpp:6387

截图