// Create a window from a file. // GPWindow::GPWindow(BRect frame, plot_struct *plot) : BWindow(frame, "Untitled ", B_TITLED_WINDOW, 0) { _InitWindow(); Show(); }
TTimeWindow::TTimeWindow(BRect rect) : BWindow(rect, "Time", B_TITLED_WINDOW, B_NOT_RESIZABLE | B_NOT_ZOOMABLE) { _InitWindow(); _AlignWindow(); AddShortcut('A', B_COMMAND_KEY, new BMessage(B_ABOUT_REQUESTED)); }
TTimeWindow::TTimeWindow() : BWindow(BRect(0, 0, 0, 0), B_TRANSLATE_SYSTEM_NAME("Time"), B_TITLED_WINDOW, B_NOT_RESIZABLE | B_NOT_ZOOMABLE | B_AUTO_UPDATE_SIZE_LIMITS) { _InitWindow(); _AlignWindow(); AddShortcut('A', B_COMMAND_KEY, new BMessage(B_ABOUT_REQUESTED)); }
CWindowsWin32Window::CWindowsWin32Window(IWindow * ext, IConfigObject const * cfg) : _rect{}, _ext{ ext }, _win{ NULL } { HMODULE hInst{ GetModuleHandle(nullptr) }; _InitWindowClass(hInst); _InitEventPump(); _InitWindow(hInst, cfg); s_winCount++; }
MediaWindow::MediaWindow(BRect frame) : BWindow(frame, B_TRANSLATE_SYSTEM_NAME("Media"), B_TITLED_WINDOW, B_ASYNCHRONOUS_CONTROLS | B_AUTO_UPDATE_SIZE_LIMITS), fCurrentNode(BMessenger(this)), fParamWeb(NULL), fAudioInputs(5, true), fAudioOutputs(5, true), fVideoInputs(5, true), fVideoOutputs(5, true), fInitCheck(B_OK) { _InitWindow(); }
//----创始桌面窗口-------------------------------------------------------------- //描述: 该函数为内部调用,仅限于创建桌面. //参数:proc: 桌面窗口过程回调函数 // Text: 桌面窗口文字指针 // x,y,w,h: 桌面窗口位置和大小 // pdata: 用户自定义附加数据. //返回:桌面窗口句柄. //------------------------------------------------------------------------------ HWND CreateDesktop( WNDPROC *proc, const char *Text, int x,int y,int w,int h, const void *pdata) { WINDOW *pwin=NULL; struct tagGkWinRsc *pGkWin=NULL; u32 Style; if(NULL!=proc) { pwin =WIN_Alloc(); if(NULL!=pwin) { Style = 0; Style &=~(WS_CHILD); _InitWindow(pwin,proc,Text,Style,x,y,w,h,NULL,0); pGkWin =(struct tagGkWinRsc*)malloc(sizeof(struct tagGkWinRsc)); if(!GK_ApiCreateGkwin(pGkWinDesktop, pGkWin, x,y,x+w,y+h, RGB(0,0,0), CN_WINBUF_BUF, "desktop", CN_SYS_PF_DISPLAY, 0,0,0)) { free(pGkWin); return FALSE; } pwin->pGkWin =pGkWin; pwin->mutex_lock =Lock_MutexCreate(NULL); pwin->pMsgQ =GUI_CreateMsgQ(32); pwin->EventID =Djy_MyEventId(); pwin->Zorder =0; GK_ApiSetPrio(pGkWin,pwin->Zorder,100*mS); HWND_Desktop =pwin; SendMessage(pwin,MSG_CREATE,(u32)pdata,0); } } return pwin; }
MediaWindow::MediaWindow(BRect frame) : BWindow(frame, B_TRANSLATE_SYSTEM_NAME("Media"), B_TITLED_WINDOW, B_ASYNCHRONOUS_CONTROLS | B_AUTO_UPDATE_SIZE_LIMITS), fCurrentNode(BMessenger(this)), fParamWeb(NULL), fAudioInputs(5, true), fAudioOutputs(5, true), fVideoInputs(5, true), fVideoOutputs(5, true), fInitCheck(B_OK), fRestartThread(-1), fRestartAlert(NULL) { _InitWindow(); BMediaRoster* roster = BMediaRoster::Roster(); roster->StartWatching(BMessenger(this, this), B_MEDIA_SERVER_STARTED); roster->StartWatching(BMessenger(this, this), B_MEDIA_SERVER_QUIT); }
//----创建窗口------------------------------------------------------------------ //描述: 该函数可以创建主窗口和子窗口(控件) //参数:proc: 窗口过程回调函数 // Text: 窗口文字指针 // Style: 窗口风格(具体参考窗口风格组合说明) // x,y,w,h: 桌面窗口位置和大小 // hParent: 父窗口句柄.如果是NULL,则默认桌面为父窗口. // WinId: 窗口Id.如果是主窗口,该参数被忽略. // pdata: 用户自定义附加数据. //返回:窗口句柄. //------------------------------------------------------------------------------ HWND CreateWindow(WNDPROC *pfWinProc, const char *Text,u32 Style, s32 x,s32 y,s32 w,s32 h, HWND hParent,u32 WinId,const void *pdata) { WINDOW *pwin=NULL; struct tagGkWinRsc *pGkWin=NULL; if(NULL==hParent) { hParent =GetDesktopWindow(); } if(HWND_Lock(hParent)) { pwin =WIN_Alloc(); if(NULL!=pwin) { //初始化窗口数据 _InitWindow(pwin,pfWinProc,Text,Style,x,y,w,h,hParent,WinId); x =pwin->WinRect.left; y =pwin->WinRect.top; w =RectW(&pwin->WinRect); h =RectH(&pwin->WinRect); pGkWin =(struct tagGkWinRsc*)malloc(sizeof(struct tagGkWinRsc)); if(Style&WS_CHILD) { if(!GK_ApiCreateGkwin(pGkWinDesktop, pGkWin,x,y,x+w,y+h, RGB(0,0,0), CN_WINBUF_BUF, pwin->Name, CN_SYS_PF_DISPLAY, 0,0,0)) { free(pGkWin); return NULL; } pwin->mutex_lock =hParent->mutex_lock; //子窗口使用父窗口锁 pwin->pMsgQ =hParent->pMsgQ; //子窗口使用父窗口消息队列 pwin->EventID =hParent->EventID; pwin->Zorder =hParent->Zorder-1; GK_ApiSetPrio(pGkWin,pwin->Zorder,100*mS); } else { if(!GK_ApiCreateGkwin(pGkWinDesktop, pGkWin,x,y,x+w,y+h, RGB(0,0,0), CN_WINBUF_BUF, pwin->Name, CN_SYS_PF_DISPLAY, 0,0,0)) { free(pGkWin); return NULL; } pwin->mutex_lock =Lock_MutexCreate(NULL); pwin->pMsgQ =GUI_CreateMsgQ(32); pwin->EventID =Djy_MyEventId(); pwin->Zorder =hParent->Zorder-1; GK_ApiSetPrio(pGkWin,pwin->Zorder,100*mS); } pwin->pGkWin = pGkWin; //将新窗口添加到父窗口 _AddChild(hParent,pwin); } HWND_Unlock(hParent); if(NULL!=pwin) { SendMessage(pwin,MSG_CREATE,(u32)pdata,0); InvalidateWindow(pwin); } } return pwin; }
// Constructs the window we'll be drawing into. // GPWindow::GPWindow(BRect frame) : BWindow(frame, " ", B_TITLED_WINDOW, 0) { _InitWindow(); Show(); }
ImmersiveVideoWindow::ImmersiveVideoWindow(BRect frame, entry_ref *ref) : BWindow(frame, "Configurator", B_TITLED_WINDOW,0) { _Init(); _InitWindow(); Show(); }