void KreogistCuteStyle::drawControl(ControlElement element, const QStyleOption *opt, QPainter *p, const QWidget *w) const { switch(element) { case CE_MenuItem: { const QStyleOptionMenuItem *_opt_menu_item= qstyleoption_cast<const QStyleOptionMenuItem *>(opt); if(_opt_menu_item != nullptr) { drawMenuItem(_opt_menu_item,p,w); } break; } case CE_TabBarTab: { const QStyleOptionTab *_opt_tab_item= qstyleoption_cast<const QStyleOptionTab *>(opt); if(_opt_tab_item != nullptr) { drawTabItem(_opt_tab_item,p,w); } break; } default: style->drawControl(element,opt,p,w); break; } }
//---------------------------------------------- // Process function of dialog // BOOL CALLBACK DockingCont::run_dlgProc(UINT Message, WPARAM wParam, LPARAM lParam) { switch (Message) { case WM_NCACTIVATE: { // Note: lParam to identify the trigger window if ((int)lParam != -1) { ::SendMessage(_hParent, WM_NCACTIVATE, wParam, 0); } break; } case WM_INITDIALOG: { _hContTab = ::GetDlgItem(_hSelf, IDC_TAB_CONT); _hCaption = ::GetDlgItem(_hSelf, IDC_BTN_CAPTION); // intial subclassing of caption ::SetWindowLongPtr(_hCaption, GWLP_USERDATA, (LONG_PTR)this); _hDefaultCaptionProc = reinterpret_cast<WNDPROC>(::SetWindowLongPtr(_hCaption, GWLP_WNDPROC, (LONG_PTR)wndCaptionProc)); // intial subclassing of tab ::SetWindowLongPtr(_hContTab, GWLP_USERDATA, (LONG_PTR)this); _hDefaultTabProc = reinterpret_cast<WNDPROC>(::SetWindowLongPtr(_hContTab, GWLP_WNDPROC, (LONG_PTR)wndTabProc)); // set min tab width ::SendMessage(_hContTab, TCM_SETMINTABWIDTH, 0, (LPARAM)MIN_TABWIDTH); break; } case WM_NCCALCSIZE: case WM_SIZE: { onSize(); break; } case WM_DRAWITEM : { // draw tab or caption if (((DRAWITEMSTRUCT *)lParam)->CtlID == IDC_TAB_CONT) { drawTabItem((DRAWITEMSTRUCT *)lParam); return TRUE; } else { drawCaptionItem((DRAWITEMSTRUCT *)lParam); return TRUE; } break; } case WM_NCLBUTTONDBLCLK : { RECT rcWnd = {0}; RECT rcClient = {0}; POINT pt = {HIWORD(lParam), LOWORD(lParam)}; getWindowRect(rcWnd); getClientRect(rcClient); ClientRectToScreenRect(_hSelf, &rcClient); rcWnd.bottom = rcClient.top; // if in caption if ((rcWnd.top < pt.x) && (rcWnd.bottom > pt.x) && (rcWnd.left < pt.y) && (rcWnd.right > pt.y)) { NotifyParent(DMM_DOCKALL); return TRUE; } break; } case WM_SYSCOMMAND : { switch (wParam & 0xfff0) { case SC_MOVE: NotifyParent(DMM_MOVE); return TRUE; default: break; } return FALSE; } case WM_COMMAND : { switch (LOWORD(wParam)) { case IDCANCEL: doClose(); return TRUE; default : break; } break; } default: break; } return FALSE; }