本文整理汇总了C++中GetTextPeer函数的典型用法代码示例。如果您正苦于以下问题:C++ GetTextPeer函数的具体用法?C++ GetTextPeer怎么用?C++ GetTextPeer使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了GetTextPeer函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: wxCHECK_RET
void wxTextEntry::Cut()
{
wxCHECK_RET( GetTextPeer(), "Must create the control first" );
if (CanCut())
GetTextPeer()->Cut() ;
}
示例2: GetTextPeer
bool wxTextCtrl::SetStyle(long start, long end, const wxTextAttr& style)
{
if (GetTextPeer())
GetTextPeer()->SetStyle( start , end , style ) ;
return true ;
}
示例3: wxCHECK_MSG
bool wxTextEntry::CanRedo() const
{
if ( !IsEditable() )
return false ;
wxCHECK_MSG( GetTextPeer(), false, "Must create the control first" );
return GetTextPeer()->CanRedo() ;
}
示例4: SetHint
bool wxTextCtrl::SetHint(const wxString& hint)
{
m_hintString = hint;
if ( GetTextPeer() && GetTextPeer()->SetHint(hint) )
return true;
return false;
}
示例5: OnContextMenu
void wxTextCtrl::OnContextMenu(wxContextMenuEvent& event)
{
if ( GetTextPeer()->HasOwnContextMenu() )
{
event.Skip() ;
return ;
}
#if wxUSE_MENUS
if (m_privateContextMenu == NULL)
{
m_privateContextMenu = new wxMenu;
m_privateContextMenu->Append(wxID_UNDO, _("&Undo"));
m_privateContextMenu->Append(wxID_REDO, _("&Redo"));
m_privateContextMenu->AppendSeparator();
m_privateContextMenu->Append(wxID_CUT, _("Cu&t"));
m_privateContextMenu->Append(wxID_COPY, _("&Copy"));
m_privateContextMenu->Append(wxID_PASTE, _("&Paste"));
m_privateContextMenu->Append(wxID_CLEAR, _("&Delete"));
m_privateContextMenu->AppendSeparator();
m_privateContextMenu->Append(wxID_SELECTALL, _("Select &All"));
}
PopupMenu(m_privateContextMenu);
#endif
}
示例6: MacSetupCursor
bool wxTextCtrl::MacSetupCursor( const wxPoint& pt )
{
if ( !GetTextPeer()->SetupCursor( pt ) )
return wxWindow::MacSetupCursor( pt ) ;
else
return true ;
}
示例7: DontCreatePeer
bool wxTextCtrl::Create( wxWindow *parent,
wxWindowID id,
const wxString& str,
const wxPoint& pos,
const wxSize& size,
long style,
const wxValidator& validator,
const wxString& name )
{
DontCreatePeer();
m_editable = true ;
if ( ! (style & wxNO_BORDER) )
style = (style & ~wxBORDER_MASK) | wxSUNKEN_BORDER ;
if ( !wxTextCtrlBase::Create( parent, id, pos, size, style & ~(wxHSCROLL | wxVSCROLL), validator, name ) )
return false;
if ( m_windowStyle & wxTE_MULTILINE )
{
// always turn on this style for multi-line controls
m_windowStyle |= wxTE_PROCESS_ENTER;
style |= wxTE_PROCESS_ENTER ;
}
SetPeer(wxWidgetImpl::CreateTextControl( this, GetParent(), GetId(), str, pos, size, style, GetExtraStyle() ));
MacPostControlCreate(pos, size) ;
#if wxOSX_USE_COCOA
// under carbon everything can already be set before the MacPostControlCreate embedding takes place
// but under cocoa for single line textfields this only works after everything has been set up
GetTextPeer()->SetStringValue(str);
#endif
// only now the embedding is correct and we can do a positioning update
MacSuperChangedPosition() ;
if ( m_windowStyle & wxTE_READONLY)
SetEditable( false ) ;
SetCursor( wxCursor( wxCURSOR_IBEAM ) ) ;
return true;
}
示例8: GetTextPeer
void wxTextCtrl::OSXEnableAutomaticDashSubstitution(bool enable)
{
GetTextPeer()->EnableAutomaticDashSubstitution(enable);
}
示例9: OnChar
void wxTextCtrl::OnChar(wxKeyEvent& event)
{
int key = event.GetKeyCode() ;
bool eat_key = false ;
long from, to;
if ( !IsEditable() && !event.IsKeyInCategory(WXK_CATEGORY_ARROW | WXK_CATEGORY_TAB) &&
!( key == WXK_RETURN && ( (m_windowStyle & wxTE_PROCESS_ENTER) || (m_windowStyle & wxTE_MULTILINE) ) )
// && key != WXK_PAGEUP && key != WXK_PAGEDOWN && key != WXK_HOME && key != WXK_END
)
{
// eat it
return ;
}
if ( !GetTextPeer()->CanClipMaxLength() )
{
// Check if we have reached the max # of chars (if it is set), but still
// allow navigation and deletion
GetSelection( &from, &to );
if ( !IsMultiLine() && m_maxLength && GetValue().length() >= m_maxLength &&
!event.IsKeyInCategory(WXK_CATEGORY_ARROW | WXK_CATEGORY_TAB | WXK_CATEGORY_CUT) &&
!( key == WXK_RETURN && (m_windowStyle & wxTE_PROCESS_ENTER) ) &&
from == to )
{
// eat it, we don't want to add more than allowed # of characters
// TODO: generate EVT_TEXT_MAXLEN()
return;
}
}
// assume that any key not processed yet is going to modify the control
m_dirty = true;
switch ( key )
{
case WXK_RETURN:
if (m_windowStyle & wxTE_PROCESS_ENTER)
{
wxCommandEvent event(wxEVT_TEXT_ENTER, m_windowId);
event.SetEventObject( this );
event.SetString( GetValue() );
if ( HandleWindowEvent(event) )
return;
}
if ( !(m_windowStyle & wxTE_MULTILINE) )
{
wxTopLevelWindow *tlw = wxDynamicCast(wxGetTopLevelParent(this), wxTopLevelWindow);
if ( tlw && tlw->GetDefaultItem() )
{
wxButton *def = wxDynamicCast(tlw->GetDefaultItem(), wxButton);
if ( def && def->IsEnabled() )
{
wxCommandEvent event(wxEVT_BUTTON, def->GetId() );
event.SetEventObject(def);
def->Command(event);
return ;
}
}
// this will make wxWidgets eat the ENTER key so that
// we actually prevent line wrapping in a single line text control
eat_key = true;
}
break;
case WXK_TAB:
if ( !(m_windowStyle & wxTE_PROCESS_TAB))
{
int flags = 0;
if (!event.ShiftDown())
flags |= wxNavigationKeyEvent::IsForward ;
if (event.ControlDown())
flags |= wxNavigationKeyEvent::WinChange ;
Navigate(flags);
return;
}
else
{
// This is necessary (don't know why);
// otherwise the tab will not be inserted.
WriteText(wxT("\t"));
eat_key = true;
}
break;
default:
break;
}
if (!eat_key)
{
// perform keystroke handling
event.Skip(true) ;
}
//.........这里部分代码省略.........
示例10: GetTextPeer
bool wxTextEntry::SetHint(const wxString& hint)
{
m_hintString = hint;
return GetTextPeer() && GetTextPeer()->SetHint(hint);
}