void Report::Put(const RichText& txt, void *context) { PageY py(pagei, y); LLOG("Put RichText, py: " << py << ", pagerect: " << GetPageRect()); PaintInfo paintinfo; paintinfo.top = PageY(0, 0); paintinfo.bottom = PageY(INT_MAX, INT_MAX); paintinfo.indexentry = Null; paintinfo.hyperlink = Null; paintinfo.context = context; txt.Paint(*this, py, GetPageRect(), paintinfo); py = txt.GetHeight(py, GetPageRect()); LLOG("Final pos: " << py); Page(py.page); y = py.y; }
int wxChoicebook::SetSelection(size_t n) { wxCHECK_MSG( IS_VALID_PAGE(n), wxNOT_FOUND, wxT("invalid page index in wxChoicebook::SetSelection()") ); const int oldSel = m_selection; if ( int(n) != m_selection ) { wxChoicebookEvent event(wxEVT_COMMAND_CHOICEBOOK_PAGE_CHANGING, m_windowId); event.SetSelection(n); event.SetOldSelection(m_selection); event.SetEventObject(this); if ( !GetEventHandler()->ProcessEvent(event) || event.IsAllowed() ) { if ( m_selection != wxNOT_FOUND ) m_pages[m_selection]->Hide(); wxWindow *page = m_pages[n]; page->SetSize(GetPageRect()); page->Show(); // change m_selection now to ignore the selection change event m_selection = n; m_choice->Select(n); // program allows the page change event.SetEventType(wxEVT_COMMAND_CHOICEBOOK_PAGE_CHANGED); (void)GetEventHandler()->ProcessEvent(event); } } return oldSel; }
int wxToolbook::HitTest(const wxPoint& pt, long *flags) const { int pagePos = wxNOT_FOUND; if ( flags ) *flags = wxBK_HITTEST_NOWHERE; // convert from wxToolbook coordinates to wxToolBar ones const wxToolBarBase * const tbar = GetToolBar(); const wxPoint tbarPt = tbar->ScreenToClient(ClientToScreen(pt)); // is the point over the toolbar? if ( wxRect(tbar->GetSize()).Contains(tbarPt) ) { const wxToolBarToolBase * const tool = tbar->FindToolForPosition(tbarPt.x, tbarPt.y); if ( tool ) { pagePos = tbar->GetToolPos(tool->GetId()); if ( flags ) *flags = wxBK_HITTEST_ONICON | wxBK_HITTEST_ONLABEL; } } else // not over the toolbar { if ( flags && GetPageRect().Contains(pt) ) *flags |= wxBK_HITTEST_ONPAGE; } return pagePos; }
void CRegisterTabs::RedrawCurrentTab() { int nPage = GetCurSel(); CRect pageRect = GetPageRect(); ::SetWindowPos(m_TabWindows[nPage], HWND_TOP, pageRect.left, pageRect.top, pageRect.Width(), pageRect.Height(), SWP_SHOWWINDOW); }
CWindow CRegisterTabs::AddTab(char* caption, int dialogId, DLGPROC dlgProc) { AddItem(caption); CWindow parentWin = GetParent(); CWindow tabWin = ::CreateDialogParam(NULL, MAKEINTRESOURCE(dialogId), parentWin, dlgProc, (LPARAM)&m_attached); CRect pageRect = GetPageRect(); ::SetParent(tabWin, parentWin); ::SetWindowPos( tabWin, m_hWnd, pageRect.left, pageRect.top, pageRect.Width(), pageRect.Height(), SWP_HIDEWINDOW ); m_TabWindows.push_back(tabWin); int index = m_TabWindows.size() - 1; if (index == 0) { ShowTab(0); } return tabWin; }
void CEGPageCtrl::AddPage( CPropertyPage* pPage, UINT nResourceID, TCHAR* lpszTitle ){ // В список m_pages.push_back(pPage); // Закладка InsertItem( TCIF_PARAM | TCIF_TEXT, GetItemCount(), lpszTitle, -1, (LPARAM) pPage ); // Страничка pPage->Create( nResourceID, GetParent() ); pPage->SetParent( GetParent() ); pPage->ShowWindow( SW_HIDE ); // Корректировка стилей // ::SetWindowLong( pPage->m_hWnd, GWL_STYLE, WS_CHILD | WS_CLIPCHILDREN | WS_CLIPSIBLINGS ); pPage->ModifyStyle( WS_BORDER, 0 ); pPage->ModifyStyle( WS_DLGFRAME, 0 ); pPage->ModifyStyle( WS_POPUPWINDOW, 0 ); pPage->ModifyStyleEx( WS_EX_DLGMODALFRAME, 0 ); pPage->ModifyStyleEx( WS_EX_WINDOWEDGE, 0 ); pPage->ModifyStyle( 0, WS_CHILD ); // Положение if ( !m_pActivePage ) { m_pActivePage = pPage; CRect rcPage = GetPageRect(); pPage->MoveWindow( &rcPage ); pPage->ShowWindow( SW_SHOW ); } }
// @@@ OnSize() is used for setting the font when it's called for the first // time because doing it in ::Create() doesn't work (for unknown reasons) void wxNotebook::OnSize(wxSizeEvent& event) { unsigned int nCount = m_pages.Count(); wxRect rect = GetPageRect() ; for ( unsigned int nPage = 0; nPage < nCount; nPage++ ) { wxNotebookPage *pPage = m_pages[nPage]; pPage->SetSize(rect, wxSIZE_FORCE_EVENT); } #if 0 // deactivate r65078 for the moment // If the selected page is hidden at this point, the notebook // has become visible for the first time after creation, and // we postponed showing the page in ChangePage(). // So show the selected page now. if ( m_selection != wxNOT_FOUND ) { wxNotebookPage *pPage = m_pages[m_selection]; if ( !pPage->IsShown() ) { pPage->Show( true ); pPage->SetFocus(); } } #endif // Processing continues to next OnSize event.Skip(); }
void FormView::DrawGrid(Draw& w) { if (!IsLayout()) return; if (GetBool("Grid.Visible", true)) { Point p = GetPageRect().TopLeft(); Size sz = GetPageRect().GetSize(); Size g = GetGridSize(); for (int i = p.x; i <= sz.cx + g.cx; i += g.cx) for (int j = p.y; j <= sz.cy + g.cy; j += g.cy) w.DrawRect(ZoomX(i), ZoomY(j), 1, 1, Gray); } }
void CRegisterTabs::ShowTab(int nPage) { for (size_t i = 0; i < m_TabWindows.size(); i++) { ::ShowWindow(m_TabWindows[i], SW_HIDE); } CRect pageRect = GetPageRect(); ::SetWindowPos(m_TabWindows[nPage], HWND_TOP, pageRect.left, pageRect.top, pageRect.Width(), pageRect.Height(), SWP_SHOWWINDOW); }
// same as AddPage() but does it at given position bool wxNotebook::InsertPage(size_t nPage, wxNotebookPage *pPage, const wxString& strText, bool bSelect, int imageId ) { if ( !wxNotebookBase::InsertPage( nPage, pPage, strText, bSelect, imageId ) ) return false; wxASSERT_MSG( pPage->GetParent() == this, wxT("notebook pages must have notebook as parent") ); // don't show pages by default (we'll need to adjust their size first) pPage->Show( false ) ; pPage->SetLabel( wxStripMenuCodes(strText) ); m_images.Insert( imageId, nPage ); MacSetupTabs(); wxRect rect = GetPageRect() ; pPage->SetSize( rect ); if ( pPage->GetAutoLayout() ) pPage->Layout(); // now deal with the selection // --------------------------- // if the inserted page is before the selected one, we must update the // index of the selected page if ( int(nPage) <= m_nSelection ) { m_nSelection++; // while this still is the same page showing, we need to update the tabs m_peer->SetValue( m_nSelection + 1 ) ; } // some page should be selected: either this one or the first one if there // is still no selection int selNew = -1; if ( bSelect ) selNew = nPage; else if ( m_nSelection == -1 ) selNew = 0; if ( selNew != -1 ) SetSelection( selNew ); InvalidateBestSize(); return true; }
Draw& Report::Page(int i) { ASSERT(i >= 0); if(i != pagei) { Flush(); pagei = i; while(page.GetCount() <= pagei) StartPage(page.GetCount()); y = GetPageRect().top; } return *this; }
void MapBG::StatePerformed(dword state, const String& param) { if (_currLevel < 0 || _currLevel >= _levels.GetCount()) return; MipMapLevel& level = _levels[_currLevel]; Rect pageRect = GetPageRect(); if (_recalc || !_virtPage.Contains(GetPageRect())) { _virtPage = pageRect.Inflated(level.GetBlockSize() * _cachePageInitSize); _recalc = true; } Rect currVirtualPage = _virtPage.Inflated(level.GetBlockSize() * _cachePageSize); if (!_recalc) return; for (int i = 0; i < level.GetMipMaps().GetCount(); ++i) { Point pi = level.GetMipMaps().GetKey(i); Rect itemRect(pi, level.GetBlockSize()); if (!level.GetMipMaps()[i]) continue; if (currVirtualPage.Intersects(itemRect)) { level.GetMipMaps()[i]->Prepare( AppendFileName(_mapDir, NFormat("%d-%d-%d.png", _currLevel, pi.x, pi.y)), level.GetBlockSize() ); } else level.GetMipMaps()[i]->Release(); } _recalc = false; }
void Report::StartPage(int i) { DrawingDraw dw(GetSize()); page.At(i) = dw; LLOG("Start page " << i); Create(GetSize()); WhenPage(); LLOG("Paint header"); PaintHF(*this, 0, header, i); LLOG("Paint footer"); PaintHF(*this, GetSize().cy - footercy, footer, i); y = GetPageRect().top; }
void COXCustomizeManager::OnSize(UINT nType, int cx, int cy) { CDialog::OnSize(nType, cx, cy); // TODO: Add your message handler code here if(m_bInitialized) { RecalcPageRect(); if(m_pActivePage!=NULL) { m_pActivePage->MoveWindow(GetPageRect()); } } }
// @@@ OnSize() is used for setting the font when it's called for the first // time because doing it in ::Create() doesn't work (for unknown reasons) void wxNotebook::OnSize(wxSizeEvent& event) { unsigned int nCount = m_pages.Count(); wxRect rect = GetPageRect() ; for ( unsigned int nPage = 0; nPage < nCount; nPage++ ) { wxNotebookPage *pPage = m_pages[nPage]; pPage->SetSize(rect); if ( pPage->GetAutoLayout() ) pPage->Layout(); } // Processing continues to next OnSize event.Skip(); }
int wxBookCtrlBase::DoSetSelection(size_t n, int flags) { wxCHECK_MSG( n < GetPageCount(), wxNOT_FOUND, wxT("invalid page index in wxBookCtrlBase::DoSetSelection()") ); const int oldSel = GetSelection(); if ( n != (size_t)oldSel ) { wxBookCtrlEvent *event = CreatePageChangingEvent(); bool allowed = false; if ( flags & SetSelection_SendEvent ) { event->SetSelection(n); event->SetOldSelection(oldSel); event->SetEventObject(this); allowed = !GetEventHandler()->ProcessEvent(*event) || event->IsAllowed(); } if ( !(flags & SetSelection_SendEvent) || allowed) { if ( oldSel != wxNOT_FOUND ) m_pages[oldSel]->Hide(); wxWindow *page = m_pages[n]; page->SetSize(GetPageRect()); page->Show(); // change selection now to ignore the selection change event UpdateSelectedPage(n); if ( flags & SetSelection_SendEvent ) { // program allows the page change MakeChangedEvent(*event); (void)GetEventHandler()->ProcessEvent(*event); } } delete event; } return oldSel; }
void wxChoicebook::OnSize(wxSizeEvent& event) { event.Skip(); if ( !m_choice ) { // we're not fully created yet return; } // resize the choice control and the page area to fit inside our new size const wxSize sizeClient = GetClientSize(), sizeChoice = GetChoiceSize(); wxPoint posChoice; switch ( GetWindowStyle() & wxCHB_ALIGN_MASK ) { default: wxFAIL_MSG( _T("unexpected wxChoicebook alignment") ); // fall through case wxCHB_TOP: case wxCHB_LEFT: // posChoice is already ok break; case wxCHB_BOTTOM: posChoice.y = sizeClient.y - sizeChoice.y; break; case wxCHB_RIGHT: posChoice.x = sizeClient.x - sizeChoice.x; break; } m_choice->Move(posChoice.x, posChoice.y); m_choice->SetSize(sizeChoice.x, sizeChoice.y); // resize the currently shown page if ( m_selection != wxNOT_FOUND ) { wxWindow *page = m_pages[m_selection]; wxCHECK_RET( page, _T("NULL page in wxChoicebook?") ); page->SetSize(GetPageRect()); } }
int wxTreebook::HitTest(wxPoint const & pt, long * flags) const { int pagePos = wxNOT_FOUND; if ( flags ) *flags = wxBK_HITTEST_NOWHERE; // convert from wxTreebook coorindates to wxTreeCtrl ones const wxTreeCtrl * const tree = GetTreeCtrl(); const wxPoint treePt = tree->ScreenToClient(ClientToScreen(pt)); // is it over the tree? if ( wxRect(tree->GetSize()).Contains(treePt) ) { int flagsTree; wxTreeItemId id = tree->HitTest(treePt, flagsTree); if ( id.IsOk() && (flagsTree & wxTREE_HITTEST_ONITEM) ) { pagePos = DoInternalFindPageById(id); } if ( flags ) { if ( pagePos != wxNOT_FOUND ) *flags = 0; if ( flagsTree & (wxTREE_HITTEST_ONITEMBUTTON | wxTREE_HITTEST_ONITEMICON | wxTREE_HITTEST_ONITEMSTATEICON) ) *flags |= wxBK_HITTEST_ONICON; if ( flagsTree & wxTREE_HITTEST_ONITEMLABEL ) *flags |= wxBK_HITTEST_ONLABEL; } } else // not over the tree { if ( flags && GetPageRect().Contains( pt ) ) *flags |= wxBK_HITTEST_ONPAGE; } return pagePos; }
bool wxBookCtrlBase::InsertPage(size_t nPage, wxWindow *page, const wxString& WXUNUSED(text), bool WXUNUSED(bSelect), int WXUNUSED(imageId)) { wxCHECK_MSG( page || AllowNullPage(), false, wxT("NULL page in wxBookCtrlBase::InsertPage()") ); wxCHECK_MSG( nPage <= m_pages.size(), false, wxT("invalid page index in wxBookCtrlBase::InsertPage()") ); m_pages.Insert(page, nPage); if ( page ) page->SetSize(GetPageRect()); DoInvalidateBestSize(); return true; }
void CEGPageCtrl::OnTabChanged( NMHDR* /* pNotifyStruct */, LRESULT* /* result */ ) { // TODO: OnKillActive, OnNext and other.. if ( m_pActivePage ) m_pActivePage->ShowWindow( SW_HIDE ); // TODO: OnSetActive, OnNext and other.. int nSel = GetCurSel(); if ( -1 == nSel ){ m_pActivePage = NULL; return; } else { TC_ITEM tci; tci.mask = TCIF_PARAM; GetItem( nSel, &tci ); m_pActivePage = (CPropertyPage*) tci.lParam; if ( m_pActivePage ) { CRect rcPage = GetPageRect(); m_pActivePage->MoveWindow( &rcPage ); m_pActivePage->ShowWindow( SW_SHOW ); } } }
int wxListbook::HitTest(const wxPoint& pt, long *flags) const { int pagePos = wxNOT_FOUND; if ( flags ) *flags = wxBK_HITTEST_NOWHERE; // convert from listbook control coordinates to list control coordinates const wxListView * const list = GetListView(); const wxPoint listPt = list->ScreenToClient(ClientToScreen(pt)); // is the point inside list control? if ( wxRect(list->GetSize()).Contains(listPt) ) { int flagsList; pagePos = list->HitTest(listPt, flagsList); if ( flags ) { if ( pagePos != wxNOT_FOUND ) *flags = 0; if ( flagsList & (wxLIST_HITTEST_ONITEMICON | wxLIST_HITTEST_ONITEMSTATEICON ) ) *flags |= wxBK_HITTEST_ONICON; if ( flagsList & wxLIST_HITTEST_ONITEMLABEL ) *flags |= wxBK_HITTEST_ONLABEL; } } else // not over list control at all { if ( flags && GetPageRect().Contains(pt) ) *flags |= wxBK_HITTEST_ONPAGE; } return pagePos; }
// Lay out controls void wxBookCtrlBase::DoSize() { if ( !m_bookctrl ) { // we're not fully created yet or OnSize() should be hidden by derived class return; } if (GetSizer()) Layout(); else { // resize controller and the page area to fit inside our new size const wxSize sizeClient( GetClientSize() ), sizeBorder( m_bookctrl->GetSize() - m_bookctrl->GetClientSize() ), sizeCtrl( GetControllerSize() ); m_bookctrl->SetClientSize( sizeCtrl.x - sizeBorder.x, sizeCtrl.y - sizeBorder.y ); // if this changes the visibility of the scrollbars the best size changes, relayout in this case wxSize sizeCtrl2 = GetControllerSize(); if ( sizeCtrl != sizeCtrl2 ) { wxSize sizeBorder2 = m_bookctrl->GetSize() - m_bookctrl->GetClientSize(); m_bookctrl->SetClientSize( sizeCtrl2.x - sizeBorder2.x, sizeCtrl2.y - sizeBorder2.y ); } const wxSize sizeNew = m_bookctrl->GetSize(); wxPoint posCtrl; switch ( GetWindowStyle() & wxBK_ALIGN_MASK ) { default: wxFAIL_MSG( wxT("unexpected alignment") ); // fall through case wxBK_TOP: case wxBK_LEFT: // posCtrl is already ok break; case wxBK_BOTTOM: posCtrl.y = sizeClient.y - sizeNew.y; break; case wxBK_RIGHT: posCtrl.x = sizeClient.x - sizeNew.x; break; } if ( m_bookctrl->GetPosition() != posCtrl ) m_bookctrl->Move(posCtrl); } // resize all pages to fit the new control size const wxRect pageRect = GetPageRect(); const unsigned pagesCount = m_pages.GetCount(); for ( unsigned int i = 0; i < pagesCount; ++i ) { wxWindow * const page = m_pages[i]; if ( !page ) { wxASSERT_MSG( AllowNullPage(), wxT("Null page in a control that does not allow null pages?") ); continue; } page->SetSize(pageRect); } }
void CXMLDlg::HandlePageItems(HTREEITEM pItem, CAGPage* pPage, POINT& ptOffset) { HTREEITEM pChildItem = m_treeOutput.GetChildItem(pItem); if (!pChildItem) { ASSERT(false); return; } CRect PageRect; GetPageRect(pPage, &PageRect); PageRect.OffsetRect(ptOffset); while (pChildItem) { CRect ItemRect; GetCurrentObjectRect(pChildItem, ItemRect); CString szItemType = m_treeOutput.GetItemText(pChildItem); if (!szItemType.CompareNoCase(_T("image")) ) { if (Intersect(ItemRect, PageRect)) CreateImageItem(pChildItem, pPage, ptOffset); } else if (!szItemType.CompareNoCase(_T("text")) || !szItemType.CompareNoCase(_T("date")) ) { if (Intersect(ItemRect, PageRect)) CreateTextItem(pChildItem, pPage, ptOffset); } else if (!szItemType.CompareNoCase(_T("rectangle")) || !szItemType.CompareNoCase(_T("drawing")) || !szItemType.CompareNoCase(_T("line")) || !szItemType.CompareNoCase(_T("ellipse")) ) { if (Intersect(ItemRect, PageRect)) CreateGraphicItem(pChildItem, pPage, ptOffset, szItemType); } else if (!szItemType.CompareNoCase(_T("border")) || !szItemType.CompareNoCase(_T("hyperlink")) ) { if (Intersect(ItemRect, PageRect)) CreateGraphicItem(pChildItem, pPage, ptOffset, szItemType); } else if (!szItemType.CompareNoCase(_T("group")) || !szItemType.CompareNoCase(_T("calendar")) || !szItemType.CompareNoCase(_T("table")) || !szItemType.CompareNoCase(_T("cell")) ) { HandlePageItems(pChildItem, pPage, ptOffset); } else { CString szTitle; CString szValue; Separate(m_treeOutput.GetItemText(pChildItem), szTitle, szValue); if (!szTitle.CompareNoCase(_T("dx")) ) { long lHeight = INCHES(atof(szValue)); } else if (!szTitle.CompareNoCase(_T("dy")) ) { long lWidth = INCHES(atof(szValue)); } } pChildItem = m_treeOutput.GetNextItem(pChildItem, TVGN_NEXT); } }
int wxBookCtrlBase::DoSetSelection(size_t n, int flags) { wxCHECK_MSG( n < GetPageCount(), wxNOT_FOUND, wxT("invalid page index in wxBookCtrlBase::DoSetSelection()") ); const int oldSel = GetSelection(); if ( n != (size_t)oldSel ) { wxBookCtrlEvent *event = CreatePageChangingEvent(); bool allowed = true; if ( flags & SetSelection_SendEvent ) { event->SetSelection(n); event->SetOldSelection(oldSel); event->SetEventObject(this); allowed = !GetEventHandler()->ProcessEvent(*event) || event->IsAllowed(); } if ( allowed ) { if ( oldSel != wxNOT_FOUND ) { if ( wxWindow* const oldPage = TryGetNonNullPage(oldSel) ) { DoShowPage(oldPage, false); } } if ( wxWindow* const page = TryGetNonNullPage(n) ) { page->SetSize(GetPageRect()); DoShowPage(page, true); } // change selection now to ignore the selection change event m_selection = n; UpdateSelectedPage(n); if ( flags & SetSelection_SendEvent ) { // program allows the page change MakeChangedEvent(*event); (void)GetEventHandler()->ProcessEvent(*event); } } else { // Selection in the control might have already had changed. if ( oldSel != wxNOT_FOUND ) { m_selection = oldSel; UpdateSelectedPage(oldSel); } } delete event; } return oldSel; }
void FormView::Paint(Draw& w) { if (!IsLayout()) { w.DrawRect(GetRect(), White()); return; } Rect r = Zoom(GetPageRect()); DrawGrid(w); DrawRect(w, r, 1, LtBlue()); w.DrawRect(0, 0, r.left, 3000, White()); w.DrawRect(r.right + 1, 0, 3000, 3000, White()); w.DrawRect(r.left, 0, 5000, r.top, White()); w.DrawRect(r.left, r.bottom + 1, 3000, 3000, White()); // if (_showInfo) // { // r.SetSize( Zoom(Size(804, 604)) ); // DrawRect(w, r.Offseted( Zoom(Size(-2, -2)) ), 1, LtMagenta()); // r = Zoom(GetPageRect()); // } if (GetObjectCount() > 0 && _showInfo == 2) { Rect b = Zoom(GetObjectsRect()).Offseted(1, 1); b.SetSize( b.GetSize() + Size(-2, -2) ); DrawRect(w, b, 1, Yellow()); } Vector<int> sel = GetSelected(); bool coloring = GetBool("View.Coloring"); int ci = 0; if (sel.GetCount() > 0) { if (sel.GetCount() == 1) { for (int i = 0; i < GetObjectCount(); ++i) { if (ci++ == _colors.GetCount() - 1) ci = 0; if (coloring && i != sel[0]) DrawObject(w, i, _colors[ci], false); else DrawObject(w, i, (!coloring && (i == sel[0])) ? _colors[ci] : LtGray(), i == sel[0]); } } else { for (int i = 0; i < GetObjectCount(); ++i) { if (ci++ == _colors.GetCount() - 1) ci = 0; bool found = false; for (int j = 0; j < sel.GetCount(); ++j) if ( i == sel[j]) { found = true; break; } if (coloring && !found) DrawObject(w, i, _colors[ci], false); else DrawObject(w, i, (!coloring && found) ? _colors[ci] : LtGray(), false); } Size g = GetGridSize(); Rect s = GetSelectionRect().Offseted(-g.cx / 2, -g.cy / 2); s.SetSize(s.GetSize() + Size(g.cx, g.cy)); Vector<int> sel = GetSelected(); bool a1 = true; // allow horz align bool a2 = true; // allow vert align dword f1; // first horz align dword f2; // first vert align for (int i = 0; i < sel.GetCount(); ++i) { FormObject *pI = GetObject(sel[i]); if (!pI) continue; if (i == 0) { f1 = pI->GetHAlign(); f2 = pI->GetVAlign(); } if (f1 != pI->GetHAlign()) { a1 = false; } if (f2 != pI->GetVAlign()) { a2 = false; } } DrawSprings(w, Zoom(s), f1, f2, a1, a2, a1, a2, false); DrawRect(w, Zoom(s), 1, LtRed()); s = GetSelectionRect().Offseted(-g.cx, -g.cy); s.SetSize(s.GetSize() + Size(g.cx * 2, g.cy * 2)); DrawGroupTools(w, Zoom(s)); } return; } for (int i = 0; i < GetObjectCount(); ++i) { if (ci++ == _colors.GetCount() - 1) ci = 0; DrawObject(w, i, coloring ? _colors[ci] : LtGray()); } if (sel.GetCount() == 0) w.DrawImage(r.right, r.bottom, FormViewImg::SizerBR()); }
uint32 CGsCachedArea::GetPageCount() const { auto pageRect = GetPageRect(); return pageRect.first * pageRect.second; }
BOOL COXCustomizeManager::ActivatePage(HSHBGROUP hGroup, int nIndex) { ASSERT(hGroup!=NULL && nIndex!=-1); COXCustomizePage* pCustomizePage=GetPageByLocation(hGroup,nIndex); if(pCustomizePage==NULL) { TRACE(_T("COXCustomizeManager::ActivatePage: failed to retrieve page object\n")); return FALSE; } COXCustomizePage* pActivePage=GetActivePage(); if(pCustomizePage==pActivePage) { return TRUE; } if(pActivePage!=NULL) { HSHBGROUP hGroupTest=NULL; int nIndexTest=-1; VERIFY(FindPage(pActivePage,hGroupTest,nIndexTest)); ASSERT(hGroupTest!=NULL && nIndexTest!=-1); if(hGroupTest!=hGroup) { COXSHBListCtrl* pListCtrl=m_shb.GetGroupListCtrl(hGroupTest); ASSERT(pListCtrl!=NULL); pListCtrl->ActivateItem(-1); } pActivePage->Unload(); m_pActivePage=NULL; } if(!pCustomizePage->Load(this)) { TRACE(_T("COXCustomizeManager::ActivatePage: failed to load the page\n")); return FALSE; } pCustomizePage->MoveWindow(GetPageRect()); pCustomizePage->SetFocus(); m_pActivePage=pCustomizePage; // expand corresponding group m_shb.ExpandGroup(hGroup); // activate corresponding item in the shortcut bar control COXSHBListCtrl* pListCtrl=m_shb.GetGroupListCtrl(hGroup); ASSERT(pListCtrl!=NULL); pListCtrl->ActivateItem(nIndex); pListCtrl->EnsureVisible(nIndex,FALSE); // change the title text m_title.SetWindowText(pListCtrl->GetItemText(nIndex,0)); // update the state of the "Apply Changes" button GetDlgItem(IDC_OX_BUTTON_APPLY)-> EnableWindow(pCustomizePage->IsSupportingApplyChanges()); // send initial update to all controls in the activated page SendMessageToDescendants(WM_INITIALUPDATE,0,0,TRUE,TRUE); return (pListCtrl->GetActiveItem()==nIndex); }
BOOL COXCustomizeManager::OnInitDialog() { CDialog::OnInitDialog(); // TODO: Add extra initialization here // setup shortcut bar m_shb.SetBarStyle(SHBS_INFOTIP|SHBS_UNDERLINEHOTITEM|SHBS_SHOWACTIVEALWAYS| SHBS_BOLDEXPANDEDGROUP|SHBS_DISABLEDRAGDROPITEM|SHBS_DRAWHEADERDRAGIMAGE); // setup title m_title.SetTextColor(::GetSysColor(COLOR_CAPTIONTEXT)); m_title.SetBkColor(::GetSysColor(COLOR_BTNFACE)); m_title.SetBackgroundFillType(GRADIENT_LEFT); CFont fontTitle; VERIFY(fontTitle.CreatePointFont(120,_T("MS Sans Serif"))); m_title.SetTextFont(&fontTitle); // layout manager // if(m_LayoutManager.IsAttached()) m_LayoutManager.Detach(); m_LayoutManager.Attach(this); // shortcut bar control m_LayoutManager.TieChild(IDC_OX_SHB_PAGES,OX_LMS_TOP|OX_LMS_BOTTOM,OX_LMT_SAME); // title m_LayoutManager.TieChild(IDC_OX_STATIC_TITLE,OX_LMS_RIGHT|OX_LMS_LEFT,OX_LMT_SAME); // title separator m_LayoutManager.TieChild(IDC_OX_SEPARATOR_TITLE, OX_LMS_RIGHT|OX_LMS_LEFT,OX_LMT_SAME); // bottom separator m_LayoutManager.TieChild(IDC_OX_SEPARATOR_BOTTOM, OX_LMS_RIGHT|OX_LMS_LEFT|OX_LMS_BOTTOM,OX_LMT_SAME); // OK, Cancel, Apply buttons m_LayoutManager.TieChild(IDOK,OX_LMS_BOTTOM|OX_LMS_RIGHT,OX_LMT_SAME); m_LayoutManager.TieChild(IDCANCEL,OX_LMS_BOTTOM|OX_LMS_RIGHT,OX_LMT_SAME); m_LayoutManager.TieChild(IDC_OX_BUTTON_APPLY,OX_LMS_BOTTOM|OX_LMS_RIGHT,OX_LMT_SAME); ////////////////////////////////////// // populate the manager with standard and user defined pages PopulatePages(); for(int nIndex=0; nIndex<m_shb.GetGroupCount(); nIndex++) { HSHBGROUP hGroup=m_shb.FindGroupByOrder(nIndex); ASSERT(hGroup!=NULL); m_shb.SortLCItems(hGroup); } #ifdef OX_CUSTOMIZE_WORKSPACE_STATE ASSERT(GetWorkspaceStatePage()!=NULL); // go through all pages and check if it should be displayed POSITION pos=m_mapPages.GetStartPosition(); while(pos!=NULL) { DWORD dwID=NULL; COXCustomizePage* pCustomizePage=NULL; m_mapPages.GetNextAssoc(pos,pCustomizePage,dwID); ASSERT(pCustomizePage!=NULL && dwID!=NULL); if(!GetWorkspaceStatePage()->IsViewablePage(pCustomizePage)) VERIFY(DeletePage(pCustomizePage)); } #endif // OX_CUSTOMIZE_WORKSPACE_STATE // activate first page HSHBGROUP hGroup=m_shb.FindGroupByOrder(0); ASSERT(hGroup!=NULL); COXCustomizePage* pCustomizePage=GetPageByLocation(hGroup,0); ASSERT(pCustomizePage!=NULL); VERIFY(ActivatePage(pCustomizePage)); // calculate the position of the active page window RecalcPageRect(); // adjust the position of the current active page if(m_pActivePage!=NULL) m_pActivePage->MoveWindow(GetPageRect()); // mark the dialog as initialized m_bInitialized=TRUE; return FALSE; }