void TabDisplay::Add(const TCHAR *caption, const MaskedIcon *icon) { TabButton *b = new TabButton(caption, icon); buttons.append(b); CalculateLayout(); }
BOOL CWinRect::CalculateIdealLayout( SPanelLayout *pSl, LPRECT pRect, long lNumPanels ) {_STT(); // Sanity check if ( !pSl || !pRect || 0 >= lNumPanels || PRW( pRect ) <= 0 || PRH( pRect ) <= 0 ) return FALSE; // Calculate aspect ratio double dAspectRatio = (double)PRH( pRect ) / (double)PRW( pRect ); RECT rect; SetRect( &rect, 0, 0, 10000, 10000 ); CGrDC::AspectCorrect( &rect, pRect ); // Get a layout that works CalculateLayout( pSl, &rect, lNumPanels, dAspectRatio ); // Now adjust to a size we would want pSl->lPanelWidth = PRW( pRect ); pSl->lPanelHeight = PRH( pRect ); // In the ideal case, there is no margin pSl->lxMargin = 0; pSl->lyMargin = 0; // Set minimal bounding rectangle SetRect( pRect, 0, 0, pSl->lxPanels * pSl->lPanelWidth, pSl->lyPanels * pSl->lPanelHeight ); return TRUE; }
virtual void Prepare(ContainerWindow &parent, const PixelRect &rc) override { assert(!visible); ButtonWindowStyle style; style.Hide(); style.TabStop(); const DialogLook &look = UIGlobals::GetDialogLook(); const Layout layout = CalculateLayout(rc); edit_button = new WndButton(parent, look, _("Edit Point"), layout.edit, style, *listener, EDIT); mutate_button = new WndButton(parent, look, _("Make Finish"), layout.down, style, *listener, MUTATE); down_button = new WndSymbolButton(parent, look, _T("v"), layout.down, style, *listener, DOWN); up_button = new WndSymbolButton(parent, look, _T("^"), layout.down, style, *listener, UP); clear_all_button = new WndButton(parent, look, _("Clear All"), layout.clear_all, style, *listener, CLEAR_ALL); }
void TabDisplay::OnResize(PixelSize new_size) { PaintWindow::OnResize(new_size); CalculateLayout(); }
HRESULT MainWindow::CreateGraphicsResources() { HRESULT hr = S_OK; if (pRenderTarget == NULL) { RECT rc; GetClientRect(m_hwnd, &rc); D2D1_SIZE_U size = D2D1::SizeU(rc.right, rc.bottom); hr = pFactory->CreateHwndRenderTarget( D2D1::RenderTargetProperties(), D2D1::HwndRenderTargetProperties(m_hwnd, size), &pRenderTarget); if (SUCCEEDED(hr)) { const D2D1_COLOR_F color = D2D1::ColorF(1.0f, 1.0f, 0); hr = pRenderTarget->CreateSolidColorBrush(color, &pBrush); if (SUCCEEDED(hr)) { CalculateLayout(); } } } return hr; }
void TwoWidgets::UpdateLayout() { const auto layout = CalculateLayout(rc); first->Move(layout.first); second->Move(layout.second); }
void Prepare(ContainerWindow &parent, const PixelRect &rc) override { assert(!visible); WindowStyle style; style.Hide(); style.TabStop(); const ButtonLook &look = UIGlobals::GetDialogLook().button; const Layout layout = CalculateLayout(rc); edit_button.Create(parent, look, _("Edit Point"), layout.edit, style, *listener, EDIT); mutate_button.Create(parent, look, _("Make Finish"), layout.down, style, *listener, MUTATE); down_button.Create(parent, layout.down, style, new SymbolButtonRenderer(look, _T("v")), *listener, DOWN); up_button.Create(parent, layout.down, style, new SymbolButtonRenderer(look, _T("^")), *listener, UP); reverse_button.Create(parent, look, _("Reverse"), layout.reverse, style, *listener, REVERSE); clear_all_button.Create(parent, look, _("Clear All"), layout.clear_all, style, *listener, CLEAR_ALL); }
void CXTPChartRadarPointSeriesLabelView::CalculateLayout(CXTPChartDeviceContext* pDC) { CXTPChartString text(m_pLabel->GetPointLabel(m_pPointView->GetPoint())); CXTPChartPointF ptAnchorPoint = GetAnchorPoint(); CalculateLayout(pDC, ptAnchorPoint, GetAnchorAngle(), text); }
HRESULT Scene::CreateGraphicsResources(HWND hwnd) { HRESULT hr = S_OK; if (m_pRenderTarget == NULL) { RECT rc; GetClientRect(hwnd, &rc); D2D1_SIZE_U size = D2D1::SizeU(rc.right, rc.bottom); hr = m_pFactory->CreateHwndRenderTarget( D2D1::RenderTargetProperties(), D2D1::HwndRenderTargetProperties(hwnd, size), &m_pRenderTarget ); if (SUCCEEDED(hr)) { hr = CreateDeviceDependentResources(); } if (SUCCEEDED(hr)) { CalculateLayout(); } } return hr; }
void TwoWidgets::Move(const PixelRect &rc) { this->rc = rc; const auto layout = CalculateLayout(rc); first->Move(layout.first); second->Move(layout.second); }
void CGUIBaseContainer::AllocResources() { CGUIControl::AllocResources(); CalculateLayout(); if (m_listProvider) { UpdateListProvider(true); SelectItem(m_listProvider->GetDefaultItem()); } }
void UpdatePositions(const PixelRect &rc) { assert(visible); const Layout layout = CalculateLayout(rc); edit_button->Move(layout.edit); mutate_button->Move(layout.down); down_button->Move(layout.down); up_button->Move(layout.up); clear_all_button->Move(layout.clear_all); }
void MCPrinter::DoLayout(MCCard *p_first_card, uint32_t p_number_of_cards, const MCRectangle& p_src_rect, bool p_marked) { if (m_loop_nesting > 0 && m_loop_status == STATUS_READY) { MCStack *t_card_owner; t_card_owner = p_first_card -> getstack(); // MW-2010-10-04: We should back up the *current* card of the stack, to restore after layout. MCCard *t_old_card; t_old_card = t_card_owner -> getcard(0); Boolean t_old_lock; t_old_lock = MClockmessages; // Lock messages, as we do not want any opencard messages etc. to be sent when cycling cards. MClockmessages = True; uint32_t t_number_cards_left; t_number_cards_left = p_number_of_cards; MCCard *t_current_card; t_current_card = p_first_card; while(t_number_cards_left > 0 && m_loop_status == STATUS_READY) { // Set the card of the stack. t_card_owner -> setcard(t_current_card, False, False); /// Calculate the layout for this card, and do a page break if required MCRectangle t_dst_rect; if (CalculateLayout(p_src_rect, t_dst_rect)) DoPageBreak(); // Print the card DoPrint(t_current_card, p_src_rect, t_dst_rect); UpdateLayout(t_dst_rect); // Advance card do { t_current_card = t_current_card -> next(); } while(!t_current_card -> countme(0, p_marked)); // Skip marked cards if p_marked is true t_number_cards_left -= 1; } // Reset old state. t_card_owner -> setcard(t_old_card, False, False); MClockmessages = t_old_lock; } }
void CGUIBaseContainer::UpdateLayout(bool updateAllItems) { if (updateAllItems) { // free memory of items for (iItems it = m_items.begin(); it != m_items.end(); ++it) (*it)->FreeMemory(); } // and recalculate the layout CalculateLayout(); SetPageControlRange(); MarkDirtyRegion(); }
void DigitEntry::CreateLongitude(ContainerWindow &parent, const PixelRect &rc, const WindowStyle style, CoordinateFormat format) { switch (format) { case CoordinateFormat::DD_DDDDD: Create(parent, rc, style, 10); columns[0].type = Column::Type::EAST_WEST; columns[1].type = Column::Type::DIGIT19; columns[3].type = Column::Type::DECIMAL_POINT; columns[9].type = Column::Type::DEGREES; break; case CoordinateFormat::DDMM_MMM: Create(parent, rc, style, 11); columns[0].type = Column::Type::EAST_WEST; columns[1].type = Column::Type::DIGIT19; columns[3].type = Column::Type::DEGREES; columns[4].type = Column::Type::DIGIT6; columns[6].type = Column::Type::DECIMAL_POINT; columns[10].type = Column::Type::APOSTROPHE; break; case CoordinateFormat::DDMMSS_S: Create(parent, rc, style, 12); columns[0].type = Column::Type::EAST_WEST; columns[1].type = Column::Type::DIGIT19; columns[3].type = Column::Type::DEGREES; columns[4].type = Column::Type::DIGIT6; columns[6].type = Column::Type::APOSTROPHE; columns[7].type = Column::Type::DIGIT6; columns[9].type = Column::Type::DECIMAL_POINT; columns[11].type = Column::Type::QUOTE; break; case CoordinateFormat::DDMMSS: case CoordinateFormat::UTM: /// \todo support UTM format Create(parent, rc, style, 10); columns[0].type = Column::Type::EAST_WEST; columns[1].type = Column::Type::DIGIT19; columns[3].type = Column::Type::DEGREES; columns[4].type = Column::Type::DIGIT6; columns[6].type = Column::Type::APOSTROPHE; columns[7].type = Column::Type::DIGIT6; columns[9].type = Column::Type::QUOTE; break; } cursor = 0; CalculateLayout(); }
void DigitEntry::CreateAngle(ContainerWindow &parent, const PixelRect &rc, const WindowStyle style) { Create(parent, rc, style, 3); columns[0].type = Column::Type::DIGIT36; columns[2].type = Column::Type::DEGREES; cursor = 0; CalculateLayout(); }
HRESULT Scene::Resize(int x, int y) { HRESULT hr = S_OK; if (m_pRenderTarget) { hr = m_pRenderTarget->Resize(D2D1::SizeU(x, y)); if (SUCCEEDED(hr)) { CalculateLayout(); } } return hr; }
void DigitEntry::CreateTime(ContainerWindow &parent, const PixelRect &rc, const WindowStyle style) { Create(parent, rc, style, 4); columns[0].type = Column::Type::HOUR; columns[1].type = Column::Type::COLON; columns[2].type = Column::Type::DIGIT6; cursor = 0; CalculateLayout(); }
void MainWindow::Resize() { if (pRenderTarget != NULL) { RECT rc; GetClientRect(m_hwnd, &rc); D2D1_SIZE_U size = D2D1::SizeU(rc.right, rc.bottom); pRenderTarget->Resize(size); CalculateLayout(); InvalidateRect(m_hwnd, NULL, FALSE); } }
void wxMultiColumnListCtrl::OnPaint(wxPaintEvent& WXUNUSED(event)) { #if wxSWITCHER_USE_BUFFERED_PAINTING wxBufferedPaintDC dc(this); #else wxPaintDC dc(this); #endif if (m_items.GetColumnCount() == 0) CalculateLayout(dc); if (m_items.GetColumnCount() == 0) return; m_items.PaintItems(dc, this); }
void DigitEntry::CreateLatitude(ContainerWindow &parent, const PixelRect &rc, const WindowStyle style) { // TODO: support all CoordinateFormats Create(parent, rc, style, 9); columns[0].type = Column::Type::NORTH_SOUTH; columns[3].type = Column::Type::DEGREES; columns[4].type = Column::Type::DIGIT6; columns[6].type = Column::Type::APOSTROPHE; columns[7].type = Column::Type::DIGIT6; cursor = 0; CalculateLayout(); }
void DigitEntry::Create(ContainerWindow &parent, const PixelRect &rc, const WindowStyle style, unsigned _length) { assert(_length > 0); assert(_length <= MAX_LENGTH); length = _length; cursor = length - 1; valid = true; for (unsigned i = 0; i < length; ++i) { Column &digit = columns[i]; digit.type = Column::Type::DIGIT; digit.value = 0; } CalculateLayout(); PaintWindow::Create(parent, rc, style); }
void MaskedIcon::LoadResource(ResourceId id, ResourceId big_id, bool center) { if (Layout::ScaleEnabled()) { if (big_id.IsDefined()) bitmap.Load(big_id); else bitmap.LoadStretch(id, Layout::FastScale(1)); } else bitmap.Load(id); #ifdef ENABLE_OPENGL /* postpone CalculateLayout() call, because the OpenGL surface may be absent now */ size.cx = 0; size.cy = center; #else assert(IsDefined()); CalculateLayout(center); #endif }
void MaskedIcon::load_big(unsigned id, unsigned big_id, bool center) { if (Layout::ScaleEnabled()) { if (big_id > 0) bitmap.load(big_id); else bitmap.load_stretch(id, Layout::FastScale(1)); } else bitmap.load(id); #ifdef ENABLE_OPENGL /* postpone CalculateLayout() call, because the OpenGL surface may be absent now */ size.cx = 0; size.cy = center; #else assert(defined()); CalculateLayout(center); #endif }
Binder::Binder(inl::gxapi::IGraphicsApi* gxApi, const std::vector<BindParameterDesc>& parameters, const std::vector<gxapi::StaticSamplerDesc>& staticSamplers) { CalculateLayout(parameters); m_rootSignatureDesc.staticSamplers = staticSamplers; m_rootSignature.reset(gxApi->CreateRootSignature(m_rootSignatureDesc)); }
void wxMultiColumnListCtrl::CalculateLayout() { wxClientDC dc(this); CalculateLayout(dc); }