这篇教程C++ GetClientSize函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中GetClientSize函数的典型用法代码示例。如果您正苦于以下问题:C++ GetClientSize函数的具体用法?C++ GetClientSize怎么用?C++ GetClientSize使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了GetClientSize函数的22个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: wxFrameAudacityProject::AudacityProject(wxWindow * parent, wxWindowID id, const wxPoint & pos, const wxSize & size): wxFrame(parent, id, "Audacity", pos, size), mRate((double) gPrefs->Read("/SamplingRate/DefaultProjectSampleRate", 44100)), mDirty(false), mAPalette(NULL), mDrag(NULL), mTrackPanel(NULL), mHistoryWindow(NULL), mAutoScrolling(false){ // // Create track list // mTracks = new TrackList(); mLastSavedTracks = NULL; // // Initialize view info (shared with TrackPanel) // // Selection mViewInfo.sel0 = 0.0; mViewInfo.sel1 = 0.0; // Horizontal scrollbar mViewInfo.total = 1.0; mViewInfo.screen = 1.0; mViewInfo.h = 0.0; mViewInfo.zoom = 44100.0 / 512.0; mViewInfo.lastZoom = mViewInfo.zoom; // Vertical scrollbar mViewInfo.vpos = 0; mViewInfo.scrollStep = 16; mViewInfo.sbarH = 0; mViewInfo.sbarScreen = 1; mViewInfo.sbarTotal = 1; mMenuBar = NULL; CreateMenuBar(); int left = 0, top = 0, width, height; GetClientSize(&width, &height); // // Create the Palette (if we're not using a windowed palette) // if (!gWindowedPalette) { int h = GetAPaletteHeight(); int ptop = 0;#ifdef __WXMSW__ ptop++;#endif mAPalette = new APalette(this, 0, wxPoint(10, ptop), wxSize(width - 10, h)); top += h + 1 + ptop; height -= h + 1 + ptop; } // // Create the status bar // int sh = GetStatusHeight(); mStatus = new AStatus(this, 0, wxPoint(0, height - sh), wxSize(width, sh), mRate, this); height -= sh; mStatus->SetField("Welcome to Audacity version " AUDACITY_VERSION_STRING, 0); // // Create the TrackPanel and the scrollbars // mTrackPanel = new TrackPanel(this, TrackPanelID, wxPoint(left, top), wxSize(width - sbarSpaceWidth, height - sbarSpaceWidth), mTracks, &mViewInfo, this); int hoffset = mTrackPanel->GetLeftOffset() - 1; int voffset = mTrackPanel->GetRulerHeight();//.........这里部分代码省略.........
开发者ID:andreipaga,项目名称:audacity,代码行数:101,
示例2: ptvoid GLAnimationCanvas::OnMouse(wxMouseEvent& event){ if (m_iType == TYPE_CURVE) { wxPoint wxpt = event.GetPosition(); Spline::Point pt(wxpt.x, wxpt.y); if (event.ButtonDown(wxMOUSE_BTN_LEFT)) { size_t index; if(m_spline->findKont(pt, index)) { m_selectedIndex = index; } else { m_selectedIndex = -1; } } else if(event.ButtonDown(wxMOUSE_BTN_RIGHT)) { size_t index; if(m_spline->findKont(pt, index)) { m_spline->removeKnot(index); m_selectedIndex = -1; } else { m_selectedIndex = m_spline->addKnots(pt); } } else if (event.Dragging()) { if(m_selectedIndex >= 0) { m_spline->setKnot(m_selectedIndex, pt); } } } else if (m_iType == TYPE_ANIMATION) { if(event.ButtonDown(wxMOUSE_BTN_RIGHT)) { ShowCursor(false); SetFocus(); if (!HasCapture()) { CaptureMouse(); } m_bRightDown = true; } else if(event.ButtonUp(wxMOUSE_BTN_RIGHT)) { ShowCursor(true); if (HasCapture()) { ReleaseMouse(); } ResetKeyStates(); m_bRightDown = false; } else if(event.ButtonDown(wxMOUSE_BTN_LEFT)) { ShowCursor(false); SetFocus(); if (!HasCapture()) { CaptureMouse(); } m_bLeftDown = true; } else if(event.ButtonUp(wxMOUSE_BTN_LEFT)) { ShowCursor(true); if (!HasCapture()) { CaptureMouse(); } ResetKeyStates(); m_bLeftDown = false; } else if(event.Dragging()) { wxPoint curPos = event.GetPosition(); wxPoint pnt = ClientToScreen(curPos); SetCursorPos(pnt.x, pnt.y); CRenderManager* pRenderMgr = CRenderManager::GetInstance(); if (m_bRightDown) { int nDeltaX = curPos.x - m_lastPosition.x; int nDeltaY = curPos.y - m_lastPosition.y; wxSize clientSize = GetClientSize(); pRenderMgr->GetCamera()->Yaw((float)nDeltaX / clientSize.x); pRenderMgr->GetCamera()->Pitch((float)nDeltaY / clientSize.y); } } else if(event.GetWheelAxis() == wxMOUSE_WHEEL_VERTICAL) { kmVec3 vec3Speed; kmVec3Fill(&vec3Speed, SHIFTWHEELSPEED, SHIFTWHEELSPEED, SHIFTWHEELSPEED);//.........这里部分代码省略.........
开发者ID:BeyondEngine,项目名称:BeyondEngine,代码行数:101,
示例3: GetGlobalColorvoid DashboardInstrument_Dial::DrawData(wxGCDC* dc, double value, wxString unit, wxString format, DialPositionOption position){ if (position == DIAL_POSITION_NONE) return; dc->SetFont(*g_pFontLabel); wxColour cl; GetGlobalColor(_T("DASHF"), &cl); dc->SetTextForeground(cl); wxSize size = GetClientSize(); wxString text; if(!wxIsNaN(value)) { if (unit == _T("/u00B0")) text = wxString::Format(format, value)+DEGREE_SIGN; else if (unit == _T("/u00B0L")) // No special display for now, might be XX°< (as in text-only instrument) text = wxString::Format(format, value)+DEGREE_SIGN; else if (unit == _T("/u00B0R")) // No special display for now, might be >XX° text = wxString::Format(format, value)+DEGREE_SIGN; else if (unit == _T("/u00B0T")) text = wxString::Format(format, value)+DEGREE_SIGN+_T("T"); else if (unit == _T("/u00B0M")) text = wxString::Format(format, value)+DEGREE_SIGN+_T("M"); else if (unit == _T("N")) // Knots text = wxString::Format(format, value)+_T(" Kts"); else text = wxString::Format(format, value)+_T(" ")+unit; } else text = _T("---"); int width, height; dc->GetMultiLineTextExtent(text, &width, &height, NULL, g_pFontLabel); wxRect TextPoint; TextPoint.width = width; TextPoint.height = height; switch (position) { case DIAL_POSITION_NONE: // This case was already handled before, it's here just // to avoid compiler warning. return; case DIAL_POSITION_INSIDE: { TextPoint.x = m_cx - (width / 2) - 1; TextPoint.y = (size.y * .75) - height; GetGlobalColor(_T("DASHL"), &cl); int penwidth = size.x / 100; wxPen* pen = wxThePenList->FindOrCreatePen( cl, penwidth, wxPENSTYLE_SOLID ); dc->SetPen( *pen ); GetGlobalColor(_T("DASHB"), &cl); dc->SetBrush(cl); // There might be a background drawn below // so we must clear it first. dc->DrawRoundedRectangle(TextPoint.x-2, TextPoint.y-2, width+4, height+4, 3); break; } case DIAL_POSITION_TOPLEFT: TextPoint.x = 0; TextPoint.y = m_TitleHeight; break; case DIAL_POSITION_TOPRIGHT: TextPoint.x = size.x-width-1; TextPoint.y = m_TitleHeight; break; case DIAL_POSITION_BOTTOMLEFT: TextPoint.x = 0; TextPoint.y = size.y-height; break; case DIAL_POSITION_BOTTOMRIGHT: TextPoint.x = size.x-width-1; TextPoint.y = size.x-height; break; } wxColour c2; GetGlobalColor( _T("DASHB"), &c2 ); wxColour c3; GetGlobalColor( _T("DASHF"), &c3 ); wxStringTokenizer tkz( text, _T("/n") ); wxString token; token = tkz.GetNextToken(); while(token.Length()) { dc->GetTextExtent(token, &width, &height, NULL, NULL, g_pFontLabel);#ifdef __WXMSW__ if( g_pFontLabel->GetPointSize() <= 12 ) { wxBitmap tbm( width, height, -1 ); wxMemoryDC tdc( tbm ); tdc.SetBackground( c2 ); tdc.Clear(); tdc.SetFont(*g_pFontLabel ); tdc.SetTextForeground( c3 );//.........这里部分代码省略.........
开发者ID:Nick-Currawong,项目名称:OpenCPN,代码行数:101,
示例4: ConvertSashPosition// Position and size subwindows.// Note that the border size applies to each subwindow, not// including the edges next to the sash.void wxSplitterWindow::SizeWindows(){ // check if we have delayed setting the real sash position if ( m_requestedSashPosition != INT_MAX ) { int newSashPosition = ConvertSashPosition(m_requestedSashPosition); if ( newSashPosition != m_sashPosition ) { DoSetSashPosition(newSashPosition); } if ( newSashPosition <= m_sashPosition && newSashPosition >= m_sashPosition - GetBorderSize() ) { // don't update it any more m_requestedSashPosition = INT_MAX; } } int w, h; GetClientSize(&w, &h); if ( GetWindow1() && !GetWindow2() ) { GetWindow1()->SetSize(GetBorderSize(), GetBorderSize(), w - 2*GetBorderSize(), h - 2*GetBorderSize()); } else if ( GetWindow1() && GetWindow2() ) { const int border = GetBorderSize(), sash = GetSashSize(); int size1 = GetSashPosition() - border, size2 = GetSashPosition() + sash; int x2, y2, w1, h1, w2, h2; if ( GetSplitMode() == wxSPLIT_VERTICAL ) { w1 = size1; w2 = w - 2*border - sash - w1; if (w2 < 0) w2 = 0; h2 = h - 2*border; if (h2 < 0) h2 = 0; h1 = h2; x2 = size2; y2 = border; } else // horz splitter { w2 = w - 2*border; if (w2 < 0) w2 = 0; w1 = w2; h1 = size1; h2 = h - 2*border - sash - h1; if (h2 < 0) h2 = 0; x2 = border; y2 = size2; } GetWindow2()->SetSize(x2, y2, w2, h2); GetWindow1()->SetSize(border, border, w1, h1); } wxClientDC dc(this); DrawSash(dc);}
开发者ID:Asmodean-,项目名称:Ishiiruka,代码行数:73,
示例5: GetClientSize// Position and size subwindows.// Note that the border size applies to each subwindow, not// including the edges next to the sash.void wxSashWindow::SizeWindows(){ int cw, ch; GetClientSize(&cw, &ch); if (GetChildren().GetCount() == 1) { wxWindow* child = GetChildren().GetFirst()->GetData(); int x = 0; int y = 0; int width = cw; int height = ch; // Top if (m_sashes[0].m_show) { y = m_borderSize; height -= m_borderSize; } y += m_extraBorderSize; // Left if (m_sashes[3].m_show) { x = m_borderSize; width -= m_borderSize; } x += m_extraBorderSize; // Right if (m_sashes[1].m_show) { width -= m_borderSize; } width -= 2*m_extraBorderSize; // Bottom if (m_sashes[2].m_show) { height -= m_borderSize; } height -= 2*m_extraBorderSize; child->SetSize(x, y, width, height); } else if (GetChildren().GetCount() > 1) { // Perhaps multiple children are themselves sash windows. // TODO: this doesn't really work because the subwindows sizes/positions // must be set to leave a gap for the parent's sash (hit-test and decorations). // Perhaps we can allow for this within LayoutWindow, testing whether the parent // is a sash window, and if so, allowing some space for the edges. wxLayoutAlgorithm layout; layout.LayoutWindow(this); } wxClientDC dc(this); DrawBorders(dc); DrawSashes(dc);}
开发者ID:ACanadianKernel,项目名称:pcsx2,代码行数:64,
示例6: old_dcvoid LineChart::OnPaint(wxPaintEvent &event){ wxPaintDC old_dc(this); float zoomFactor = (float)_zoomPercentage / 100; int w,h ; GetClientSize(&w,&h); if (w != _currentWidth || h != _currentHeight){ delete (_memBitmap); _currentWidth = w; _currentHeight = h; _memBitmap = new wxBitmap(_currentWidth, _currentHeight); } ///////////////// // Create a memory DC wxMemoryDC dc; dc.SelectObject(*_memBitmap); wxColor backColor = GetBackgroundColour(); dc.SetBackground(*wxTheBrushList->FindOrCreateBrush(backColor,wxSOLID)); dc.SetBrush(*wxTheBrushList->FindOrCreateBrush(backColor,wxSOLID)); dc.Clear(); DrawGrid(dc); if (m_showScale){ m_leftEdge = DrawScale(dc); } else{ m_leftEdge = 0; } size_t largestBufferSize = GetMaxSeriesBufferSize(); double lastValue = 0; for (SeriesMap::iterator it = m_seriesMap.begin(); it != m_seriesMap.end(); ++it){ float currentX = (float)m_leftEdge; int lastX = (int)currentX; int lastY; Series *series = it->second; dc.SetPen(*wxThePenList->FindOrCreatePen(series->GetColor(), 1, wxSOLID)); size_t bufSize = series->GetBufferSize(); Range *range = m_rangeArray[series->GetRangeId()]; if (bufSize > 0){ double minValue = range->GetMin(); double maxValue = range->GetMax(); double loggedValue = series->GetValueAt(0); double percentageOfMax = (loggedValue - minValue) / (maxValue - minValue); lastY = h - (int)(((double)h) * percentageOfMax); size_t i = (size_t)(((double)largestBufferSize) * m_viewOffsetFactor); while (i < bufSize && currentX < _currentWidth ){ if (i == m_markerIndex){ wxPen pen = dc.GetPen(); dc.SetPen(*wxThePenList->FindOrCreatePen(*wxLIGHT_GREY, 1, wxSOLID)); dc.DrawLine(currentX, 0, currentX, _currentHeight); DrawCurrentValues(dc, i, currentX, CURRENT_VALUES_TOP_OFFSET); dc.SetPen(pen); } loggedValue = series->GetValueAt(i); if (DatalogValue::NULL_VALUE == loggedValue){ loggedValue = lastValue; } else{ lastValue = loggedValue; } double percentageOfMax = (loggedValue - minValue) / (maxValue - minValue); int y = h - (int)(((double)h) * percentageOfMax); dc.DrawLine(lastX, lastY, (int)currentX, y); lastX = (int)currentX; lastY = y; currentX += zoomFactor; i++; } } } if (m_showData) DrawMouseoverMarker(dc); //blit into the real DC old_dc.Blit(0,0,_currentWidth,_currentHeight,&dc,0,0);}
开发者ID:BMWPower,项目名称:RaceAnalyzer,代码行数:92,
示例7: GetConfigBase//.........这里部分代码省略......... GetOptions().SetNotebookPopupMenu(steMM->CreateNotebookPopupMenu(), false); } if (!m_sideSplitter && GetOptions().HasFrameOption(STF_CREATE_SIDEBAR)) { m_sideSplitter = new wxSplitterWindow(this, ID_STF_SIDE_SPLITTER); m_sideSplitter->SetMinimumPaneSize(10); m_sideNotebook = new wxNotebook(m_sideSplitter, ID_STF_SIDE_NOTEBOOK); m_steTreeCtrl = new wxSTEditorTreeCtrl(m_sideNotebook, ID_STF_FILE_TREECTRL); m_dirCtrl = new wxGenericDirCtrl(m_sideNotebook, ID_STF_FILE_DIRCTRL, wxFileName::GetCwd(), wxDefaultPosition, wxDefaultSize, wxDIRCTRL_3D_INTERNAL#if wxCHECK_VERSION(2, 9, 2) |(GetOptions().HasFrameOption(STF_CREATE_NOTEBOOK) ? wxDIRCTRL_MULTIPLE : 0)#endif // wxCHECK_VERSION(2, 9, 2) ); m_sideNotebook->AddPage(m_steTreeCtrl, _("Files")); m_sideNotebook->AddPage(m_dirCtrl, _("Open")); m_sideSplitterWin1 = m_sideNotebook; } if (!m_steNotebook && GetOptions().HasFrameOption(STF_CREATE_NOTEBOOK)) { m_mainSplitter = new wxSplitterWindow(m_sideSplitter ? (wxWindow*)m_sideSplitter : (wxWindow*)this, ID_STF_MAIN_SPLITTER); m_mainSplitter->SetMinimumPaneSize(1); m_steNotebook = new wxSTEditorNotebook(m_mainSplitter, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxCLIP_CHILDREN); m_steNotebook->CreateOptions(m_options); (void)m_steNotebook->InsertEditorSplitter(-1, wxID_ANY, GetOptions().GetDefaultFileName(), true); // update after adding a single page m_steNotebook->UpdateAllItems(); m_mainSplitter->Initialize(m_steNotebook); m_mainSplitterWin1 = m_steNotebook; m_sideSplitterWin2 = m_mainSplitter; if (m_steTreeCtrl) m_steTreeCtrl->SetSTENotebook(m_steNotebook); } else if (!m_steSplitter && GetOptions().HasFrameOption(STF_CREATE_SINGLEPAGE)) { m_mainSplitter = new wxSplitterWindow(m_sideSplitter ? (wxWindow*)m_sideSplitter : (wxWindow*)this, ID_STF_MAIN_SPLITTER); m_mainSplitter->SetMinimumPaneSize(1); m_steSplitter = new wxSTEditorSplitter(m_mainSplitter, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0); m_steSplitter->CreateOptions(m_options); m_mainSplitter->Initialize(m_steSplitter); m_mainSplitterWin1 = m_steSplitter; } //else user will set up the rest if (m_mainSplitter && m_mainSplitterWin1 && !m_resultsNotebook && GetOptions().HasFrameOption(STF_CREATE_RESULT_NOTEBOOK)) { m_resultsNotebook = new wxNotebook(m_mainSplitter, wxID_ANY); m_findResultsEditor = new wxSTEditorFindResultsEditor(m_resultsNotebook, wxID_ANY); m_findResultsEditor->CreateOptionsFromEditorOptions(options); m_resultsNotebook->AddPage(m_findResultsEditor, _("Search Results")); wxSTEditorFindReplacePanel::SetFindResultsEditor(m_findResultsEditor); m_mainSplitter->SplitHorizontally(m_mainSplitterWin1, m_resultsNotebook, GetClientSize().GetHeight()*2/3); m_mainSplitterWin2 = m_resultsNotebook; } if (GetOptions().HasFrameOption(STF_CREATE_SIDEBAR) && GetSideSplitter() && m_sideSplitterWin1 && m_sideSplitterWin2) { GetSideSplitter()->SplitVertically(m_sideSplitterWin1, m_sideSplitterWin2, m_sideSplitter_pos); }#if wxUSE_DRAG_AND_DROP if (GetOptions().HasFrameOption(STF_DO_DRAG_AND_DROP)) { SetDropTarget(new wxSTEditorFileDropTarget(this)); }#endif //wxUSE_DRAG_AND_DROP if (GetOptions().HasConfigOption(STE_CONFIG_FINDREPLACE) && config) { if (GetOptions().GetFindReplaceData() && !GetOptions().GetFindReplaceData()->HasLoadedConfig()) GetOptions().GetFindReplaceData()->LoadConfig(*config); } if (config) LoadConfig(*config); // The config may change the frame size so relayout the splitters if (m_mainSplitter && m_mainSplitter->IsSplit()) //m_mainSplitterWin1 && m_resultsNotebook) m_mainSplitter->SetSashPosition(GetClientSize().GetHeight()*2/3); UpdateAllItems(); // if we've got an editor let it update gui wxSTEditor *editor = GetEditor(); if (editor) editor->UpdateAllItems();}
开发者ID:burzumishi,项目名称:caprice32wx,代码行数:101,
示例8: HK_PROMPT_DIALOG HK_PROMPT_DIALOG( wxWindow* aParent, wxWindowID aId, const wxString& aTitle, const wxString& aName, const wxString& aCurrentKey ) : DIALOG_SHIM( aParent, aId, aTitle, wxDefaultPosition, wxDefaultSize ) { wxPanel* panel = new wxPanel( this, wxID_ANY, wxDefaultPosition, wxDefaultSize ); wxBoxSizer* sizer = new wxBoxSizer( wxVERTICAL ); /* Dialog layout: * * inst_label........................ * ---------------------------------- * * cmd_label_0 cmd_label_1 / * | fgsizer * key_label_0 key_label_1 / */ wxStaticText* inst_label = new wxStaticText( panel, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxALIGN_CENTRE_HORIZONTAL ); inst_label->SetLabelText( _( "Press a new hotkey, or press Esc to cancel..." ) ); sizer->Add( inst_label, 0, wxALL, 5 ); sizer->Add( new wxStaticLine( panel ), 0, wxALL | wxEXPAND, 2 ); wxFlexGridSizer* fgsizer = new wxFlexGridSizer( 2 ); wxStaticText* cmd_label_0 = new wxStaticText( panel, wxID_ANY, _( "Command:" ) ); fgsizer->Add( cmd_label_0, 0, wxALL | wxALIGN_CENTRE_VERTICAL, 5 ); wxStaticText* cmd_label_1 = new wxStaticText( panel, wxID_ANY, wxEmptyString ); cmd_label_1->SetFont( cmd_label_1->GetFont().Bold() ); cmd_label_1->SetLabel( aName ); fgsizer->Add( cmd_label_1, 0, wxALL | wxALIGN_CENTRE_VERTICAL, 5 ); wxStaticText* key_label_0 = new wxStaticText( panel, wxID_ANY, _( "Current key:" ) ); fgsizer->Add( key_label_0, 0, wxALL | wxALIGN_CENTRE_VERTICAL, 5 ); wxStaticText* key_label_1 = new wxStaticText( panel, wxID_ANY, wxEmptyString ); key_label_1->SetFont( key_label_1->GetFont().Bold() ); key_label_1->SetLabel( aCurrentKey ); fgsizer->Add( key_label_1, 0, wxALL | wxALIGN_CENTRE_VERTICAL, 5 ); sizer->Add( fgsizer, 1, wxEXPAND ); // Wrap the sizer in a second to give a larger border around the whole dialog wxBoxSizer* outer_sizer = new wxBoxSizer( wxVERTICAL ); outer_sizer->Add( sizer, 0, wxALL | wxEXPAND, 10 ); panel->SetSizer( outer_sizer ); Layout(); outer_sizer->Fit( this ); Center(); SetMinClientSize( GetClientSize() ); // Binding both EVT_CHAR and EVT_CHAR_HOOK ensures that all key events, // including specials like Tab and Return, are received, particularly // on MSW. panel->Bind( wxEVT_CHAR, &HK_PROMPT_DIALOG::OnChar, this ); panel->Bind( wxEVT_CHAR_HOOK, &HK_PROMPT_DIALOG::OnCharHook, this ); }
开发者ID:Lotharyx,项目名称:kicad-source-mirror,代码行数:62,
示例9: GetClientAreaOriginvoid wxWindow::Refresh(bool eraseBackground, const wxRect *rect){ wxRect rectClient; // the same rectangle in client coordinates wxPoint origin = GetClientAreaOrigin(); wxSize size = GetClientSize(); if ( rect ) { // the rectangle passed as argument is in client coordinates rectClient = *rect; // don't refresh anything beyond the client area (scrollbars for // example) if ( rectClient.GetRight() > size.x ) rectClient.SetRight(size.x); if ( rectClient.GetBottom() > size.y ) rectClient.SetBottom(size.y); } else // refresh the entire client area { // x,y is already set to 0 by default rectClient.SetSize(size); } // convert refresh rectangle to window coordinates: wxRect rectWin(rectClient); rectWin.Offset(origin); // debugging helper#ifdef WXDEBUG_REFRESH static bool s_refreshDebug = false; if ( s_refreshDebug ) { wxWindowDC dc(this); dc.SetBrush(*wxCYAN_BRUSH); dc.SetPen(*wxTRANSPARENT_PEN); dc.DrawRectangle(rectWin); // under Unix we use "--sync" X option for this#if defined(__WXMSW__) && !defined(__WXMICROWIN__) ::GdiFlush(); ::Sleep(200);#endif // __WXMSW__ }#endif // WXDEBUG_REFRESH wxWindowNative::Refresh(eraseBackground, &rectWin); // Refresh all sub controls if any. wxWindowList& children = GetChildren(); for ( wxWindowList::iterator i = children.begin(); i != children.end(); ++i ) { wxWindow *child = *i; // only refresh subcontrols if they are visible: if ( child->IsTopLevel() || !child->IsShown() || child->IsFrozen() ) continue; // ...and when the subcontrols are in the update region: wxRect childrect(child->GetRect()); childrect.Intersect(rectClient); if ( childrect.IsEmpty() ) continue; // refresh the subcontrol now: childrect.Offset(-child->GetPosition()); // NB: We must call wxWindowNative version because we need to refresh // the entire control, not just its client area, and this is why we // don't account for child client area origin here neither. Also // note that we don't pass eraseBackground to the child, but use // true instead: this is because we can't be sure that // eraseBackground=false is safe for children as well and not only // for the parent. child->wxWindowNative::Refresh(eraseBackground, &childrect); }}
开发者ID:czxxjtu,项目名称:wxPython-1,代码行数:77,
示例10: wxASSERT_MSGwxRect wxWindow::ScrollNoRefresh(int dx, int dy, const wxRect *rectTotal){ wxASSERT_MSG( !dx || !dy, _T("can't be used for diag scrolling") ); // the rect to refresh (which we will calculate) wxRect rect; if ( !dx && !dy ) { // nothing to do return rect; } // calculate the part of the window which we can just redraw in the new // location wxSize sizeTotal = rectTotal ? rectTotal->GetSize() : GetClientSize(); wxLogTrace(_T("scroll"), _T("rect is %dx%d, scroll by %d, %d"), sizeTotal.x, sizeTotal.y, dx, dy); // the initial and end point of the region we move in client coords wxPoint ptSource, ptDest; if ( rectTotal ) { ptSource = rectTotal->GetPosition(); ptDest = rectTotal->GetPosition(); } // the size of this region wxSize size; size.x = sizeTotal.x - abs(dx); size.y = sizeTotal.y - abs(dy); if ( size.x <= 0 || size.y <= 0 ) { // just redraw everything as nothing of the displayed image will stay wxLogTrace(_T("scroll"), _T("refreshing everything")); rect = rectTotal ? *rectTotal : wxRect(0, 0, sizeTotal.x, sizeTotal.y); } else // move the part which doesn't change to the new location { // note that when we scroll the canvas in some direction we move the // block which doesn't need to be refreshed in the opposite direction if ( dx < 0 ) { // scroll to the right, move to the left ptSource.x -= dx; } else { // scroll to the left, move to the right ptDest.x += dx; } if ( dy < 0 ) { // scroll down, move up ptSource.y -= dy; } else { // scroll up, move down ptDest.y += dy; }#if wxUSE_CARET // we need to hide the caret before moving or it will erase itself at // the wrong (old) location wxCaret *caret = GetCaret(); if ( caret ) caret->Hide();#endif // wxUSE_CARET // do move wxClientDC dc(this); wxBitmap bmp(size.x, size.y); wxMemoryDC dcMem; dcMem.SelectObject(bmp); dcMem.Blit(wxPoint(0,0), size, &dc, ptSource#if defined(__WXGTK__) && !defined(wxHAS_WORKING_GTK_DC_BLIT) + GetClientAreaOrigin()#endif // broken wxGTK wxDC::Blit ); dc.Blit(ptDest, size, &dcMem, wxPoint(0,0)); wxLogTrace(_T("scroll"), _T("Blit: (%d, %d) of size %dx%d -> (%d, %d)"), ptSource.x, ptSource.y, size.x, size.y, ptDest.x, ptDest.y); // and now repaint the uncovered area // FIXME: We repaint the intersection of these rectangles twice - is // it bad? I don't think so as it is rare to scroll the window // diagonally anyhow and so adding extra logic to compute // rectangle intersection is probably not worth the effort//.........这里部分代码省略.........
开发者ID:czxxjtu,项目名称:wxPython-1,代码行数:101,
示例11: SetZoomSizevoid GLCanvas::SyncWithOptions(){ SetZoomSize( GetClientSize().GetWidth(), GetClientSize().GetHeight() );}
开发者ID:peteward44,项目名称:nesulator,代码行数:4,
示例12: wxPaintDCvoid C3D_MODEL_VIEWER::OnPaint( wxPaintEvent &event ){ wxPaintDC( this ); // SwapBuffer requires the window to be shown before calling if( !IsShownOnScreen() ) { wxLogTrace( m_logTrace, wxT( "C3D_MODEL_VIEWER::OnPaint !IsShown" ) ); return; } // "Makes the OpenGL state that is represented by the OpenGL rendering // context context current, i.e. it will be used by all subsequent OpenGL calls. // This function may only be called when the window is shown on screen" GL_CONTEXT_MANAGER::Get().LockCtx( m_glRC, this ); // Set the OpenGL viewport according to the client size of this canvas. // This is done here rather than in a wxSizeEvent handler because our // OpenGL rendering context (and thus viewport setting) is used with // multiple canvases: If we updated the viewport in the wxSizeEvent // handler, changing the size of one canvas causes a viewport setting that // is wrong when next another canvas is repainted. wxSize clientSize = GetClientSize(); if( !m_ogl_initialized ) { m_ogl_initialized = true; ogl_initialize(); } if( m_reload_is_needed ) { wxLogTrace( m_logTrace, wxT( "C3D_MODEL_VIEWER::OnPaint m_reload_is_needed" ) ); m_reload_is_needed = false; m_ogl_3dmodel = new C_OGL_3DMODEL( *m_3d_model ); // It convert a model as it was a board, so get the max size dimension of the board // and compute the conversion scale m_BiuTo3Dunits = (double)RANGE_SCALE_3D / ((double)m_ogl_3dmodel->GetBBox().GetMaxDimension() * UNITS3D_TO_UNITSPCB); } glViewport( 0, 0, clientSize.x, clientSize.y ); m_trackBallCamera.SetCurWindowSize( clientSize ); // clear color and depth buffers // ///////////////////////////////////////////////////////////////////////// glEnable( GL_DEPTH_TEST ); glClearColor( 0.0f, 0.0f, 0.0f, 1.0f ); glClearDepth( 1.0f ); glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT ); // Set projection and modelview matrixes // ///////////////////////////////////////////////////////////////////////// glMatrixMode( GL_PROJECTION ); glLoadMatrixf( glm::value_ptr( m_trackBallCamera.GetProjectionMatrix() ) ); glMatrixMode( GL_MODELVIEW ); glLoadMatrixf( glm::value_ptr( m_trackBallCamera.GetViewMatrix() ) ); glEnable(GL_LIGHTING); glEnable(GL_LIGHT0); // Render Model if( m_ogl_3dmodel ) { glPushMatrix(); double modelunit_to_3d_units_factor = m_BiuTo3Dunits * UNITS3D_TO_UNITSPCB; glScaled( modelunit_to_3d_units_factor, modelunit_to_3d_units_factor, modelunit_to_3d_units_factor); // Center model in the render viewport const SFVEC3F model_center = m_ogl_3dmodel->GetBBox().GetCenter(); glTranslatef( -model_center.x, -model_center.y, -model_center.z ); // !TODO: draw transparent models m_ogl_3dmodel->Draw_opaque(); m_ogl_3dmodel->Draw_transparent(); //m_ogl_3dmodel->Draw_bboxes(); glPopMatrix(); } glViewport( 0, 0, clientSize.y / 8 , clientSize.y / 8 ); // YxY squared view port glClear( GL_DEPTH_BUFFER_BIT ); glMatrixMode( GL_PROJECTION ); glLoadIdentity(); gluPerspective( 45.0f, 1.0f, 0.01f, RANGE_SCALE_3D * 2.0f ); glMatrixMode( GL_MODELVIEW ); glLoadIdentity(); const glm::mat4 TranslationMatrix = glm::translate( glm::mat4(1.0f), SFVEC3F( 0.0f, 0.0f, -RANGE_SCALE_3D ) ); const glm::mat4 ViewMatrix = TranslationMatrix * m_trackBallCamera.GetRotationMatrix();//.........这里部分代码省略.........
开发者ID:CastMi,项目名称:kicad-source-mirror,代码行数:101,
示例13: GetClientSize// Print the canvas contents to a bitmap:void gateImage::generateImage() {//WARNING!!! Heavily platform-dependent code ahead! This only works in MS Windows because of the// DIB Section OpenGL rendering. wxSize sz = GetClientSize(); // Create a DIB section. // (The Windows wxBitmap implementation will create a DIB section for a bitmap if you set // a color depth of 24 or greater.) wxBitmap theBM( GATEIMAGESIZE, GATEIMAGESIZE, 32 ); // Get a memory hardware device context for writing to the bitmap DIB Section: wxMemoryDC myDC; myDC.SelectObject(theBM); WXHDC theHDC = myDC.GetHDC(); // The basics of setting up OpenGL to render to the bitmap are found at: // http://www.nullterminator.net/opengl32.html // http://www.codeguru.com/cpp/g-m/opengl/article.php/c5587/ PIXELFORMATDESCRIPTOR pfd; int iFormat; // set the pixel format for the DC ::ZeroMemory( &pfd, sizeof( pfd ) ); pfd.nSize = sizeof( pfd ); pfd.nVersion = 1; pfd.dwFlags = PFD_DRAW_TO_BITMAP | PFD_SUPPORT_OPENGL | PFD_SUPPORT_GDI; pfd.iPixelType = PFD_TYPE_RGBA; pfd.cColorBits = 32; pfd.cDepthBits = 16; pfd.iLayerType = PFD_MAIN_PLANE; iFormat = ::ChoosePixelFormat( (HDC) theHDC, &pfd ); ::SetPixelFormat( (HDC) theHDC, iFormat, &pfd ); // create and enable the render context (RC) HGLRC hRC = ::wglCreateContext( (HDC) theHDC ); HGLRC oldhRC = ::wglGetCurrentContext(); HDC oldDC = ::wglGetCurrentDC(); ::wglMakeCurrent( (HDC) theHDC, hRC ); // Setup the viewport for rendering: setViewport(); // Reset the glViewport to the size of the bitmap: glViewport(0, 0, GATEIMAGESIZE, GATEIMAGESIZE); // Set the bitmap clear color: glClearColor (1.0, 1.0, 1.0, 0.0); glColor3b(0, 0, 0); glPixelStorei( GL_UNPACK_ALIGNMENT, 1 ); //TODO: Check if alpha is hardware supported, and // don't enable it if not! glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); glEnable(GL_BLEND); glTexEnvi( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE ); //********************************* //Edit by Joshua Lansford 4/09/07 //anti-alis ing is nice //glEnable( GL_LINE_SMOOTH ); //End of edit // Load the font texture guiText::loadFont(wxGetApp().appSettings.textFontFile); // Do the rendering here. renderMap(); // Flush the OpenGL buffer to make sure the rendering has happened: glFlush(); // Destroy the OpenGL rendering context, release the memDC, and // convert the DIB Section into a wxImage to return to the caller: ::wglMakeCurrent( oldDC, oldhRC ); //::wglMakeCurrent( NULL, NULL ); ::wglDeleteContext( hRC ); myDC.SelectObject(wxNullBitmap); gImage = theBM.ConvertToImage();}
开发者ID:jakeprem,项目名称:cedarlogic,代码行数:83,
示例14: mRateAudacityProject::AudacityProject(wxWindow * parent, wxWindowID id, const wxPoint & pos, const wxSize & size):wxFrame(parent, id, "Audacity", pos, size),mRate((double) gPrefs-> Read("/SamplingRate/DefaultProjectSampleRate", 44100)),mDirty(false), mDrag(NULL), mTrackPanel(NULL), mHistoryWindow(NULL),mAutoScrolling(false), mTotalToolBarHeight(0), mDraggingToolBar(NoneID){ // // Create track list // mTracks = new TrackList(); mLastSavedTracks = NULL; // // Initialize view info (shared with TrackPanel) // // Selection mViewInfo.sel0 = 0.0; mViewInfo.sel1 = 0.0; // Horizontal scrollbar mViewInfo.total = 1.0; mViewInfo.screen = 1.0; mViewInfo.h = 0.0; mViewInfo.zoom = 44100.0 / 512.0; mViewInfo.lastZoom = mViewInfo.zoom; // Vertical scrollbar mViewInfo.vpos = 0; mViewInfo.scrollStep = 16; mViewInfo.sbarH = 0; mViewInfo.sbarScreen = 1; mViewInfo.sbarTotal = 1; // Some GUI prefs gPrefs->Read("/GUI/UpdateSpectrogram", &mViewInfo.bUpdateSpectrogram, true); gPrefs->Read("/GUI/AutoScroll", &mViewInfo.bUpdateTrackIndicator, true); // Some extra information mViewInfo.bIsPlaying = false; mViewInfo.bRedrawWaveform = false; mMenuBar = NULL; CreateMenuBar(); int left = 0, top = 0, width, height; GetClientSize(&width, &height); // // Create the Control Toolbar (if we're not using a windowed toolbar) // The control toolbar should be automatically loaded--other toolbars are optional. if (!gControlToolBarStub->GetWindowedStatus()) { int h = gControlToolBarStub->GetHeight(); ToolBar *tb = new ControlToolBar(this, 0, wxPoint(10, top), wxSize(width - 10, h)); mToolBarArray.Add((ToolBar *) tb); top += h + 1; height -= h + 1; mTotalToolBarHeight += h; } if (gEditToolBarStub) { if(gEditToolBarStub->GetLoadedStatus() && !gEditToolBarStub->GetWindowedStatus()) { int h = gEditToolBarStub->GetHeight(); ToolBar *etb = new EditToolBar(this,0 ,wxPoint(10,top), wxSize(width-10,h)); mToolBarArray.Add((ToolBar *) etb); top +=h + 1; height -= h + 1; mTotalToolBarHeight +=h; } } // // Create the status bar // int sh = GetStatusHeight(); mStatus = new AStatus(this, 0, wxPoint(0, height - sh), wxSize(width, sh), mRate, this); height -= sh;//.........这里部分代码省略.........
开发者ID:ruthmagnus,项目名称:audacity,代码行数:101,
示例15: GetClientSizeint wxSplitterWindow::GetWindowSize() const{ wxSize size = GetClientSize(); return m_splitMode == wxSPLIT_VERTICAL ? size.x : size.y;}
开发者ID:Asmodean-,项目名称:Ishiiruka,代码行数:6,
示例16: dcvoid AudacityProject::OnPaint(wxPaintEvent & event){ wxPaintDC dc(this); int top = 0; int h = 0; int i, j; int toolbartop, toolbarbottom, toolbarheight; wxRect r; int width, height; GetClientSize(&width, &height); //Deal with the ToolBars for (i = 0; i < mToolBarArray.GetCount(); i++) { AColor::Medium(&dc, false); toolbartop = h; h += mToolBarArray[i]->GetHeight(); toolbarbottom = h; toolbarheight = toolbarbottom - toolbartop; //Adjust a little for Windows (tm) #ifdef __WXMSW__ h++;#endif //Draw a rectangle the space of scrollbar r.x = width - sbarSpaceWidth; r.y = toolbartop; r.width = sbarSpaceWidth; r.height = toolbarheight; dc.DrawRectangle(r); //Draw a rectangle around the "grab-bar" r.x = 0; r.y = toolbartop; r.width = 10; r.height = toolbarheight; dc.DrawRectangle(r); // Draw little bumps to the left of the toolbar to // make it a "grab-bar". //adjust min and max so that they aren't too close to the edges int minbump = (toolbarheight % 2 == 0) ? 3 : 4; int maxbump = (toolbarheight % 2 == 0) ? toolbarheight - 3 : toolbarheight - 4; AColor::Light(&dc, false); for (j = minbump; j < maxbump; j += 4) dc.DrawLine(3, toolbartop + j, 6, toolbartop + j); AColor::Dark(&dc, false); for (j = minbump + 1; j < maxbump + 1; j += 4) dc.DrawLine(3, toolbartop + j, 6, toolbartop + j); //Draw a black line to the right of the grab-bar dc.SetPen(*wxBLACK_PEN); dc.DrawLine(9, toolbartop, 9, toolbarbottom); //Draw some more lines for Windows (tm)#ifdef __WXMSW__ dc.DrawLine(0, toolbartop, width, toolbartop); dc.DrawLine(0, toolbartop, 0, toolbarbottom);#endif dc.DrawLine(0, toolbarbottom, width, toolbarbottom); h++; } //Now, h is equal to the total height of all the toolbars top += h; height -= h; int sh = GetStatusHeight(); height -= sh; // Fill in space on sides of scrollbars dc.SetPen(*wxBLACK_PEN); dc.DrawLine(width - sbarSpaceWidth, top, width - sbarSpaceWidth, top + height - sbarSpaceWidth + 1); dc.DrawLine(0, top + height - sbarSpaceWidth, width - sbarSpaceWidth, top + height - sbarSpaceWidth); wxRect f; f.x = 0; f.y = top + height - sbarSpaceWidth + 1; f.width = mTrackPanel->GetLeftOffset() - 2; f.height = sbarSpaceWidth - 2; AColor::Medium(&dc, false);//.........这里部分代码省略.........
开发者ID:ruthmagnus,项目名称:audacity,代码行数:101,
示例17: OnSizevoid TextEditorStc::OnSize(wxSizeEvent& evt){ edwnd->SetSize(GetClientSize());}
开发者ID:travisgoodspeed,项目名称:basicsynth,代码行数:4,
示例18: hTheme// draw focus background on area in a way typical on platformvoidwxComboCtrl::PrepareBackground( wxDC& dc, const wxRect& rect, int flags ) const{#if wxUSE_UXTHEME wxUxThemeHandle hTheme(this, L"COMBOBOX");#endif wxSize sz = GetClientSize(); bool isEnabled; bool doDrawFocusRect; // also selected // For smaller size control (and for disabled background) use less spacing int focusSpacingX; int focusSpacingY; if ( !(flags & wxCONTROL_ISSUBMENU) ) { // Drawing control isEnabled = IsEnabled(); doDrawFocusRect = ShouldDrawFocus();#if wxUSE_UXTHEME // Windows-style: for smaller size control (and for disabled background) use less spacing if ( hTheme ) { // WinXP Theme focusSpacingX = isEnabled ? 2 : 1; focusSpacingY = sz.y > (GetCharHeight()+2) && isEnabled ? 2 : 1; } else#endif { // Classic Theme if ( isEnabled ) { focusSpacingX = 1; focusSpacingY = 1; } else { focusSpacingX = 0; focusSpacingY = 0; } } } else { // Drawing a list item isEnabled = true; // they are never disabled doDrawFocusRect = flags & wxCONTROL_SELECTED ? true : false; focusSpacingX = 0; focusSpacingY = 0; } // Set the background sub-rectangle for selection, disabled etc wxRect selRect(rect); selRect.y += focusSpacingY; selRect.height -= (focusSpacingY*2); int wcp = 0; if ( !(flags & wxCONTROL_ISSUBMENU) ) wcp += m_widthCustomPaint; selRect.x += wcp + focusSpacingX; selRect.width -= wcp + (focusSpacingX*2); //wxUxThemeEngine* theme = NULL; //if ( hTheme ) // theme = wxUxThemeEngine::GetIfActive(); wxColour bgCol; bool doDrawDottedEdge = false; bool doDrawSelRect = true; // TODO: doDrawDottedEdge = true when focus has arrived to control via tab. // (and other cases which are not that apparent). if ( isEnabled ) { // If popup is hidden and this control is focused, // then draw the focus-indicator (selbgcolor background etc.). if ( doDrawFocusRect ) { // NB: We can't really use XP visual styles to get TMT_TEXTCOLOR since // it is not properly defined for combo boxes. Instead, they expect // you to use DrawThemeText. // // Here is, however, sample code how to get theme colours: // // COLORREF cref; // theme->GetThemeColor(hTheme,EP_EDITTEXT,ETS_NORMAL,TMT_TEXTCOLOR,&cref); // dc.SetTextForeground( wxRGBToColour(cref) ); if ( (m_iFlags & wxCC_FULL_BUTTON) && !(flags & wxCONTROL_ISSUBMENU) ) { // Vista style read-only combo doDrawSelRect = false; doDrawDottedEdge = true;//.........这里部分代码省略.........
开发者ID:czxxjtu,项目名称:wxPython-1,代码行数:101,
示例19: dcvoid AudacityProject::OnPaint(wxPaintEvent & event){ // Draw a colored strip on the right and bottom edges of // the window to fill in the small area not covered by // the TrackPanel or the scrollbars. wxPaintDC dc(this); int width, height; GetClientSize(&width, &height); AColor::Medium(&dc, false); int top = 0; if (!gWindowedPalette) { int h = GetAPaletteHeight();#ifdef __WXMSW__ h++;#endif top += h + 1; height -= h + 1; } int sh = GetStatusHeight(); height -= sh; wxRect r; r.x = width - sbarSpaceWidth; r.y = 0; r.width = sbarSpaceWidth; r.height = height; dc.DrawRectangle(r); // If we're displaying the palette inside the window, // draw little bumps to the left of the palette to // indicate it's grabable if (!gWindowedPalette) { int h = GetAPaletteHeight(); r.x = 0; r.y = 0; r.width = 10; r.height = h; dc.DrawRectangle(r); int i; AColor::Light(&dc, false); for (i = h / 2 - 20; i < h / 2 + 20; i += 4) dc.DrawLine(3, i, 6, i); AColor::Dark(&dc, false); for (i = h / 2 - 19; i < h / 2 + 21; i += 4) dc.DrawLine(3, i, 6, i); dc.SetPen(*wxBLACK_PEN); dc.DrawLine(9, 0, 9, h);#ifdef __WXMSW__ dc.DrawLine(0, 0, width, 0); dc.DrawLine(0, 0, 0, h);#endif dc.DrawLine(0, h, width, h); } // Fill in space on sides of scrollbars dc.SetPen(*wxBLACK_PEN); dc.DrawLine(width - sbarSpaceWidth, top, width - sbarSpaceWidth, top + height - sbarSpaceWidth + 1); dc.DrawLine(0, top + height - sbarSpaceWidth, width - sbarSpaceWidth, top + height - sbarSpaceWidth); wxRect f; f.x = 0; f.y = top + height - sbarSpaceWidth + 1; f.width = mTrackPanel->GetLeftOffset() - 2; f.height = sbarSpaceWidth - 2; AColor::Medium(&dc, false); dc.DrawRectangle(f); AColor::Bevel(dc, true, f);}
开发者ID:andreipaga,项目名称:audacity,代码行数:84,
示例20: WXUNUSEDvoid wxComboCtrl::OnPaintEvent( wxPaintEvent& WXUNUSED(event) ){ // TODO: Convert drawing in this function to Windows API Code wxSize sz = GetClientSize(); wxAutoBufferedPaintDC dc(this); const wxRect& rectButton = m_btnArea; wxRect rectTextField = m_tcArea; wxColour bgCol = GetBackgroundColour();#if wxUSE_UXTHEME const bool isEnabled = IsEnabled(); wxMSWDCImpl *impl = (wxMSWDCImpl*) dc.GetImpl(); HDC hDc = GetHdcOf(*impl); HWND hWnd = GetHwndOf(this); wxUxThemeEngine* theme = NULL; wxUxThemeHandle hTheme(this, L"COMBOBOX"); if ( hTheme ) theme = wxUxThemeEngine::GetIfActive();#endif // wxUSE_UXTHEME wxRect borderRect(0,0,sz.x,sz.y); if ( m_iFlags & wxCC_IFLAG_BUTTON_OUTSIDE ) { borderRect = m_tcArea; borderRect.Inflate(1); } int drawButFlags = 0;#if wxUSE_UXTHEME if ( hTheme ) { const bool useVistaComboBox = ::wxGetWinVersion() >= wxWinVersion_Vista; RECT rFull; wxCopyRectToRECT(borderRect, rFull); RECT rButton; wxCopyRectToRECT(rectButton, rButton); RECT rBorder; wxCopyRectToRECT(borderRect, rBorder); bool isNonStdButton = (m_iFlags & wxCC_IFLAG_BUTTON_OUTSIDE) || (m_iFlags & wxCC_IFLAG_HAS_NONSTANDARD_BUTTON); // // Get some states for themed drawing int butState; if ( !isEnabled ) { butState = CBXS_DISABLED; } // Vista will display the drop-button as depressed always // when the popup window is visilbe else if ( (m_btnState & wxCONTROL_PRESSED) || (useVistaComboBox && !IsPopupWindowState(Hidden)) ) { butState = CBXS_PRESSED; } else if ( m_btnState & wxCONTROL_CURRENT ) { butState = CBXS_HOT; } else { butState = CBXS_NORMAL; } int comboBoxPart = 0; // For XP, use the 'default' part RECT* rUseForBg = &rBorder; bool drawFullButton = false; int bgState = butState; const bool isFocused = (FindFocus() == GetMainWindowOfCompositeControl()) ? true : false; if ( useVistaComboBox ) { // FIXME: Either SetBackgroundColour or GetBackgroundColour // doesn't work under Vista, so here's a temporary // workaround. bgCol = wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW); // Draw the entire control as a single button? if ( !isNonStdButton ) { if ( HasFlag(wxCB_READONLY) ) drawFullButton = true; } if ( drawFullButton ) { comboBoxPart = CP_READONLY;//.........这里部分代码省略.........
开发者ID:czxxjtu,项目名称:wxPython-1,代码行数:101,
示例21: dcvoid GlyphPreviewWindow::OnPaint(wxPaintEvent& evt){ wxPaintDC dc(this); if (m_entry.IsOK() && m_font.IsOk()) { wxUint32 glyph = m_font.GetGlyphIndex(m_entry.GetCode()); wxSize glyphSize = m_font.GetGlyphSize(glyph); wxSize clientSize = GetClientSize(); if (glyphSize.GetHeight() != 0 && glyphSize.GetWidth() != 0) { float scale; if (glyphSize.GetWidth() > glyphSize.GetHeight()) { scale = (float)clientSize.GetWidth()/glyphSize.GetWidth(); } else { scale = (float) clientSize.GetHeight() / glyphSize.GetHeight(); } scale *= 0.9f; int size = m_font.GetGlyphBitmap(glyph, NULL, NULL, NULL); if (size > 0) { int width, height; wxUint8 *bitmap = new wxUint8[size]; wxSize glyphSize = m_font.GetGlyphSize(glyph); wxPoint bearing = m_font.GetGlyphBearing(glyph); m_font.GetGlyphBitmap(glyph, bitmap, &width, &height); wxImage image(width, height); unsigned char *rgb = image.GetData(); for (int y = 0; y < height; y++) { for (int x = 0; x < width; x++) { int offset = ((y) * image.GetWidth() + x) * 3; wxASSERT(offset+2 < image.GetWidth()*image.GetHeight()*3); wxASSERT(offset >= 0); rgb[0 + offset] = 255 - bitmap[y * width + x]; rgb[1 + offset] = 255 - bitmap[y * width + x]; rgb[2 + offset] = 255 - bitmap[y * width + x]; } } image.Rescale(width*scale, height*scale); wxPoint origin((clientSize.GetWidth() - glyphSize.GetWidth()*scale)/2, (clientSize.GetHeight() - glyphSize.GetHeight()*scale)/2); origin.y += bearing.y*scale; wxPoint glyphPos = origin + wxPoint(bearing.x, -bearing.y)*scale; dc.DrawBitmap(wxBitmap(image), glyphPos); dc.SetPen(*wxRED_PEN); dc.SetBrush(*wxTRANSPARENT_BRUSH); dc.DrawRectangle(glyphPos, wxSize(image.GetWidth(), image.GetHeight())); dc.SetPen(*wxGREEN_PEN); dc.DrawLine(0, origin.y, clientSize.GetWidth(), origin.y); dc.DrawLine(origin.x, 0, origin.x, clientSize.GetHeight()); wxPoint advancePoint = origin += m_font.GetGlyphAdvance(glyph)*scale; dc.SetPen(*wxBLUE_PEN); dc.DrawLine(advancePoint.x - 10, advancePoint.y, advancePoint.x + 10, advancePoint.y); dc.DrawLine(advancePoint.x, advancePoint.y - 10, advancePoint.x, advancePoint.y + 10); delete [] bitmap; } } }}
开发者ID:robojan,项目名称:EMGL,代码行数:68,
示例22: WXUNUSEDvoid CMusikListCtrl::OnPaint(wxPaintEvent& WXUNUSED(event)){ wxBufferedPaintDC dc(this); MSWDefWindowProc(WM_ERASEBKGND, (WPARAM) (HDC) dc.GetHDC(), 0); MSWDefWindowProc(WM_PAINT, (WPARAM) (HDC) dc.GetHDC(), 0); /* copied from original wxwindows code */ // Reset the device origin since it may have been set dc.SetDeviceOrigin(0, 0); bool drawHRules = ((GetWindowStyle() & wxLC_HRULES) != 0); bool drawVRules = ((GetWindowStyle() & wxLC_VRULES) != 0); if (!drawHRules && !drawVRules) return; if ((GetWindowStyle() & wxLC_REPORT) == 0) return; wxPen pen(wxSystemSettings::GetColour(wxSYS_COLOUR_3DLIGHT), 1, wxSOLID); dc.SetPen(pen); dc.SetBrush(* wxTRANSPARENT_BRUSH); wxSize clientSize = GetClientSize(); wxRect itemRect; int cy=0; int itemCount = GetItemCount(); int i; if (drawHRules) { long top = GetTopItem(); for (i = top; i < top + GetCountPerPage() + 1; i++) { if (GetItemRect(i, itemRect)) { cy = itemRect.GetTop(); if (i != 0) // Don't draw the first one { dc.DrawLine(0, cy, clientSize.x, cy); } // Draw last line if (i == itemCount - 1) { cy = itemRect.GetBottom(); dc.DrawLine(0, cy, clientSize.x, cy); } } } } i = itemCount - 1; if (drawVRules && (i > -1)) { wxRect firstItemRect; GetItemRect(0, firstItemRect); if (GetItemRect(i, itemRect)) { int col; int x = itemRect.GetX(); for (col = 0; col < GetColumnCount(); col++) { int colWidth = GetColumnWidth(col); x += colWidth ; dc.DrawLine(x-1, firstItemRect.GetY() - 2, x-1, itemRect.GetBottom()); } } }}
开发者ID:BackupTheBerlios,项目名称:musik-svn,代码行数:69,
注:本文中的GetClientSize函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ GetClientVoiceMgr函数代码示例 C++ GetClientRect函数代码示例 |