Logo Search packages:      
Sourcecode: codeblocks version File versions  Download package

void wxPropertyGrid::FixPosForTextCtrl ( wxWindow *  ctrl )

Fixes position of wxTextCtrl-like control (wxSpinCtrl usually fits as one). Call after control has been created (but before shown).

Definition at line 4834 of file propgrid.cpp.

Referenced by GenerateEditorTextCtrl().

{
    // Center the control vertically
    wxRect finalPos = ctrl->GetRect();
    int y_adj = (m_lineHeight - finalPos.height)/2 + wxPG_TEXTCTRLYADJUST;

    // Prevent over-sized control
    int sz_dec = (y_adj + finalPos.height) - m_lineHeight;
    if ( sz_dec < 0 ) sz_dec = 0;

    finalPos.y += y_adj;
    finalPos.height -= (y_adj+sz_dec);

    // STUPID HACK: wxTextCtrl has different indentation with different
    //   fonts, so this is to solve most common case (ie. using MS Shell Dlg 2
    //   or Tahoma - which are usually the same).
/*#ifdef __WXMSW__
    wxString faceName = m_font.GetFaceName();
    int textCtrlXAdjust = wxPG_TEXTCTRLXADJUST;
    if ( (faceName == wxT("MS Shell Dlg 2") ||
          faceName == wxT("Tahoma")) &&
          m_font.GetWeight() != wxFONTWEIGHT_BOLD )
        textCtrlXAdjust = 0;
#else*/
    const int textCtrlXAdjust = wxPG_TEXTCTRLXADJUST;
//#endif

    finalPos.x += textCtrlXAdjust;
    finalPos.width -= textCtrlXAdjust;

    ctrl->SetSize(finalPos);
}

Here is the caller graph for this function:


Generated by  Doxygen 1.6.0   Back to index