为此,专门写了一个类,控制画布布局
class CBypassCtrl{
public:
CBypassCtrl();
public:
BOOL bAnchorman;
std::string anchormanID; //主播端的话 记录主播ID
std::string loginID; //观众端的话,记录登录者ID
ui::CBitmapControl* pSelfCaptureCtl; //本端自采集视频控件
ui::CBitmapControl* pMainVideoCtl; //主视频控件
nim_comp::VideoFrameMng* pSelfVideoFrame; //自采集帧
nim_comp::VideoFrameMng* pBypassVideoFrame; //旁路帧
std::vector<ui::CBitmapControl*> pBypassVec; //旁路控件
int nMasterW;
int nMasterH;
public:
void SetMasterWH(int w, int h);
void Push(ui::CBitmapControl* pBypass);
std::string GetAccount(int nIndex);
int GetAccountPos(std::string account = ""); //如有,则返回account位置,无返回-1
ui::CBitmapControl* GetCtrlOfIndex(int nIndex);
ui::CBitmapControl* GetCtrl(std::string account);
BOOL BExistAccout(std::string account);
BOOL SetBypassAccout(std::string account);
//重新将账户置空,并隐藏
BOOL RenullBypassAccouont(std::string account);
BOOL NullAllBypass();
void ClearNullAccount();
void ClearAll();
int GetSize();
//有账号,则显示,无账号则隐藏
void AutoAdjustHideShow();
//将account 置放到第几个位置显示
void SetPosition(std::string account, int nShowPos);
void AutoAdjustPos();
//video控件还原为采集
//主播端----主控件所有者为主播
//连麦端----主控件所有者为该连麦者
void RestoreMainVideoAsAnchorman(); //还原主控件为主播
void SetMainVideoFrame(std::string account);
void SwitchVideoFrame(ui::CBitmapControl* pBCtrl1, ui::CBitmapControl* pBCtrl2);
void Refresh(ui::Window* wnd, bool captrue, std::string selfAccount = "");
};