这篇教程C++ DoGetBestSize函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中DoGetBestSize函数的典型用法代码示例。如果您正苦于以下问题:C++ DoGetBestSize函数的具体用法?C++ DoGetBestSize怎么用?C++ DoGetBestSize使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了DoGetBestSize函数的27个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: DoGetBestSizewxSize wxSheetCellStringRendererRefData::GetBestSize(wxSheet& sheet, const wxSheetCellAttr& attr, wxDC& dc, const wxSheetCoords& coords){ return DoGetBestSize(sheet, attr, dc, GetString(sheet, coords));}
开发者ID:stahta01,项目名称:wxCode_components,代码行数:7,
示例2: SetMinSizevoid wxRibbonBar::ShowPanels(bool show){ m_arePanelsShown = show; SetMinSize(wxSize(GetSize().GetWidth(), DoGetBestSize().GetHeight())); Realise(); GetParent()->Layout();}
开发者ID:Kaoswerk,项目名称:newton-dynamics,代码行数:7,
示例3: wxGetDisplayvoid WXAppBar::UnSetDockedModeStep2(){ Display *dd= (Display *) wxGetDisplay(); // Window X11 handle GtkWidget *gtkWidget= (GtkWidget *) this->GetHandle(); Window w= GDK_WINDOW_XWINDOW (gtkWidget->window); Refresh(); Update(); // // Set window style back to normal again // Atom atomTmp= XInternAtom (dd, "_NET_WM_WINDOW_TYPE", False); Atom atom_NET_WM_WINDOW_TYPE_NORMAL= XInternAtom (dd, "_NET_WM_WINDOW_TYPE_NORMAL", False); unsigned long propInfo= atom_NET_WM_WINDOW_TYPE_NORMAL; XChangeProperty (dd, w, atomTmp, XA_ATOM, 32, PropModeReplace, (unsigned char *) &propInfo, 1); XSync(dd, False); // The code above disables the sticky property, so we enable it again SetSticky(true); // Restore decorations when needed SetBorderDecorations(m_dialogHadBorderDecorations); // Restore original size wxSize proposedSize= DoGetBestSize(); //SetSize (0, 0, proposedSize.GetWidth(), proposedSize.GetHeight()); SetSize (proposedSize.GetWidth(), proposedSize.GetHeight());}
开发者ID:rkvsraman,项目名称:eviacam,代码行数:31,
示例4: OldGetMinSizewxSize wxButton::GetMinSize() const{ if( wxMotifLargeButtons() ) return OldGetMinSize(); return DoGetBestSize();}
开发者ID:hgwells,项目名称:tive,代码行数:7,
示例5: wxCHECK_RETvoid wxSpinButton::OnSize( wxSizeEvent &WXUNUSED(event) ){ wxCHECK_RET( (m_widget != NULL), wxT("invalid spin button") ); m_width = DoGetBestSize().x; gtk_widget_set_size_request( m_widget, m_width, m_height );}
开发者ID:krossell,项目名称:wxWidgets,代码行数:7,
示例6: CalcLayoutvoid wxCustomButton::SetMargins(const wxSize &margin, bool fit){ m_labelMargin = margin; m_bitmapMargin = margin; CalcLayout(TRUE); if (fit) SetSize(DoGetBestSize());}
开发者ID:erelh,项目名称:gpac,代码行数:7,
示例7: DoGetBestSizewxSize wxGridCellStringRenderer::GetBestSize(wxGrid& grid, wxGridCellAttr& attr, wxDC& dc, int row, int col){ return DoGetBestSize(attr, dc, grid.GetCellValue(row, col));}
开发者ID:3v1n0,项目名称:wxWidgets,代码行数:7,
示例8: WXUNUSEDvoid wxComboBox::DoSetSize(int x, int y, int width, int WXUNUSED(height), int sizeFlags){ // Necessary so it doesn't call wxChoice::SetSize wxWindow::DoSetSize(x, y, width, DoGetBestSize().y, sizeFlags);}
开发者ID:EdgarTx,项目名称:wx,代码行数:7,
示例9: SetBackgroundColourbool wxMenuButton::Create( wxWindow* parent, wxWindowID id, const wxString &label, const wxBitmap &bitmap, const wxPoint& pos, const wxSize& size, long style, const wxValidator& val, const wxString& name){ m_style = style; long flat = style & wxMENUBUT_FLAT; wxControl::Create(parent,id,pos,size,wxNO_BORDER|wxCLIP_CHILDREN,val,name); wxControl::SetLabel(label); SetBackgroundColour(parent->GetBackgroundColour()); SetForegroundColour(parent->GetForegroundColour()); SetFont(parent->GetFont()); m_labelButton = new MenuLabelButton(this, id, label, bitmap, wxCUSTBUT_BUTTON|flat); m_dropdownButton = new MenuDropButton(this, IDD_DROPDOWN_BUTTON, wxCUSTBUT_BUTTON|flat); wxSize bestSize = DoGetBestSize(); SetSize( wxSize(size.x < 0 ? bestSize.x : size.x, size.y < 0 ? bestSize.y : size.y) );#if (wxMINOR_VERSION<8) SetBestSize(GetSize());#else SetInitialSize(GetSize());#endif return TRUE;}
开发者ID:erelh,项目名称:gpac,代码行数:34,
示例10: DoGetBestSizebool wxCustomButton::Create(wxWindow* parent, wxWindowID id, const wxString& label, const wxBitmap &bitmap, const wxPoint& pos, const wxSize& size, long style, const wxValidator& val, const wxString& name){ if (!wxControl::Create(parent,id,pos,size,wxNO_BORDER|wxCLIP_CHILDREN,val,name)) return FALSE; wxControl::SetLabel(label); wxControl::SetBackgroundColour(parent->GetBackgroundColour()); wxControl::SetForegroundColour(parent->GetForegroundColour()); wxControl::SetFont(parent->GetFont()); if (bitmap.Ok()) m_bmpLabel = bitmap; if (!SetButtonStyle(style)) return FALSE; wxSize bestSize = DoGetBestSize(); SetSize(wxSize(size.x<0 ? bestSize.x:size.x, size.y<0 ? bestSize.y:size.y));#if (wxMINOR_VERSION<8) SetBestSize(GetSize());#else SetInitialSize(GetSize());#endif CalcLayout(TRUE); return TRUE;}
开发者ID:erelh,项目名称:gpac,代码行数:29,
示例11: DoGetBestSizevoid WXAppBar::SetDockedModeStep1(){ // TODO: manage different docking locations on windows APPBARDATA abd; // Set metrics (TOP location only) wxSize proposedSize= DoGetBestSize(); m_X= 0; m_Y= 0; m_Width= GetSystemMetrics(SM_CXSCREEN); m_Height= proposedSize.GetHeight(); // Register appbar abd.cbSize= sizeof(APPBARDATA); abd.hWnd= (HWND) GetHandle(); abd.uCallbackMessage= 12345; //WX_APPBAR_CALLBACK; // TODO: respond to these callback messages SHAppBarMessage (ABM_NEW, &abd); // Set size abd.uEdge= ABE_TOP; abd.rc.left = m_X; abd.rc.top = m_Y; abd.rc.right = m_X + m_Width; abd.rc.bottom = m_Y + m_Height; SHAppBarMessage(ABM_QUERYPOS,&abd); // Correct size if needed m_X= abd.rc.left; m_Y= abd.rc.top; m_Width= abd.rc.right - m_X; // Re-calculate bottom corner abd.rc.bottom = m_Y + m_Height; SHAppBarMessage(ABM_SETPOS, &abd);}
开发者ID:rkvsraman,项目名称:eviacam,代码行数:34,
示例12: PrepareBackground/** Prepares the backgroundimage, to optimze speed */void wxLEDPanel::PrepareBackground(){ wxSize s=DoGetBestSize(); wxBitmap bmpBG(s.GetWidth(),s.GetHeight()); m_mdc_background.SelectObject(bmpBG); // clear the background m_mdc_background.SetBackground(this->GetBackgroundColour()); m_mdc_background.Clear(); if(m_invert || m_show_inactivs) DrawField(m_mdc_background, true);}
开发者ID:DowerChest,项目名称:codeblocks,代码行数:15,
示例13: DoGetBestSizebool wxSpinButton::Create(wxWindow *parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style, const wxString& name){ m_needParent = true; wxSize new_size = size, sizeBest = DoGetBestSize(); new_size.x = sizeBest.x; // override width always if (new_size.y == -1) new_size.y = sizeBest.y; if (!PreCreation( parent, pos, new_size ) || !CreateBase( parent, id, pos, new_size, style, wxDefaultValidator, name )) { wxFAIL_MSG( wxT("wxXX creation failed") ); return false; } m_oldPos = 0.0; m_adjust = (GtkAdjustment*) gtk_adjustment_new( 0.0, 0.0, 100.0, 1.0, 5.0, 0.0); m_widget = gtk_spin_button_new( m_adjust, 0, 0 ); gtk_spin_button_set_wrap( GTK_SPIN_BUTTON(m_widget), (int)(m_windowStyle & wxSP_WRAP) ); gtk_signal_connect( GTK_OBJECT (m_adjust), "value_changed", (GtkSignalFunc) gtk_spinbutt_callback, (gpointer) this ); m_parent->DoAddChild( this ); PostCreation(new_size); return true;}
开发者ID:EEmmanuel7,项目名称:wxWidgets,代码行数:42,
示例14: SetFieldsCountbool wxStatusBarUniv::Create(wxWindow *parent, wxWindowID id, long style, const wxString& name){ if ( !wxWindow::Create(parent, id, wxDefaultPosition, wxDefaultSize, style, name) ) { return false; } SetFieldsCount(1); CreateInputHandler(wxINP_HANDLER_STATUSBAR); SetSize(DoGetBestSize()); return true;}
开发者ID:czxxjtu,项目名称:wxPython-1,代码行数:20,
示例15: switchvoid wxRibbonBar::ShowPanels(wxRibbonDisplayMode mode){ switch ( mode ) { case wxRIBBON_BAR_PINNED: case wxRIBBON_BAR_EXPANDED: m_arePanelsShown = true; break; case wxRIBBON_BAR_MINIMIZED: m_arePanelsShown = false; break; } SetMinSize(wxSize(GetSize().GetWidth(), DoGetBestSize().GetHeight())); Realise(); GetParent()->Layout(); m_ribbon_state = mode;}
开发者ID:AaronDP,项目名称:wxWidgets,代码行数:20,
示例16: wxBitmapComboLabelbool wxBitmapComboBox::Create( wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style, const wxValidator& val, const wxString& name){ if (!DropDownBase::Create(parent,id,pos,size,wxNO_BORDER|wxCLIP_CHILDREN,val,name)) return false; m_labelWin = new wxBitmapComboLabel(this); m_win_border = m_labelWin->GetSize().x - m_labelWin->GetClientSize().x; SetBackgroundColour(*wxWHITE); m_frozen = false; CalcLayout(); wxSize bestSize = DoGetBestSize(); SetSize( wxSize(size.x < 0 ? bestSize.x : size.x, size.y < 0 ? bestSize.y : size.y) ); return SetButtonStyle(style);}
开发者ID:Kangar0o,项目名称:gambit,代码行数:22,
示例17: curSizevoid wxMenuButton::DoSetSize(int x, int y, int width, int height, int sizeFlags){ wxSize curSize( GetSize() ); wxSize bestSize( DoGetBestSize() ); if (width == -1) width = curSize.GetWidth(); if (width < 10) width = bestSize.GetWidth(); if (height == -1) height = curSize.GetHeight(); if (height < 5) height = bestSize.GetHeight(); wxWindow::DoSetSize(x, y, width, height, sizeFlags); if (m_labelButton) m_labelButton->SetSize(0, 0, width - wxMENUBUTTON_DROP_WIDTH, height); if (m_dropdownButton) m_dropdownButton->SetSize(width-wxMENUBUTTON_DROP_WIDTH, 0, wxMENUBUTTON_DROP_WIDTH, height);}
开发者ID:erelh,项目名称:gpac,代码行数:22,
示例18: DoGetBestSizebool wxSpinButton::Create(wxWindow *parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style, const wxString& name){ m_needParent = true; wxSize new_size = size, sizeBest = DoGetBestSize(); new_size.x = sizeBest.x; // override width always if (new_size.y == -1) new_size.y = sizeBest.y; if (!PreCreation( parent, pos, new_size ) || !CreateBase( parent, id, pos, new_size, style, wxDefaultValidator, name )) { wxFAIL_MSG( wxT("wxSpinButton creation failed") ); return false; } m_pos = 0; m_widget = gtk_spin_button_new_with_range(0, 100, 1); gtk_spin_button_set_wrap( GTK_SPIN_BUTTON(m_widget), (int)(m_windowStyle & wxSP_WRAP) ); g_signal_connect_after( m_widget, "value_changed", G_CALLBACK(gtk_value_changed), this); m_parent->DoAddChild( this ); PostCreation(new_size); return true;}
开发者ID:Bluehorn,项目名称:wxPython,代码行数:38,
示例19: DoGetBestSizebool wxBitmapButton::Create(wxWindow *parent, wxWindowID id, const wxBitmap& bitmap, const wxPoint& pos, const wxSize& size, long style, const wxValidator& validator, const wxString& name){ // since bitmapbuttonbase is subclass of button calling wxBitmapButtonBase::Create // essentially creates an additional button if ( !wxControl::Create(parent, id, pos, size, style, validator, name) ) return false; m_bmpNormal = bitmap; if (style & wxBU_AUTODRAW) { m_marginX = wxDEFAULT_BUTTON_MARGIN; m_marginY = wxDEFAULT_BUTTON_MARGIN; } else { m_marginX = 0; m_marginY = 0; } int width = size.x; int height = size.y; if ( bitmap.Ok() ) { wxSize newSize = DoGetBestSize(); if ( width == -1 ) width = newSize.x; if ( height == -1 ) height = newSize.y; } Rect bounds ; Str255 title ; m_bmpNormal = bitmap; wxBitmapRefData * bmap = NULL ; if ( m_bmpNormal.Ok() ) bmap = (wxBitmapRefData*) ( m_bmpNormal.GetRefData()) ; MacPreControlCreate( parent , id , wxEmptyString , pos , wxSize( width , height ) ,style, validator , name , &bounds , title ) ; m_macControl = (WXWidget) ::NewControl( MAC_WXHWND(parent->MacGetRootWindow()) , &bounds , title , false , 0 , kControlBehaviorOffsetContents + ( bmap && bmap->m_bitmapType == kMacBitmapTypeIcon ? kControlContentCIconHandle : kControlContentPictHandle ) , 0, (( style & wxBU_AUTODRAW ) ? kControlBevelButtonSmallBevelProc : kControlBevelButtonNormalBevelProc ), (long) this ) ; wxASSERT_MSG( (ControlHandle) m_macControl != NULL , wxT("No valid mac control") ) ; ControlButtonContentInfo info ; wxMacCreateBitmapButton( &info , m_bmpNormal ) ; if ( info.contentType != kControlNoContent ) { ::SetControlData( (ControlHandle) m_macControl , kControlButtonPart , kControlBevelButtonContentTag , sizeof(info) , (char*) &info ) ; } MacPostControlCreate() ; return TRUE;}
开发者ID:gitrider,项目名称:wxsj2,代码行数:64,
示例20: wxASSERT_MSGvoid wxControl::MacPostControlCreate(){ wxASSERT_MSG( (ControlHandle) m_macControl != NULL , wxT("No valid mac control") ) ; DoSetWindowVariant( m_windowVariant ) ; /* if ( IsKindOf( CLASSINFO( wxScrollBar ) ) ) { // no font } else if ( !UMAHasAquaLayout() && (IsKindOf( CLASSINFO( wxStaticBox ) ) || IsKindOf( CLASSINFO( wxRadioBox ) ) || IsKindOf( CLASSINFO( wxButton ) ) ) ) { ControlFontStyleRec controlstyle ; controlstyle.flags = kControlUseFontMask ; controlstyle.font = kControlFontSmallBoldSystemFont ; ::SetControlFontStyle( (ControlHandle) m_macControl , &controlstyle ) ; } else { ControlFontStyleRec controlstyle ; controlstyle.flags = kControlUseFontMask ; if (IsKindOf( CLASSINFO( wxButton ) ) ) controlstyle.font = kControlFontBigSystemFont ; // eventually kControlFontBigSystemFont ; else controlstyle.font = kControlFontSmallSystemFont ; ::SetControlFontStyle( (ControlHandle) m_macControl , &controlstyle ) ; } */ ControlHandle container = (ControlHandle) GetParent()->MacGetContainerForEmbedding() ; wxASSERT_MSG( container != NULL , wxT("No valid mac container control") ) ; ::EmbedControl( (ControlHandle) m_macControl , container ) ; m_macControlIsShown = MacIsReallyShown() ; wxAssociateControlWithMacControl( (ControlHandle) m_macControl , this ) ; if ( wxMacSetupControlBackgroundUPP == NULL ) { wxMacSetupControlBackgroundUPP = NewControlColorUPP( wxMacSetupControlBackground ) ; } if ( wxMacControlActionUPP == NULL ) { wxMacControlActionUPP = NewControlDefUPP( wxMacControlDefinition ) ; } // The following block of code is responsible for crashes when switching // back to windows, which can be seen in the dialogs sample. // It is disabled until a proper solution can be found.#if 0#if TARGET_CARBON/* only working under classic carbon m_macControlAction = *(**(ControlHandle)m_macControl).contrlDefProc ; (**(ControlHandle)m_macControl).contrlDefProc = (Handle) &wxMacControlActionUPP ;*/#else m_macControlAction = *(**(ControlHandle)m_macControl).contrlDefProc ; cdefHandle cdef ; cdef = (cdefHandle) NewHandle( sizeof(cdefRec) ) ; if ( (**(ControlHandle)m_macControl).contrlDefProc != NULL ) { (**cdef).instruction = 0x4EF9; /* JMP instruction */ (**cdef).function = (void(*)()) wxMacControlActionUPP; (**(ControlHandle)m_macControl).contrlDefProc = (Handle) cdef ; }#endif#endif SetControlColorProc( (ControlHandle) m_macControl , wxMacSetupControlBackgroundUPP ) ; // Adjust the controls size and position wxPoint pos(m_x, m_y); wxSize best_size( DoGetBestSize() ); wxSize new_size( m_width, m_height ); m_x = m_y = m_width = m_height = -1; // Forces SetSize to move/size the control if (new_size.x == -1) { new_size.x = best_size.x; } if (new_size.y == -1) { new_size.y = best_size.y; } SetSize(pos.x, pos.y, new_size.x, new_size.y); #if wxUSE_UNICODE UMASetControlTitle( (ControlHandle) m_macControl , wxStripMenuCodes(m_label) , m_font.GetEncoding() ) ;#endif if ( m_macControlIsShown ) UMAShowControl( (ControlHandle) m_macControl ) ; SetCursor( *wxSTANDARD_CURSOR ) ; Refresh() ;}
开发者ID:Duion,项目名称:Torsion,代码行数:96,
示例21: NewControlIdbool wxSpinButton::Create(wxWindow *parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style, const wxString& name){ // basic initialization m_windowId = (id == wxID_ANY) ? NewControlId() : id; SetName(name); int x = pos.x; int y = pos.y; int width = size.x; int height = size.y; m_windowStyle = style; SetParent(parent); // get the right size for the control if ( width <= 0 || height <= 0 ) { wxSize size = DoGetBestSize(); if ( width <= 0 ) width = size.x; if ( height <= 0 ) height = size.y; } if ( x < 0 ) x = 0; if ( y < 0 ) y = 0; // translate the styles DWORD wstyle = WS_VISIBLE | WS_CHILD | WS_TABSTOP | /* WS_CLIPSIBLINGS | */ UDS_NOTHOUSANDS | // never useful, sometimes harmful UDS_SETBUDDYINT; // it doesn't harm if we don't have buddy if ( m_windowStyle & wxCLIP_SIBLINGS ) wstyle |= WS_CLIPSIBLINGS; if ( m_windowStyle & wxSP_HORIZONTAL ) wstyle |= UDS_HORZ; if ( m_windowStyle & wxSP_ARROW_KEYS ) wstyle |= UDS_ARROWKEYS; if ( m_windowStyle & wxSP_WRAP ) wstyle |= UDS_WRAP; // create the UpDown control. m_hWnd = (WXHWND)CreateUpDownControl ( wstyle, x, y, width, height, GetHwndOf(parent), m_windowId, wxGetInstance(), NULL, // no buddy m_max, m_min, m_min // initial position ); if ( !m_hWnd ) { wxLogLastError(wxT("CreateUpDownControl")); return false; } if ( parent ) { parent->AddChild(this); } SubclassWin(m_hWnd); SetInitialSize(size); return true;}
开发者ID:AlexHayton,项目名称:decoda,代码行数:81,
示例22: GetPosition// set the size of the window: if the dimensions are positive, just use them,// but if any of them is equal to -1, it means that we must find the value for// it ourselves (unless sizeFlags contains wxSIZE_ALLOW_MINUS_ONE flag, in// which case -1 is a valid value for x and y)//// If sizeFlags contains wxSIZE_AUTO_WIDTH/HEIGHT flags (default), we calculate// the width/height to best suit our contents, otherwise we reuse the current// width/heightvoid wxWindowDFB::DoSetSize(int x, int y, int width, int height, int sizeFlags){ // get the current size and position... int currentX, currentY; GetPosition(¤tX, ¤tY); int currentW,currentH; GetSize(¤tW, ¤tH); if ( x == -1 && !(sizeFlags & wxSIZE_ALLOW_MINUS_ONE) ) x = currentX; if ( y == -1 && !(sizeFlags & wxSIZE_ALLOW_MINUS_ONE) ) y = currentY; // ... and don't do anything (avoiding flicker) if it's already ok if ( x == currentX && y == currentY && width == currentW && height == currentH ) { return; } wxSize size(-1, -1); if ( width == -1 ) { if ( sizeFlags & wxSIZE_AUTO_WIDTH ) { size = DoGetBestSize(); width = size.x; } else { // just take the current one width = currentW; } } if ( height == -1 ) { if ( sizeFlags & wxSIZE_AUTO_HEIGHT ) { if ( size.x == -1 ) { size = DoGetBestSize(); } //else: already called DoGetBestSize() above height = size.y; } else { // just take the current one height = currentH; } } int maxWidth = GetMaxWidth(), minWidth = GetMinWidth(), maxHeight = GetMaxHeight(), minHeight = GetMinHeight(); if ( minWidth != -1 && width < minWidth ) width = minWidth; if ( maxWidth != -1 && width > maxWidth ) width = maxWidth; if ( minHeight != -1 && height < minHeight ) height = minHeight; if ( maxHeight != -1 && height > maxHeight ) height = maxHeight; if ( m_rect.x != x || m_rect.y != y || m_rect.width != width || m_rect.height != height ) { AdjustForParentClientOrigin(x, y, sizeFlags); DoMoveWindow(x, y, width, height); wxSize newSize(width, height); wxSizeEvent event(newSize, GetId()); event.SetEventObject(this); HandleWindowEvent(event); }}
开发者ID:beanhome,项目名称:dev,代码行数:84,
示例23: GetMinSize virtual wxSize GetMinSize() const { return DoGetBestSize(); }
开发者ID:sydlawrence,项目名称:CorsixTH-HTML5-Port,代码行数:4,
示例24: CalcLayoutvoid wxCustomButton::SetBitmapMargin(const wxSize &margin, bool fit){ m_bitmapMargin = margin; CalcLayout(true); if (fit) SetSize(DoGetBestSize());}
开发者ID:SamanthaClark,项目名称:UI-Builder,代码行数:6,
示例25: GetSizevoid wxSpeedButton::CalcLayout(bool inRefresh) {int i;int bn;int w, h;bool gz, lz;int gx, gy;int lx, ly;// no recursive calls if (mCalcBusy) return; mCalcBusy = true;// current size of the button GetSize(&w,&h); mCurrentSize.Set(w, h);// get sizes of bitmaps and labels, alignment and margin DoGetBestSize();// glyph or label not used? gz = (mGlyphSize.GetWidth() == 0) || (mGlyphSize.GetHeight() == 0); lz = (mLabelSize.GetWidth() == 0) || (mLabelSize.GetHeight() == 0);// border size is a magiv number, imperically determined using the// wxNativeRenderer to draw the button bn = 2;// position depends on alignment i = GetWindowStyleFlag(); if (gz && lz) { // no glyph, no label gx = 0; gy = 0; lx = 0; ly = 0; } else if (gz) { // no glyph, only label gx = 0; gy = 0; lx = (mCurrentSize.GetWidth() - mLabelSize.GetWidth()) / 2; ly = (mCurrentSize.GetHeight() - mLabelSize.GetHeight()) / 2; } else if (lz) { // no label, glyph only gx = (mCurrentSize.GetWidth() - mGlyphSize.GetWidth()) / 2; gy = (mCurrentSize.GetHeight() - mGlyphSize.GetHeight()) / 2; lx = 0; ly = 0; } else if ((i & wxBU_LEFT) != 0) { gx = bn + mMargin; lx = gx + mGlyphSize.GetWidth() + mMargin; gy = (mCurrentSize.GetHeight() - mGlyphSize.GetHeight()) / 2; ly = (mCurrentSize.GetHeight() - mLabelSize.GetHeight()) / 2; } else if ((i & wxBU_RIGHT) != 0) { gx = mCurrentSize.GetWidth() - (mGlyphSize.GetWidth() + mMargin + bn); lx = gx - (mLabelSize.GetWidth() + mMargin); gy = (mCurrentSize.GetHeight() - mGlyphSize.GetHeight()) / 2; ly = (mCurrentSize.GetHeight() - mLabelSize.GetHeight()) / 2; } else if ((i & wxBU_TOP) != 0) { gx = (mCurrentSize.GetWidth() - mGlyphSize.GetWidth()) / 2; lx = (mCurrentSize.GetWidth() - mLabelSize.GetWidth()) / 2; gy = bn + mMargin; ly = gy + mMargin + mGlyphSize.GetHeight(); } else if ((i & wxBU_BOTTOM) != 0) { gx = (mCurrentSize.GetWidth() - mGlyphSize.GetWidth()) / 2; lx = (mCurrentSize.GetWidth() - mLabelSize.GetWidth()) / 2; gy = mCurrentSize.GetHeight() - (bn + mMargin + mGlyphSize.GetHeight()); ly = gy - (mLabelSize.GetHeight() + mMargin); } else { // unknown gx = 0; gy = 0; lx = 0; ly = 0; };// save the positions mGlyphPos.x = gx; mGlyphPos.y = gy; mLabelPos.x = lx; mLabelPos.y = ly;// redraw button? if (inRefresh) Refresh(false);// allow another call mCalcBusy = false;}
开发者ID:WinterMute,项目名称:codeblocks_sf,代码行数:100,
示例26: NewControlIdbool wxSpinButton::Create( wxWindow* pParent, wxWindowID vId, const wxPoint& rPos, const wxSize& rSize, long lStyle, const wxString& rsName){ int nX = rPos.x; int nY = rPos.y; int nWidth = rSize.x; int nHeight = rSize.y; SWP vSwp; m_min = 0; m_max = 100; if (vId == -1) m_windowId = NewControlId(); else m_windowId = vId; if (pParent) { m_backgroundColour = pParent->GetBackgroundColour(); m_foregroundColour = pParent->GetForegroundColour(); } SetName(rsName); SetParent(pParent); m_windowStyle = lStyle; // // Get the right size for the control // if (nWidth <= 0 || nHeight <= 0 ) { wxSize vSize = DoGetBestSize(); if (nWidth <= 0 ) nWidth = vSize.x; if (nHeight <= 0 ) nHeight = vSize.y; } if (nX < 0 ) nX = 0; if (nY < 0 ) nY = 0; long lSstyle = 0L; lSstyle = WS_VISIBLE | WS_TABSTOP | SPBS_MASTER | // We use only single field spin buttons SPBS_NUMERICONLY; // We default to numeric data if (m_windowStyle & wxCLIP_SIBLINGS ) lSstyle |= WS_CLIPSIBLINGS; m_hWnd = (WXHWND)::WinCreateWindow( GetWinHwnd(pParent) ,WC_SPINBUTTON ,(PSZ)NULL ,lSstyle ,0L, 0L, 0L, 0L ,GetWinHwnd(pParent) ,HWND_TOP ,(HMENU)vId ,NULL ,NULL ); if (m_hWnd == 0) { return FALSE; } SetRange(m_min, m_max); if(pParent) pParent->AddChild((wxSpinButton *)this); ::WinQueryWindowPos(m_hWnd, &vSwp); SetXComp(vSwp.x); SetYComp(vSwp.y-5); // compensate for the associated TextControl border SetFont(*wxSMALL_FONT); // // For OS/2 we want to hide the text portion so we can substitute an // independent text ctrl in its place. // Therefore we must override any user given width with our best guess. // SetSize( nX - GetXComp() ,nY - GetYComp() ,nWidth ,nHeight ); wxAssociateWinWithHandle( m_hWnd ,(wxWindowOS2*)this );#if 0 // FIXME: // Apparently, this does not work, as it crashes in setvalue/setrange calls // What's it supposed to do anyway? ::WinSetWindowULong(GetHwnd(), QWL_USER, (LONG)this); fnWndProcSpinCtrl = (WXFARPROC)::WinSubclassWindow(m_hWnd, (PFNWP)wxSpinCtrlWndProc);//.........这里部分代码省略.........
开发者ID:esrrhs,项目名称:fuck-music-player,代码行数:101,
示例27: wxScrollBarbool wxFixWidthImportCtrl::Create(wxWindow *parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style, const wxString& name){ if ( !wxControl::Create(parent, id, pos, size, style, wxDefaultValidator, name) ) { return false; } //Create the scroll bars m_scrbarH = new wxScrollBar(this, FW_SCROH); m_scrbarV = new wxScrollBar(this, FW_SCROV, wxDefaultPosition, wxDefaultSize, wxSB_VERTICAL); if (!m_scrbarH || !m_scrbarV) return false; m_margin = 2; m_sbHheigth = m_scrbarH->GetSize().GetHeight(); m_sbVwidth = m_scrbarV->GetSize().GetWidth(); //Fonts we'll use are some more big and small than default's one int pointsizeDef = GetFont().GetPointSize(); //A fixed pitch font for the file (a little bigger) m_Ffont = wxTheFontList->FindOrCreateFont((int)(pointsizeDef * 1.13), wxMODERN, wxNORMAL, wxNORMAL); //The font for the scale, also a pitch font (a little smaller) m_Sfont = wxTheFontList->FindOrCreateFont((int)(pointsizeDef * 0.88), wxMODERN, wxNORMAL, wxNORMAL); //Size wxSize sizeReal; if ( size.x == -1 || size.y == -1 ) { sizeReal = DoGetBestSize(); if ( size.x != -1 ) sizeReal.x = size.x; if ( size.y != -1 ) sizeReal.y = size.y; } else { sizeReal = size; } //SetSize calls DoMoveWindow, which sets sub-controls size & position SetSize(pos.x, pos.y, sizeReal.x, sizeReal.y); m_curposX = m_curposL = m_markedL = m_LAct = 0; m_delPrev = false; m_captured = false; m_timeInit = m_timeNow = 0; m_lastType = 0; deliEnabled = true; return true;}
开发者ID:maxmods,项目名称:wx.mod,代码行数:64,
注:本文中的DoGetBestSize函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ DoLayout函数代码示例 C++ DoEventIfAny函数代码示例 |