bool Dialog::endDialog(intptr_t res) { isDialogEnd_ = true; endDialogResult_ = res; EndDialog(hwnd(), res); return true; }
void NativeViewerWin32PPT::hide() { #ifdef Q_OS_WIN32 SetWindowPos(hwnd(), 0, 0,0,0,0, SWP_HIDEWINDOW); //m_ppt->closePPT(); #endif }
CSrmmProxyWindow::CSrmmProxyWindow(HANDLE hContact, HWND hwndWindow, HWND hwndParent) { m_hContact = hContact; m_hwndWindow = hwndWindow; m_hwndParent = hwndParent; m_hbmpPreview = NULL; m_refreshPreview = true; m_bActive = false; m_bUnread = false; m_bTyping = false; UpdateIcon(); SetWindowText(hwnd(), (TCHAR *)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, (WPARAM)m_hContact, GCDNF_TCHAR)); SetTimer(1, 1000); SetEventHook(ME_DB_EVENT_ADDED, &CSrmmProxyWindow::OnDbEventAdded); SetEventHook(ME_DB_CONTACT_SETTINGCHANGED, &CSrmmProxyWindow::OnDbSettingChanged); SetEventHook(ME_AV_AVATARCHANGED, &CSrmmProxyWindow::OnAvatarChanged); SetEventHook(ME_PROTO_CONTACTISTYPING, &CSrmmProxyWindow::OnContactTyping); AddButton(LoadSkinnedIcon(SKINICON_OTHER_USERDETAILS), TranslateT("User Details"), 1, THBF_DISMISSONCLICK); AddButton(LoadSkinnedIcon(SKINICON_OTHER_HISTORY), TranslateT("History"), 2, THBF_DISMISSONCLICK); AddButton(LoadSkinnedIcon(SKINICON_EVENT_FILE), TranslateT("File"), 3, THBF_DISMISSONCLICK); UpdateButtons(g_pTaskbarList); }
dialog_box_id message_box( const basic_lpstr<const Char> &Text, const basic_lpstr<const Char> &Caption, const message_box_style &Type) { return message_box(hwnd(), Text, Caption, Type); }
// Minimizes (but does not destroy) the window void Window::Minimize() { CHECK_INIT(); if(!CloseWindow(hwnd())) throw WIN32EXCEPTION_1("CloseWindow"); }
void Window::Move(int x, int y) { CHECK_INIT(); if(!MoveWindow(hwnd(), x, y, width(), height(), TRUE)) throw WIN32EXCEPTION_1("MoveWindow"); }
explicit ScrollBarContainer(ScrollBar* parent) : parent_(parent), scrollbar_(NULL) { set_window_style(WS_CHILD); Init(parent->GetWidget()->GetNativeView(), gfx::Rect()); ShowWindow(hwnd(), SW_SHOW); }
void NativeViewerWin32PPT::close() { #ifdef Q_OS_WIN32 m_ppt->exitShow(); m_ppt->closeFile(); CloseWindow(hwnd()); #endif }
LRESULT OnCreate(LPCREATESTRUCT create_struct) { scrollbar_ = CreateWindowW(L"SCROLLBAR", L"", WS_CHILD|(parent_->IsHorizontal()?SBS_HORZ:SBS_VERT), 0, 0, parent_->width(), parent_->height(), hwnd(), NULL, NULL, NULL); ShowWindow(scrollbar_, SW_SHOW); return 1; }
void end() { // set the 2nd parameter to > 0 so we can detect error case from // return value of DialogBoxIndirectParam if(!::EndDialog(hwnd(), 1)) BOOST_THROW_EXCEPTION( boost::enable_error_info(winapi::last_error()) << boost::errinfo_api_function("EndDialog")); }
// Show window void Window::Show() { CHECK_INIT(); if(parentHwnd()) { EnableWindow(parentHwnd(), FALSE); } ShowWindow(hwnd(), SW_SHOW); }
void Window::getRect(LPRECT rect) const { CHECK_INIT(); if(!rect) throw INVALID_ARGUMENT_EXCEPTION_1("rect"); if(!GetWindowRect(hwnd(), rect)) throw WIN32EXCEPTION_1("GetWindowRect"); }
void BSPanel::loadRoot(BonesRoot * root) { root_ = root; if (root_) { root_->setListener(this); root_->attachTo(hwnd()); } }
void Window::Resize(int width, int height) { CHECK_INIT(); RECT rect; getRect(&rect); if(!MoveWindow(hwnd(), rect.left/*x*/, rect.top/*y*/, width, height, TRUE)) throw WIN32EXCEPTION_1("MoveWindow"); }
gl_window_t::gl_window_t() : ntk_window( app()->conf().get_rect("gl_window::frame", ntk_rect(100, 100, 600, 600)), ntk::application()->name() + " v" + ntk::application()->version().as_string(), TITLED_WINDOW) { SetMenu(hwnd(), LoadMenu(ntk::application()->handle(), MAKEINTRESOURCE(ID_APP_MENU))); add_child(new render_view_t); }
// Hide window void Window::Hide() { CHECK_INIT(); ShowWindow(hwnd(), SW_HIDE); if(parentHwnd()) { EnableWindow(parentHwnd(), TRUE); SetFocus(parentHwnd()); } }
void CSrmmProxyWindow::UpdateIcon() { HICON hIcon; if (m_bTyping) { hIcon = LoadSkinnedIcon(SKINICON_OTHER_TYPING); } else if (m_bUnread) { hIcon = LoadSkinnedIcon(SKINICON_EVENT_MESSAGE); } else { char *szProto = (char *)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)m_hContact, 0); if (!szProto) return; int iStatus = DBGetContactSettingWord(m_hContact, szProto, "Status", ID_STATUS_OFFLINE); hIcon = (HICON)LoadSkinnedProtoIcon(szProto, iStatus); } SendMessage(hwnd(), WM_SETICON, ICON_BIG, (LPARAM)hIcon); SendMessage(hwnd(), WM_SETICON, ICON_SMALL, (LPARAM)hIcon); }
void Window::getClientRect(LPRECT rect) const { CHECK_INIT(); if(!rect) throw INVALID_ARGUMENT_EXCEPTION_1("rect"); WINDOWINFO wi; if(!GetWindowInfo(hwnd(), &wi)) throw WIN32EXCEPTION_1("GetWindowInfo"); memcpy(rect, &wi.rcClient, sizeof(RECT)); }
GLView::status_t GLView::initialize_() { finalize_(); if(m_rc) return status::ALREADY_INITIALIZED; PIXELFORMATDESCRIPTOR pixel_format_desc = { sizeof(PIXELFORMATDESCRIPTOR), 1, PFD_DRAW_TO_WINDOW | PFD_SUPPORT_OPENGL, PFD_TYPE_RGBA, 24, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 32, 0, 0, PFD_MAIN_PLANE, 0, 0, 0, 0 }; if(flags() & DOUBLE_BUFFERING) pixel_format_desc.dwFlags |= PFD_DOUBLEBUFFER; // if(flags() & m_dc = new DC(hwnd()); int pixel_format = ChoosePixelFormat(*m_dc, &pixel_format_desc); int status = SetPixelFormat(*m_dc, pixel_format, &pixel_format_desc); if(! status) { delete m_dc; m_dc = NULL; return status::FAILED_TO_SET_PIXEL_FORMAT; } m_rc = wglCreateContext(*m_dc); wglMakeCurrent(*m_dc, m_rc); // glFlush(); return st::NO_ERR; }
void BSPanel::layeredDraw() { if (!isLayered()) return; if (!root_) return; if (!root_->isDirty()) return; root_->draw(); RECT win_rect; ::GetWindowRect(hwnd_, &win_rect); POINT pos = { win_rect.left, win_rect.top }; SIZE size = { win_rect.right - win_rect.left, win_rect.bottom - win_rect.top }; POINT src_pos = { 0, 0 }; BLENDFUNCTION bf = { AC_SRC_OVER, 0, 255, AC_SRC_ALPHA }; auto old = ::SelectObject(dc_, root_->getBackBuffer()); ::SetGraphicsMode(dc_, GM_ADVANCED); auto l = ::UpdateLayeredWindow(hwnd(), NULL, &pos, &size, dc_, &src_pos, 0, &bf, ULW_ALPHA); ::SelectObject(dc_, old); }
// Get length of caption text in characters (not bytes) int Window::captionLength() const { CHECK_INIT(); return GetWindowTextLength(hwnd()); }
void Button::set_label(const String& label) { SystemControl::set_label(label); SetWindowText(hwnd(), label.c_str()); }
void NativeViewerWin32PPT::embedHwnd() { // adjust parent window //NativeViewerWin32::embedHwnd(); #ifdef Q_OS_WIN32 QRect rect = containerWidget()->geometry(); QPoint abs = WidgetUtil::absoluteWidgetPosition(containerWidget()); m_ppt->runShow(); m_ppt->setWindowRect(abs.x(), abs.y(), rect.width(), rect.height()); HWND ptr = NULL; int count = 0; int max = 1000; while(!ptr && count++ < max) { //qApp->processEvents(); ptr = FindWindow(L"screenClass", NULL); } //HWND hwnd = FindWindowEx(hwnd(), NULL, L"paneClassDC", NULL); setHwnd(ptr); //qDebug() << "NativeViewerWin32PPT::embedHwnd: hwnd:"<<hwnd()<<", count:"<<count; //m_numSlides = m_ppt->numSlides(); //qDebug() << "NativeViewerWin32PPT::embedHwnd: Num slides:"<<m_numSlides; NativeViewerWin32::embedHwnd(); BringWindowToTop(hwnd()); // /* // now find the actual widget that holds the show and stretch it out HWND hwnd2 = FindWindowEx(hwnd(), NULL, L"paneClassDC", NULL); setHwnd(FindWindow(L"screenClass", NULL)); if(hwnd2) { //QPoint abs = absoluteWidgetPosition(containerWidget()); // This is a "magic forumla" for the proper stretch amount - // just found through trial and error. Its NOT perfect, and // gets more and more inaccurate the further away from 1024x768 or 320x240 // the size is. But, it's "good enough" for now. int xa = ((int)(8.0/1024.0 * ((double)rect.width()))); int ya = ((int)(67.0/768.0 * ((double)rect.height()))); // override for known rectangle size if(rect.width() == 320 && rect.height() == 240) { xa = 8; ya = 25; } //MoveWindow(hwnd(), rect.x(), rect.x(), rect.width(), rect.height(), 1); qDebug() << "NativeViewerWin32PPT::embedHwnd(): hwnd2:"<<hwnd2<<", orig size:"<<rect.size()<<", xa:"<<xa<<",ya:"<<ya; SetWindowPos(hwnd2, 0, -xa, -ya, rect.width() + xa*2, rect.height() + ya*2, SWP_SHOWWINDOW); BringWindowToTop(hwnd()); } */ #endif }
/** * Replace the window's own window proc with ours. */ virtual void install_window_procedure() { window_procedure() = boost::make_shared<dialog_proc>(hwnd(), window_impl_proc); }
/** * Set the window menu. * * @todo Move to a specialised app window class. * @todo Deal with destroying the old window. */ void menu(const washer::gui::menu::menu_bar& menu) { detail::win32::set_menu(hwnd(), menu.handle().get()); }
HWND Dialog::itemHandle(int32_t id) { return GetDlgItem(hwnd(), id); }
// Closes (destroy) the window void Window::Close() { CHECK_INIT(); SendMessage(hwnd(), WM_CLOSE, NULL, NULL); }
intptr_t Dialog::showModal(const ERDelegateWrapper<intptr_t (HWND, unsigned, uintptr_t, longptr_t)> &procMessage, int showCommand) { // From CDialog::DoModal in MFC. ShellPtr<> lparent = parent().lock(); HWND parentWin = nullptr; if(lparent) parentWin = lparent->hwnd(); const DLGTEMPLATE *tpl = static_cast<const DLGTEMPLATE *>(dialogTemplateWithSystemFont()); bool parentEnabled = false; if(parentWin != nullptr && IsWindowEnabled(parentWin)) { EnableWindow(parentWin, FALSE); parentEnabled = true; } intptr_t res = -1; isDialogEnd_ = false; endDialogResult_ = -1; setProcMessageFn(procMessage); HWND window = CreateDialogIndirectParamW(Batang::Win32Environment::instance().getInstance(), tpl, parentWin, callProcMessageFn, 0); if(window != nullptr) { hwnd(window); MSG msg; while(GetMessageW(&msg, nullptr, 0, 0)) { if(isDialogEnd_) { res = endDialogResult_; break; } if(showCommand) { ShowWindow(window, showCommand); UpdateWindow(window); showCommand = 0; } if(msg.message == WM_KEYDOWN && ShortcutKey::instance().processKey(this, GetKeyState(VK_CONTROL) < 0, GetKeyState(VK_MENU) < 0, GetKeyState(VK_SHIFT) < 0, static_cast<uint32_t>(msg.wParam), ((msg.lParam & 0x01000000) == 0x01000000), static_cast<uint32_t>(msg.lParam & 0x0000FFFF))) { continue; } if(!IsDialogMessage(window, &msg)) { TranslateMessage(&msg); DispatchMessageW(&msg); } } if(!isDialogEnd_) // WM_QUIT { PostQuitMessage(0); return -1; } SetWindowPos(window, nullptr, 0, 0, 0, 0, SWP_HIDEWINDOW | SWP_NOSIZE | SWP_NOMOVE | SWP_NOACTIVATE | SWP_NOZORDER); } if(parentEnabled) EnableWindow(parentWin, TRUE); if(parentWin != nullptr && GetActiveWindow() == window) SetActiveWindow(parentWin); DestroyWindow(window); clearProcMessageFn(); hwnd(nullptr); return res; // return DialogBoxIndirectParamW(MainController::instance().getInstance(), tpl, parentWin, procMessage, 0); }
// Disables a window void Window::Disable() { CHECK_INIT(); EnableWindow(hwnd(), FALSE); }
// Enables a window void Window::Enable() { CHECK_INIT(); EnableWindow(hwnd(), TRUE); }