当前位置: 首页>>代码示例>>C++>>正文


C++ GetClientSize函数代码示例

本文整理汇总了C++中GetClientSize函数的典型用法代码示例。如果您正苦于以下问题:C++ GetClientSize函数的具体用法?C++ GetClientSize怎么用?C++ GetClientSize使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了GetClientSize函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: wxFrame

AudacityProject::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,代码来源:Project.cpp

示例2: pt

void 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,代码来源:GLCanvas.cpp

示例3: GetGlobalColor

void 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,代码来源:dial.cpp

示例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,代码来源:splitter.cpp

示例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,代码来源:sashwin.cpp

示例6: old_dc

void 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,代码来源:lineChart.cpp

示例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,代码来源:steframe.cpp

示例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,代码来源:widget_hotkey_list.cpp

示例9: GetClientAreaOrigin

void 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,代码来源:winuniv.cpp

示例10: wxASSERT_MSG

wxRect 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,代码来源:winuniv.cpp

示例11: SetZoomSize

void GLCanvas::SyncWithOptions()
{
	SetZoomSize( GetClientSize().GetWidth(), GetClientSize().GetHeight() );
}
开发者ID:peteward44,项目名称:nesulator,代码行数:4,代码来源:glcanvas.cpp

示例12: wxPaintDC

void 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,代码来源:c3d_model_viewer.cpp

示例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,代码来源:gateImage.cpp

示例14: mRate

AudacityProject::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,代码来源:Project.cpp

示例15: GetClientSize

int wxSplitterWindow::GetWindowSize() const
{
    wxSize size = GetClientSize();

    return m_splitMode == wxSPLIT_VERTICAL ? size.x : size.y;
}
开发者ID:Asmodean-,项目名称:Ishiiruka,代码行数:6,代码来源:splitter.cpp


注:本文中的GetClientSize函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。