void DockingCont::doClose() { int iItemOff = 0; int iItemCnt = ::SendMessage(_hContTab, TCM_GETITEMCOUNT, 0, 0); for (int iItem = 0; iItem < iItemCnt; ++iItem) { TCITEM tcItem = {0}; // get item data SelectTab(iItemOff); tcItem.mask = TCIF_PARAM; ::SendMessage(_hContTab, TCM_GETITEM, iItemOff, (LPARAM)&tcItem); if (!tcItem.lParam) continue; // notify child windows if (NotifyParent(DMM_CLOSE) == 0) { // delete tab hideToolbar((tTbData*)tcItem.lParam); } else { ++iItemOff; } } if (iItemOff == 0) { // hide dialog first this->doDialog(false); ::SendMessage(_hParent, WM_SIZE, 0, 0); } }
void DockingCont::doClose(void) { INT iItemOff = 0; INT iItemCnt = ::SendMessage(_hContTab, TCM_GETITEMCOUNT, 0, 0); for (INT iItem = 0; iItem < iItemCnt; iItem++) { TCITEM tcItem = {0}; /* get item data */ SelectTab(iItemOff); tcItem.mask = TCIF_PARAM; ::SendMessage(_hContTab, TCM_GETITEM, iItemOff, (LPARAM)&tcItem); /* notify child windows */ if (NotifyParent(DMM_CLOSE) == 0) { /* delete tab */ hideToolbar((tTbData*)tcItem.lParam); } else { iItemOff++; } } if (iItemOff == 0) { /* hide dialog first */ this->doDialog(false); ::SendMessage(_hParent, WM_SIZE, 0, 0); } }
void DockingCont::showToolbar(tTbData* pTbData, BOOL state) { if (state == SW_SHOW) { viewToolbar(pTbData); } else { hideToolbar(pTbData); } }
void MainWindow::standaloneModeHide() { if(m_mode == StandAlone) if(m_alwaysShow) hideToolbar(); else { hide(); m_contentIsVisible = false; } }
void MainWindow::connectAllActions() { QObject::connect( m_iconOnlyAction, SIGNAL(triggered()), this, SLOT( iconOnly()) ); QObject::connect( m_textOnlyAction, SIGNAL(triggered()), this, SLOT( textOnly()) ); QObject::connect( m_textBelowAction, SIGNAL(triggered()), this, SLOT( textBelowIcon()) ); QObject::connect( m_textBesideAction, SIGNAL(triggered()), this, SLOT( textBesideIcon()) ); QObject::connect( m_hideToolbarAction, SIGNAL(triggered()), this, SLOT( hideToolbar() ) ); QObject::connect( m_directDownloadAction, SIGNAL(triggered()), this, SLOT(directDownload())); QObject::connect( m_downloadAction, SIGNAL(triggered()), this, SLOT(findDownloadLink())); QObject::connect( m_basicSearchAction, SIGNAL(triggered()), this, SLOT( basicSearch()) ); QObject::connect( m_advancedSearchAction, SIGNAL(triggered()), this, SLOT(advancedSearch()) ); QObject::connect( m_exitAction, SIGNAL(triggered()), this, SLOT( close()) ); QObject::connect( m_aboutQt, SIGNAL( triggered() ), qApp, SLOT( aboutQt() ) ); QObject::connect( m_aboutHend, SIGNAL(triggered()),this, SLOT( aboutHend() ) ); QObject::connect( m_videoDisplayTable, SIGNAL(activated(QModelIndex)), this, SLOT(viewDetails(QModelIndex)) ); QObject::connect( m_filterByUploadDateButton, SIGNAL(clicked()), this, SLOT(filterUploadHandler()) ); QObject::connect( m_filterByTypeButton, SIGNAL(clicked()), this, SLOT( filterTypeHandler() ) ); QObject::connect( m_filterByDurationButton, SIGNAL(clicked()), this, SLOT(filterDurationHandler())); QObject::connect( m_filterByFeaturesButton, SIGNAL(clicked()), this, SLOT( filterFeaturesHandler())); QObject::connect( m_filterBySortButton, SIGNAL(clicked()), this, SLOT( filterSortHandler()) ); QObject::connect( m_filterList, SIGNAL(currentTextChanged(QString)), this, SLOT(filterController(QString)) ); }
//---------------------------------------------------------- // Process function of tab // LRESULT DockingCont::runProcTab(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam) { static ToolTip toolTip; switch (Message) { case WM_LBUTTONDOWN: { _beginDrag = TRUE; return TRUE; } case WM_LBUTTONUP: { int iItem = 0; TCHITTESTINFO info = {0}; // get selected sub item info.pt.x = LOWORD(lParam); info.pt.y = HIWORD(lParam); iItem = ::SendMessage(hwnd, TCM_HITTEST, 0, (LPARAM)&info); SelectTab(iItem); _beginDrag = FALSE; return TRUE; } case WM_LBUTTONDBLCLK: { NotifyParent((_isFloating == true)?DMM_DOCK:DMM_FLOAT); return TRUE; } case WM_MBUTTONUP: { int iItem = 0; TCITEM tcItem = {0}; TCHITTESTINFO info = {0}; // get selected sub item info.pt.x = LOWORD(lParam); info.pt.y = HIWORD(lParam); iItem = ::SendMessage(hwnd, TCM_HITTEST, 0, (LPARAM)&info); SelectTab(iItem); // get data and hide toolbar tcItem.mask = TCIF_PARAM; ::SendMessage(hwnd, TCM_GETITEM, iItem, (LPARAM)&tcItem); if (!tcItem.lParam) return FALSE; // notify child windows if (NotifyParent(DMM_CLOSE) == 0) { hideToolbar((tTbData*)tcItem.lParam); } return TRUE; } case WM_MOUSEMOVE: { int iItem = 0; TCHITTESTINFO info = {0}; // get selected sub item info.pt.x = LOWORD(lParam); info.pt.y = HIWORD(lParam); iItem = ::SendMessage(hwnd, TCM_HITTEST, 0, (LPARAM)&info); if ((_beginDrag == TRUE) && (wParam == MK_LBUTTON)) { SelectTab(iItem); // send moving message to parent window _dragFromTab = TRUE; NotifyParent(DMM_MOVE); _beginDrag = FALSE; } else { int iItemSel = ::SendMessage(hwnd, TCM_GETCURSEL, 0, 0); if ((_bTabTTHover == FALSE) && (iItem != iItemSel)) { TRACKMOUSEEVENT tme; tme.cbSize = sizeof(tme); tme.hwndTrack = hwnd; tme.dwFlags = TME_LEAVE | TME_HOVER; tme.dwHoverTime = 1000; _bTabTTHover = _TrackMouseEvent(&tme); } else { if (iItem == iItemSel) { toolTip.destroy(); _bTabTTHover = FALSE; } else if (iItem != _iLastHovered) { TCITEM tcItem = {0}; RECT rc = {0}; // destroy old tooltip toolTip.destroy(); // recalc mouse position ::ClientToScreen(hwnd, &info.pt); // get text of toolbar tcItem.mask = TCIF_PARAM; ::SendMessage(hwnd, TCM_GETITEM, iItem, (LPARAM)&tcItem); if (!tcItem.lParam) return FALSE; toolTip.init(_hInst, hwnd); toolTip.Show(rc, ((tTbData*)tcItem.lParam)->pszName, info.pt.x, info.pt.y + 20); } } // save last hovered item _iLastHovered = iItem; _beginDrag = FALSE; } return TRUE; } case WM_MOUSEHOVER: { int iItem = 0; TCITEM tcItem = {0}; RECT rc = {0}; TCHITTESTINFO info = {0}; // get selected sub item info.pt.x = LOWORD(lParam); info.pt.y = HIWORD(lParam); iItem = ::SendMessage(hwnd, TCM_HITTEST, 0, (LPARAM)&info); // recalc mouse position ::ClientToScreen(hwnd, &info.pt); // get text of toolbar tcItem.mask = TCIF_PARAM; ::SendMessage(hwnd, TCM_GETITEM, iItem, (LPARAM)&tcItem); if (!tcItem.lParam) return FALSE; toolTip.init(_hInst, hwnd); toolTip.Show(rc, ((tTbData*)tcItem.lParam)->pszName, info.pt.x, info.pt.y + 20); return TRUE; } case WM_MOUSELEAVE: { toolTip.destroy(); _bTabTTHover = FALSE; return TRUE; } case WM_NOTIFY: { LPNMHDR lpnmhdr = (LPNMHDR)lParam; if ((lpnmhdr->hwndFrom == _hContTab) && (lpnmhdr->code == TCN_GETOBJECT)) { int iItem = 0; TCHITTESTINFO info = {0}; // get selected sub item info.pt.x = LOWORD(lParam); info.pt.y = HIWORD(lParam); iItem = ::SendMessage(hwnd, TCM_HITTEST, 0, (LPARAM)&info); SelectTab(iItem); } break; } default: break; } return ::CallWindowProc(_hDefaultTabProc, hwnd, Message, wParam, lParam); }
void MainWindow::changeSetting() { m_toggleDockingAction->setChecked(ScimKdeSettings::dockingToPanelApplet()); toggleDocking(true); //retrieve the m_mode first if(m_mode == StandAlone) { //re-initialize embed if next time toggle to that docking mode m_embedInitialized = false; setName("mainWindow"); reparent(0, Qt::WStyle_Customize | Qt::WX11BypassWM | Qt::WStyle_StaysOnTop, ScimKdeSettings::mainWindow_Position(),false); m_moveHandle->show(); setFrameStyle( QFrame::PopupPanel | QFrame::Raised ); //if margin is 0, the frame can not be drawn correctly, frameWidth() is // sometimes too big (>1 and the main m_toolbar is not so decent), so // just fix it to 1 m_mainWindowLayout->setMargin(1); setBackgroundOrigin(QWidget::WindowOrigin); } else { //change name so that it won't be listed in the composite management page setName("mainWindow_embedded"); setWFlags(Qt::WStyle_Customize); m_moveHandle->hide(); setFrameStyle( QFrame::NoFrame ); m_mainWindowLayout->setMargin(0); setBackgroundOrigin(QWidget::AncestorOrigin); setBackgroundMode(QWidget::X11ParentRelative); } m_autoHideTimeout = ScimKdeSettings::hide_Timeout() * 1000; m_alwaysShow = ScimKdeSettings::always_Show(); m_autoSnap = ScimKdeSettings::auto_Snap(); requestReloadSelf(); if( m_alwaysShow && m_autoHideTimeout > 0 && m_mode == StandAlone) { if(!m_autoHideTimeoutTimer) { m_autoHideTimeoutTimer = new QTimer(this); connect( m_autoHideTimeoutTimer, SIGNAL( timeout() ), this, SLOT( hideToolbar() ) ); } } else { if(m_autoHideTimeoutTimer) m_autoHideTimeoutTimer->deleteLater(); m_autoHideTimeoutTimer = 0; m_toolbar->show(); if(m_mode == StandAlone) m_moveHandle->show(); } m_alwaysShowHandle = ScimKdeSettings::alwaysShowHandle(); m_alwaysShowExtensionHandle = ScimKdeSettings::alwaysShowExtensionHandle(); if(m_mode == PanelEmbedded) { //init m_alwaysShowHandle option support timer if(m_alwaysShowHandle) { if(m_showHandleTimer) m_showHandleTimer->deleteLater(); m_showHandleTimer = 0; } else { if(!m_showHandleTimer) { m_showHandleTimer = new QTimer(this); connect(m_showHandleTimer, SIGNAL(timeout()), this, SLOT(showHandleRequest())); } } //init m_alwaysShowExtensionHandle option support timer if(m_alwaysShowExtensionHandle) { if(m_showExtHandleTimer) m_showExtHandleTimer->deleteLater(); m_showExtHandleTimer = 0; if(m_embeddedAreaSize.isValid()) //only reset m_toolbar size if m_embeddedAreaSize is set before resetToolbarSize(m_embeddedAreaSize); } else { if(!m_showExtHandleTimer) { m_showExtHandleTimer = new QTimer(this); connect(m_showExtHandleTimer, SIGNAL(timeout()), this, SLOT(showExtHandleRequest())); } } initEmbedPanel(); } if(m_mode == StandAlone) { if(m_alwaysShow) { if(m_autoHideTimeoutTimer && !m_logo) { m_logo = new QLabel(this); m_logo->setPixmap(KGlobal::iconLoader()->loadIcon("skim", KIcon::Toolbar)); m_mainWindowLayout->addWidget(m_logo); m_logo->hide(); } QTimer::singleShot(0, this, SLOT(show()));//FIXME } else if(m_panelTurnedOn) QTimer::singleShot(0, this, SLOT(show()));//FIXME if((!m_alwaysShow || !m_autoHideTimeoutTimer) && m_logo) { m_logo->deleteLater(); m_logo = 0; } UPDATE_WINDOW_OPACITY(this); } if(m_mode == StandAlone || (!ScimKdeSettings::force_LeftToRight_In_Kicker() && m_mode == PanelEmbedded)) changeDirection((QBoxLayout::Direction)(ScimKdeSettings::mainWindow_Direction())); else changeDirection(QBoxLayout::LeftToRight); if(m_mode == StandAlone || (!m_alwaysShowExtensionHandle && m_mode == PanelEmbedded)) { resetToolbarSize(); } }