void IdealIRC::showEvent(QShowEvent *) { /// Insert stuff that should run every showEvent here: // -- if (! firstShow) return; firstShow = false; /// Insert stuff that should run when IIRC shows for first time here: ui->treeWidget->setSortingEnabled(true); ui->treeWidget->sortItems(0, Qt::AscendingOrder); CreateSubWindow("Status", WT_STATUS, 0, true); if (conf.showOptionsStartup) on_actionOptions_triggered(); scriptParent.loadAllScripts(); scriptParent.runevent(te_start); }
// CDlgDebuger message handlers BOOL CDlgDebuger::OnInitDialog() { CResizableDialog::OnInitDialog(); // TODO: 在此添加额外的初始化代码 AddAnchor(IDC_TAB_MAIN, TOP_LEFT, BOTTOM_RIGHT); //屏蔽关闭按钮 GetSystemMenu(FALSE)->EnableMenuItem(SC_CLOSE, MF_BYCOMMAND|MF_DISABLED|MF_GRAYED); // get desktop size CRect rc; SystemParametersInfo(SPI_GETWORKAREA, NULL, &rc, NULL); rc.right = 256; SetMaximizedRect(rc); CRect rect; GetClientRect(&rect); MoveWindow(10, 150, rect.Width(), rect.Height(), TRUE); SetSizeGripVisibility(FALSE); UpdateSizeGrip(); //创建字窗口 CreateSubWindow(); //Hook CCaptionButton::InitCapBtn(g_pGfxSystem->GetWindow()); m_pCaptionBtn->SetBmpID(1, IDB_BITMAP_LAMPON, IDB_BITMAP_LAMPOFF, TRUE); m_pCaptionBtn->ChangeButtonState(); ::SetActiveWindow(g_pGfxSystem->GetWindow()); m_pCaptionBtn->ChangeButtonState(); return TRUE; // 除非设置了控件的焦点,否则返回 TRUE }
void IdealIRC::showEvent(QShowEvent *) { /// Insert stuff that should run every showEvent here: // -- if (! firstShow) return; firstShow = false; /// Insert stuff that should run when IIRC shows for first time here: ui->treeWidget->setSortingEnabled(true); ui->treeWidget->sortItems(0, Qt::AscendingOrder); CreateSubWindow("Status", WT_STATUS, 0, true); if (conf.showOptionsStartup) on_actionOptions_triggered(); addToolBarBreak(); addToolBar(wsw.getToolbar()); wsw.getToolbar()->setVisible( conf.showButtonbar ); ui->treeWidget->setVisible( conf.showTreeView ); ui->actionToolbar->setChecked( ui->toolBar->isVisible() ); ui->actionWindow_buttons->setChecked( wsw.getToolbar()->isVisible() ); ui->actionWindow_tree->setChecked( ui->treeWidget->isVisible() ); ui->actionMenubar->setChecked( conf.showMenubar ); ui->menuBar->setVisible( ui->actionMenubar->isChecked() ); scriptParent.getToolbarPtr(&customToolbar); scriptParent.loadAllScripts(); scriptParent.runevent(te_start); }
static LRESULT WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) { static HDC hDC; static PAINTSTRUCT ps; static HWND hWndButton,hWndbutton2,hWndNewWin; int x,y; switch(message) { case LMSG_CREATE: hWndNewWin = CreateWindow("mledit", "How are you? Are you ok?", WS_CONTROL | WS_BORDER | WS_VISIBLE | WS_VSCROLL, 10,10, 130 , 80, hWnd, (HMENU)ID_BUTTON2, NULL, NULL); hWndButton = CreateWindow("button", "关闭", WS_CONTROL | BS_PUSHBUTTON | WS_BORDER | WS_VISIBLE, 40, 150, 80 , 20, hWnd, (HMENU)ID_BUTTON, NULL, NULL); hWndbutton2 = CreateWindow("button", "子窗口", WS_CONTROL | BS_PUSHBUTTON | WS_BORDER | WS_VISIBLE, 40, 120, 80 , 20, hWnd, (HMENU)ID_NEWWIN, NULL, NULL); break; case LMSG_COMMAND: switch(HIWORD(wParam)){ case BN_CLICKED: switch(LOWORD(wParam)){ case ID_BUTTON: DestroyWindow(hWnd); break; case ID_NEWWIN: CreateSubWindow(hWnd); break; default: break; } break; default: break; } break; case LMSG_PENDOWN: CaptureMouse(hWnd,BYCLIENT); break; hDC=GetDC(hWnd); x=(int)wParam; y=(int)lParam; ScreenToClient(hWnd,&x,&y); SetPixel(hDC,x,y ,RGB(0,0,0)); ReleaseDC(hWnd,hDC); break; case LMSG_PENMOVE: //printf("address book pen move print\n"); break; hDC=GetDC(hWnd); x=(int)wParam; y=(int)lParam; ScreenToClient(hWnd,&x,&y); SetPixel(hDC,x,y ,RGB(0,0,0)); ReleaseDC(hWnd,hDC); break; case LMSG_PENUP: DisCaptureMouse(); break; case LMSG_PAINT: ps.bPaintDirect=false; hDC=BeginPaint(hWnd, &ps); if(!hDC){ return true; } EndPaint(hWnd, &ps); break; case LMSG_CLOSE: PostQuitMessage(hWnd);//用来退出消息循环 case LMSG_DESTROY: PostQuitMessage(hWnd);//用来退出消息循环 break; default: return DefWindowProc(hWnd, message, wParam, lParam); } return true; }
//______________________________________________________________________________ Bool_t ArgusWindow::OpenNewWindow(Int_t tabIndex) { ArgusTab *newTab = 0; ArgusWindow *subWindow = 0; Int_t iParent = 0; ROMEString newTitle = ""; Int_t iSub; Int_t nSub; ArgusTab *tab = GetTabObjectAt(tabIndex); if (!tab) { return kFALSE; } tab->SetRegisteringActive(kFALSE); // Reuse the unmapped sub window with the selected tab, if any. nSub = fSubWindows->GetEntriesFast(); for (iSub = 0; iSub < nSub; iSub++) { if (!IsSubWindowRunningAt(iSub)) { subWindow = static_cast<ArgusWindow*>(fSubWindows->At(iSub)); if (subWindow->fCurrentTabIndex == fCurrentTabIndex) { subWindow->MapWindow(); SetSubWindowRunningAt(iSub, kTRUE); return kTRUE; } } } Int_t tabIndexOrg = fCurrentTabIndex; ChangeTab(tabIndex); newTitle = "ARGUS - "; newTitle += tab->GetTitle(); subWindow = CreateSubWindow(); subWindow->SetStatusBarSwitch(fStatusBarSwitch); subWindow->SetListTreeView(kTRUE); // sub-windows are always in list-tree mode, which uses fMainFrame rather than fTab. subWindow->SetWindowScale(fWindowScale); subWindow->SetWindowName(newTitle.Data()); subWindow->SetWindowId(fSubWindows->GetEntriesFast()); subWindow->ClearEventHandlingRequest(); subWindow->ClearEventHandlingForced(); newTab = subWindow->GetTabObjectAt(fCurrentTabIndex); newTab->SetTabActive(kTRUE); newTab->SetSwitch(kTRUE); newTab->SetScreenShotName(tab->GetScreenShotName()); ArgusHistoDisplay *newHistoDisplay; ArgusHistoDisplay *histoDisplay; if ((newHistoDisplay = dynamic_cast<ArgusHistoDisplay*>(newTab)) && (histoDisplay = dynamic_cast<ArgusHistoDisplay*>(tab))) { newHistoDisplay->SetNumberOfPadsX(histoDisplay->GetNumberOfPadsX()); newHistoDisplay->SetNumberOfPadsY(histoDisplay->GetNumberOfPadsY()); } // switch on all the ancestor tabs Int_t iTab = tabIndex; while ((iParent=fParentIndex[iTab]) != -1) { subWindow->GetTabObjectAt(iParent)->SetSwitch(kTRUE); iTab = iParent; } SetSubWindowRunningAt(fSubWindows->GetEntriesFast(),kTRUE); fSubWindows->Add(subWindow); subWindow->Start(); // force event handler for new window ForceEventHandling(); subWindow->TriggerEventHandler(); ClearEventHandlingForced(); ChangeTab(tabIndexOrg); return kTRUE; }