more files added
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/wxUNIVERSAL@8103 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
79
src/univ/control.cpp
Normal file
79
src/univ/control.cpp
Normal file
@@ -0,0 +1,79 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: src/univ/control.cpp
|
||||
// Purpose: universal wxControl: adds handling of mnemonics
|
||||
// Author: Vadim Zeitlin
|
||||
// Modified by:
|
||||
// Created: 14.08.00
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) 2000 Vadim Zeitlin <vadim@wxwindows.org>
|
||||
// Licence: wxWindows license
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// ============================================================================
|
||||
// declarations
|
||||
// ============================================================================
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma implementation "control.h"
|
||||
#endif
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// headers
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
#include "wx/wxprec.h"
|
||||
|
||||
#ifdef __BORLANDC__
|
||||
#pragma hdrstop
|
||||
#endif
|
||||
|
||||
#if wxUSE_CONTROLS
|
||||
|
||||
#ifndef WX_PRECOMP
|
||||
#include "wx/control.h"
|
||||
#endif
|
||||
|
||||
// ============================================================================
|
||||
// implementation
|
||||
// ============================================================================
|
||||
|
||||
IMPLEMENT_DYNAMIC_CLASS(wxControl, wxWindow)
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// creation
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
wxControl::wxControl()
|
||||
{
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// mnemonics handling
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
void wxControl::SetLabel( const wxString &label )
|
||||
{
|
||||
// the character following MNEMONIC_PREFIX is the accelerator for this
|
||||
// control unless it is MNEMONIC_PREFIX too - this allows to insert
|
||||
// literal MNEMONIC_PREFIX chars into the label
|
||||
static const wxChar MNEMONIC_PREFIX = _T('&');
|
||||
|
||||
m_label.Empty();
|
||||
for ( const wxChar *pc = label; *pc != wxT('\0'); pc++ )
|
||||
{
|
||||
if ( *pc == MNEMONIC_PREFIX )
|
||||
{
|
||||
pc++; // skip it
|
||||
if ( *pc != MNEMONIC_PREFIX )
|
||||
m_chAccel = *pc;
|
||||
}
|
||||
m_label << *pc;
|
||||
}
|
||||
}
|
||||
|
||||
wxString wxControl::GetLabel() const
|
||||
{
|
||||
return m_label;
|
||||
}
|
||||
|
||||
#endif // wxUSE_CONTROLS
|
Reference in New Issue
Block a user