/// Set up scrollbars, e.g. after a resize void InstanceCtrl::SetupScrollbars() { if (m_freezeCount) return; if (GetCount() == 0) { SetScrollbars(0, 0, 0, 0, 0, 0); return; } int pixelsPerUnit = 10; wxSize clientSize = GetClientSize(); int maxHeight = GetTotalHeight(); int unitsY = maxHeight / pixelsPerUnit; int startX, startY; GetViewStart(& startX, & startY); int maxtop = maxHeight - clientSize.y; if (maxtop % pixelsPerUnit) { maxtop = ((maxtop / pixelsPerUnit) + 1) * pixelsPerUnit; } int maxPositionY = (wxMax(maxtop , 0)) / pixelsPerUnit; // Move to previous scroll position if // possible SetScrollbars(0, pixelsPerUnit, 0, unitsY, 0, wxMin(maxPositionY, startY)); }
void InstanceCtrl::EnsureRectVisible ( wxRect rect ) { int ppuX, ppuY; GetScrollPixelsPerUnit(& ppuX, & ppuY); if (ppuY == 0) return; int startX, startY; GetViewStart(& startX, & startY); startX = 0; startY = startY * ppuY; int sx, sy; GetVirtualSize(& sx, & sy); sx = 0; if (ppuY != 0) sy = sy / ppuY; wxSize clientSize = GetClientSize(); if ((rect.y + rect.height) > (clientSize.y + startY)) { // Make it scroll so this item is at the bottom // of the window int y = rect.y - (clientSize.y - rect.height - m_spacing) ; SetScrollbars(ppuX, ppuY, sx, sy, 0, (int)(0.5 + y / ppuY)); } else if (rect.y < startY) { // Make it scroll so this item is at the top // of the window int y = rect.y ; SetScrollbars(ppuX, ppuY, sx, sy, 0, (int)(0.5 + y / ppuY)); } }
void wxChartPanel::RecalcScrollbars() { if (m_chart == NULL) { SetScrollbars(1, 1, 0, 0, 0, 0, true); return ; } Axis *horizAxis = m_chart->GetHorizScrolledAxis(); Axis *vertAxis = m_chart->GetVertScrolledAxis(); int noUnitsX = 0; int noUnitsY = 0; int xPos = 0; int yPos = 0; if (horizAxis != NULL) { GetAxisScrollParams(horizAxis, noUnitsX, xPos); } if (vertAxis != NULL) { GetAxisScrollParams(vertAxis, noUnitsY, yPos); } SetScrollbars(scrollPixelStep, scrollPixelStep, noUnitsX, noUnitsY, xPos, yPos, true); }
FortyCanvas::FortyCanvas(wxWindow* parent, const wxPoint& pos, const wxSize& size) : wxScrolledWindow(parent, wxID_ANY, pos, size, 0), m_helpingHand(true), m_rightBtnUndo(true), m_playerDialog(0), m_leftBtnDown(false) { SetScrollbars(0, 0, 0, 0); #ifdef __WXGTK__ m_font = wxTheFontList->FindOrCreateFont(12, wxROMAN, wxNORMAL, wxNORMAL); #else m_font = wxTheFontList->FindOrCreateFont(10, wxSWISS, wxNORMAL, wxNORMAL); #endif SetBackgroundColour(FortyApp::BackgroundColour()); m_handCursor = new wxCursor(wxCURSOR_HAND); m_arrowCursor = new wxCursor(wxCURSOR_ARROW); wxString name = wxTheApp->GetAppName(); if (name.Length() <= 0) name = _T("forty"); m_scoreFile = new ScoreFile(name); m_game = new Game(0, 0, 0); m_game->Deal(); }
void SpectDisplay::SetExtent() {//=========================== SetScrollbars(SCROLLUNITS,SCROLLUNITS, (int)(FRAME_WIDTH*zoomx/SCROLLUNITS)+1, (int)(spectseq->numframes*FRAME_HEIGHT*zoomy/SCROLLUNITS)+1); Refresh(); } // end of SpectDisplay::SetExtent
abstract_panel::abstract_panel(wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style) : wxScrolledWindow(parent, id, pos, size, style | wxTAB_TRAVERSAL | wxHSCROLL, title) { // abstract_panel::expertModeEnadbled = false; SetScrollbars(10, 10, 62, 62); Layout(); }
void wxCustomHeightListCtrl::AdjustView() { int posx, posy; GetViewStart(&posx, &posy); #ifdef __WXGTK__ // When decreasing scrollbar range, wxGTK does not seem to adjust child position // if viewport gets moved wxPoint old_view; GetViewStart(&old_view.x, &old_view.y); #endif SetScrollbars(0, m_lineHeight, 0, m_rows.size(), 0, posy); #ifdef __WXGTK__ wxPoint new_view; GetViewStart(&new_view.x, &new_view.y); int delta_y = m_lineHeight *(old_view.y - new_view.y); if (delta_y) { wxWindowList::compatibility_iterator iter = GetChildren().GetFirst(); while (iter) { wxWindow* child = iter->GetData(); wxPoint pos = child->GetPosition(); pos.y -= delta_y; child->SetPosition(pos); iter = iter->GetNext(); } } #endif }
FEditPanel::FEditPanel(wxWindow *parent, wxWindowID id) : wxScrolledWindow(parent, id, wxDefaultPosition, wxDefaultSize, wxScrolledWindowStyle | wxBORDER_SIMPLE) { //SetBackgroundColour(0x00000055); wxBoxSizer* pSizer = new wxBoxSizer(wxVERTICAL); m_pNameRef = new FNameRefControl(this, wxID_ANY, wxT("Reference : ")); pSizer->Add(m_pNameRef, 0, wxLEFT|wxRIGHT|wxTOP, 5); m_pRoleControl = new FRoleControlEdit(this, wxID_ANY, wxString(wxT("Roles : "))); pSizer->Add(m_pRoleControl, 0, wxLEFT|wxRIGHT|wxTOP, 5); //m_pDatationControl = new FDatationControl(this, wxID_ANY, wxString(wxT("Datation : "))); //pSizer->Add(m_pDatationControl, 0, wxLEFT|wxRIGHT|wxTOP, 5); m_pLocationControl = new FLocationListControl(this, wxID_ANY, wxString(wxT("Location : ")), wxDefaultPosition, wxDefaultSize, true); pSizer->Add(m_pLocationControl, 0, wxLEFT|wxRIGHT|wxTOP, 5); m_pTagControl = new FTagControlEdit; m_pTagControl->Create(this, wxID_ANY, wxString(wxT("Tags : "))); pSizer->Add(m_pTagControl, 0, wxLEFT|wxRIGHT|wxTOP, 5); pSizer->AddSpacer(5); SetScrollbars(10, 10, 50, 50); ShowScrollbars(wxSHOW_SB_NEVER, wxSHOW_SB_DEFAULT); SetSizer(pSizer); SetSizeHints(160 + 10 + 16, wxDefaultCoord); Layout(); }
MyCanvas::MyCanvas(wxWindow* parent, bool mirror) : wxScrolledWindow(parent, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxHSCROLL | wxVSCROLL | wxNO_FULL_REPAINT_ON_RESIZE) { m_mirror = mirror; SetScrollbars(20, 20, 5, 5); }
CtrlRegisterList::CtrlRegisterList(wxWindow* parent, DebugInterface* _cpu) : wxScrolledWindow(parent,wxID_ANY,wxDefaultPosition,wxDefaultSize,wxWANTS_CHARS|wxBORDER_NONE|wxVSCROLL), cpu(_cpu) { rowHeight = getDebugFontHeight()+2; charWidth = getDebugFontWidth(); category = 0; maxBits = 128; lastPc = 0xFFFFFFFF; for (int i = 0; i < cpu->getRegisterCategoryCount(); i++) { int count = cpu->getRegisterCount(i); ChangedReg* regs = new ChangedReg[count]; memset(regs,0,sizeof(ChangedReg)*count); changedCategories.push_back(regs); int maxLen = 0; for (int k = 0; k < cpu->getRegisterCount(i); k++) { maxLen = std::max<int>(maxLen,strlen(cpu->getRegisterName(i,k))); } int x = 17+(maxLen+2)*charWidth; startPositions.push_back(x); currentRows.push_back(0); } SetDoubleBuffered(true); SetInitialSize(ClientToWindowSize(GetMinClientSize())); wxSize actualSize = getOptimalSize(); SetVirtualSize(actualSize); SetScrollbars(1, rowHeight, actualSize.x, actualSize.y / rowHeight, 0, 0); }
OptionPage::OptionPage(wxTreebook *book, Preferences *parent, wxString name, int style) : wxScrolled<wxPanel>(book, -1, wxDefaultPosition, wxDefaultSize, wxVSCROLL) , sizer(new wxBoxSizer(wxVERTICAL)) , parent(parent) { if (style & PAGE_SUB) book->AddSubPage(this, name, true); else book->AddPage(this, name, true); if (style & PAGE_SCROLL) SetScrollbars(0, 20, 0, 50); else SetScrollbars(0, 0, 0, 0); DisableKeyboardScrolling(); }
void wxBitmapViewerWindow::SetBitmap(const wxBitmap& bitmap) { m_bitmap = bitmap; if (m_bitmap.Ok()) { SetScrollbars(1, 1, m_bitmap.GetWidth(), m_bitmap.GetHeight()); } }
void wxCustomHeightListCtrl::SetLineHeight(int height) { m_lineHeight = height; int posx, posy; GetViewStart(&posx, &posy); SetScrollbars(0, m_lineHeight, 0, m_rows.size(), 0, posy); Refresh(); }
void LayersPanel::InitLayout() { SetScrollbars(0, 1, 0, 10, 0, 0); wxBoxSizer* sizer = new wxBoxSizer(wxVERTICAL); sizer->Add(m_layersProperty = new LayersPropertyWidget(this), 1, wxEXPAND); sizer->Add(m_contentPanel = new LayersContentWidget(this), 99, wxEXPAND); SetSizer(sizer); }
void RenderCanvas::SetImage(wxImage& image) { if (m_image != NULL) delete m_image; m_image = new wxBitmap(image); SetScrollbars(10, 10, (int)(m_image->GetWidth() / 10.0f), (int)(m_image->GetHeight() / 10.0f), 0, 0, true); Refresh(); }
wxsToolSpace::wxsToolSpace(wxWindow* Parent,wxsItemResData* Data): wxScrolledWindow(Parent), m_First(0), m_Count(0), m_Data(Data), m_Unstable(false) { SetScrollbars(5,0,1,1); SetClientSize(wxSize(2*ExtraBorderSize+IconSize,2*ExtraBorderSize+IconSize)); SetVirtualSize(1,1); }
nkToolBar::nkToolBar(wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style, const wxString& name): wxScrolledWindow(parent, id, pos, size, style, name) { SetScrollRate(10,10 ); SetScrollbars(10,10,100,100); SetBackgroundColour(wxColour(255,255,255)); }
void wxListBox::UpdateScrollbars() { wxSize size = GetClientSize(); // is our height enough to show all items? int nLines = GetCount(); wxCoord lineHeight = GetLineHeight(); bool showScrollbarY = nLines*lineHeight > size.y; // check the width too if required wxCoord charWidth, maxWidth; bool showScrollbarX; if ( HasHorzScrollbar() ) { charWidth = GetCharWidth(); maxWidth = GetMaxWidth(); showScrollbarX = maxWidth > size.x; } else // never show it { charWidth = maxWidth = 0; showScrollbarX = false; } // what should be the scrollbar range now? int scrollRangeX = showScrollbarX ? (maxWidth + charWidth - 1) / charWidth + 2 // FIXME : 0; int scrollRangeY = showScrollbarY ? nLines + (size.y % lineHeight + lineHeight - 1) / lineHeight : 0; // reset scrollbars if something changed: either the visibility status // or the range of a scrollbar which is shown if ( (showScrollbarY != m_showScrollbarY) || (showScrollbarX != m_showScrollbarX) || (showScrollbarY && (scrollRangeY != m_scrollRangeY)) || (showScrollbarX && (scrollRangeX != m_scrollRangeX)) ) { int x, y; GetViewStart(&x, &y); SetScrollbars(charWidth, lineHeight, scrollRangeX, scrollRangeY, x, y); m_showScrollbarX = showScrollbarX; m_showScrollbarY = showScrollbarY; m_scrollRangeX = scrollRangeX; m_scrollRangeY = scrollRangeY; } }
void CalcSize() { unsigned int rowCount = m_view->m_dataSize / m_view->m_rowsize; wxSize fntSize = m_view->GetFont().GetPixelSize(); m_rowHeight = fntSize.GetHeight() + 2; m_charWidth = fntSize.GetWidth(); SetScrollRate(m_charWidth * 4, m_rowHeight * 20); SetScrollbars(m_charWidth, m_rowHeight, m_view->m_rowsize * 3, rowCount + 2); Refresh(); }
// Define a constructor for my canvas MyCanvas::MyCanvas(wxWindow *parent, const wxPoint& pos, const wxSize& size) : wxScrolledWindow(parent, wxID_ANY, pos, size, wxSUNKEN_BORDER | wxNO_FULL_REPAINT_ON_RESIZE | wxVSCROLL | wxHSCROLL) { SetBackgroundColour(wxColour("WHITE")); SetCursor(wxCursor(wxCURSOR_PENCIL)); SetScrollbars(20, 20, 50, 50); m_dirty = false; }
ToolbarPanel::ToolbarPanel(wxWindow* parent, ee::LibraryPanel* library, StagePanel* stage) : ee::ToolbarPanel(parent, stage->GetStageImpl()) , m_stage(stage) , m_image(NULL) { SetScrollbars(1,1, 200, 100, 0, 0); SetSizer(InitLayout()); InitParticle(); SetDropTarget(new DropTarget(library, stage, this)); RegistSubject(ee::ClearPanelSJ::Instance()); }
void PDFPanel::ChangePage(int num) { wxBusyCursor wait; selectedItems.clear(); SetFocus(); doc32->setCurPage(num); doc32->LoadPage(doc32->getCurPage()); bitmap = doc32->renderPDF(); w = bitmap->GetWidth(); h = bitmap->GetHeight(); scale = (float)doc32->getPDFHeight()/h; SetScrollbars(1,1,w,h,0,0); SetScrollRate(10,10); Refresh(); }
void wxCustomHeightListCtrl::SetLineCount(int count) { if (count < m_lineCount) { std::set<int> selectedLines = m_selectedLines; m_selectedLines.clear(); for (std::set<int>::const_iterator iter = selectedLines.begin(); iter != selectedLines.end(); iter++) if (*iter < count) m_selectedLines.insert(*iter); } m_lineCount = count; if (m_focusedLine >= count) m_focusedLine = -1; int posx, posy; GetViewStart(&posx, &posy); #ifdef __WXGTK__ // When decreasing scrollbar range, wxGTK does not seem to adjust child position // if viewport gets moved wxPoint old_view; GetViewStart(&old_view.x, &old_view.y); #endif SetScrollbars(0, m_lineHeight, 0, m_lineCount, 0, posy); #ifdef __WXGTK__ wxPoint new_view; GetViewStart(&new_view.x, &new_view.y); int delta_y = m_lineHeight *(old_view.y - new_view.y); if (delta_y) { wxWindowList::compatibility_iterator iter = GetChildren().GetFirst(); while (iter) { wxWindow* child = iter->GetData(); wxPoint pos = child->GetPosition(); pos.y -= delta_y; child->SetPosition(pos); iter = iter->GetNext(); } } #endif Refresh(); }
PDFPanel::PDFPanel(wxWindow * parent):wxScrolledWindow(parent) { //bitmap = new wxBitmap("C:\\crate.bmp"); doc32 = new Document("C:\\wX.pdf"); bitmap = doc32->renderPDF(); w = bitmap->GetWidth(); h = bitmap->GetHeight(); scale = (float)doc32->getPDFHeight()/h; SetScrollbars(1,1,w,h,0,0); SetScrollRate(10,10); SetDropTarget(new temp(this)); selectedItems.reserve(51); // wxMessageBox(wxString::Format("%i-%i",s.GetHeight(),s.GetWidth())); pen = wxPen(*wxBLUE,2,wxSOLID ); grid = Grid(40,w,h,15); }
void PDFPanel::Zoom(int zm) { SetFocus(); float oldScale = scale; doc32->setCurZoom(zm); bitmap = doc32->renderPDF(); w = bitmap->GetWidth(); h = bitmap->GetHeight(); grid.SetWidth((float)w); grid.SetHeight((float)h); //Updating the Scale Based on new dimensions scale = (float)doc32->getPDFHeight()/h; UpdateVisualSelection(oldScale); SetScrollbars(1,1,w,h,0,0); SetScrollRate(10,10); Refresh(); }
wxsDrawingWindow::wxsDrawingWindow(wxWindow* Parent,wxWindowID id,const wxPoint& pos,const wxSize& size,long style,const wxString& name): wxScrolledWindow(Parent,id,pos,size,style,name), m_Bitmap(0), m_IsBlockFetch(false), m_DuringFetch(false), m_DuringChangeCnt(0), m_LastSizeX(0), m_LastSizeY(0), m_LastVirtX(0), m_LastVirtY(0), m_WasContentChanged(false), m_IsDestroyed(false), m_RefreshTimer(this,RefreshTimerId) { // Strange - it seems that by declaring this event in event table, it's not processed Connect(-1,wxEVT_FETCH_SEQUENCE,(wxObjectEventFunction)&wxsDrawingWindow::OnFetchSequence); Connect(RefreshTimerId,wxEVT_TIMER,(wxObjectEventFunction)&wxsDrawingWindow::OnRefreshTimer); SetScrollbars(5,5,1,1,0,0,true); }
void ProsodyDisplay::LayoutData(PHONEME_LIST *ph_list, int n_ph) {//=========================================================== // divide the phoneme list into lines for display int xpos; int w; int ix; int height; PHONEME_LIST *p; if(ph_list != NULL) { numph = n_ph; phlist = ph_list; } num_lines = 0; linetab[0] = 1; GetClientSize(&linewidth, &height); xpos = linewidth; // could improve this to do 'wordwrap' - only split on word boundary // or unvoiced phonemes for(ix=1; ix<numph-2; ix++) { p = &phlist[ix]; w = GetWidth(p); if(w + xpos >= linewidth) { linetab[num_lines++] = ix; xpos = 0; } xpos += w; } linetab[num_lines]=numph-2; SetScrollbars(SCROLLUNITS,SCROLLUNITS,linewidth/SCROLLUNITS, (num_lines*FRAMEHEIGHT)/SCROLLUNITS+1); Refresh(); } // end of ProsodyDisplay::LayoutData
BrushIconBox::BrushIconBox(wxWindow *parent, const TilesetCategory *_tileset, RenderSize rsz) : wxScrolledWindow(parent, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxVSCROLL), BrushBoxInterface(_tileset), icon_size(rsz) { ASSERT(tileset->getType() >= TILESET_UNKNOWN && tileset->getType() <= TILESET_HOUSE); int width; if(icon_size == RENDER_SIZE_32x32) { width = max(g_settings.getInteger(Config::PALETTE_COL_COUNT) / 2 + 1, 1); } else { width = max(g_settings.getInteger(Config::PALETTE_COL_COUNT) + 1, 1); } // Create buttons wxSizer* stacksizer = newd wxBoxSizer(wxVERTICAL); wxSizer* rowsizer = nullptr; int item_counter = 0; for(BrushVector::const_iterator iter = tileset->brushlist.begin(); iter != tileset->brushlist.end(); ++iter) { ASSERT(*iter); ++item_counter; if(!rowsizer) { rowsizer = newd wxBoxSizer(wxHORIZONTAL); } BrushButton* bb = newd BrushButton(this, *iter, rsz); rowsizer->Add(bb); brush_buttons.push_back(bb); if(item_counter % width == 0) { // newd row stacksizer->Add(rowsizer); rowsizer = nullptr; } } if(rowsizer) { stacksizer->Add(rowsizer); } SetScrollbars(20,20, 8, item_counter/width, 0, 0); SetSizer(stacksizer); }
void CGraphView::SetZoom(double zoom) { double oldzoom=m_diag.GetZoomFactor(); m_diag.SetZoomFactor(zoom); int vsx,vsy; GetViewStart(&vsx,&vsy); double minx,miny,maxx,maxy; m_diag.GetDiagramExtents(minx,miny,maxx,maxy); int gw=(int)((maxx-minx)*zoom); int gh=(int)((maxy-miny)*zoom); int sx=(int)(((double)vsx)*(zoom/oldzoom)); int sy=(int)(((double)vsy)*(zoom/oldzoom)); SetScrollbars(1,1,gw,gh,sx,sy,true); wxSizeEvent wxse(GetClientSize()); OnSize(wxse); }
void BattleroomMMOptionsTab<BattleType>::OnReloadControls(OptionsWrapper::GameOption flag) { if ( !m_battle ) return; wxString pref = wxFormat( _T("%d%s") ) % flag % wxsep; //purgin existing keys from map RemovePrefixed(m_chkbox_map,pref); RemovePrefixed(m_spinctrl_map,pref); RemovePrefixed(m_textctrl_map,pref); RemovePrefixed(m_combox_map,pref); RemovePrefixed(m_statictext_map,pref); RemovePrefixed(m_button_map,pref); //reloading the controls switch (flag) { case OptionsWrapper::ModOption: m_mod_options_sizer->Remove(m_mod_layout); m_mod_layout = new wxBoxSizer( wxVERTICAL); setupOptionsSizer(m_mod_layout,OptionsWrapper::ModOption); //m_mod_options_sizer->Add( m_mod_options_sizer, 1, wxEXPAND, 5 ); m_mod_options_sizer->Add( m_mod_layout, 1, wxALL|wxEXPAND, 5 ); break; case OptionsWrapper::MapOption: m_map_options_sizer->Remove(m_map_layout); m_map_layout = new wxBoxSizer( wxVERTICAL); setupOptionsSizer(m_map_layout,OptionsWrapper::MapOption); m_map_options_sizer->Add( m_map_layout, 1, wxALL|wxEXPAND, 5 ); break; default: break; } //this->SetSizer( m_main_sizer, true ); m_main_sizer->FitInside(this); this->Layout(); SetScrollbars( 10, 10, 62, 62 ); }