本文整理汇总了C++中wxChar函数的典型用法代码示例。如果您正苦于以下问题:C++ wxChar函数的具体用法?C++ wxChar怎么用?C++ wxChar使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了wxChar函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: OpenProjectFiles
bool GERBVIEW_FRAME::OpenProjectFiles( const std::vector<wxString>& aFileSet, int aCtl )
{
// The current project path is also a valid command parameter. Check if a single path
// rather than a file name was passed to GerbView and use it as the initial MRU path.
if( aFileSet.size() > 0 )
{
wxString path = aFileSet[0];
// For some reason wxApp appears to leave the trailing double quote on quoted
// parameters which are required for paths with spaces. Maybe this should be
// pushed back into PGM_SINGLE_TOP::OnPgmInit() but that may cause other issues.
// We can't buy a break!
if( path.Last() == wxChar( '\"' ) )
path.RemoveLast();
if( !wxFileExists( path ) && wxDirExists( path ) )
{
wxLogDebug( wxT( "MRU path: %s." ), GetChars( path ) );
m_mruPath = path;
return true;
}
const unsigned limit = std::min( unsigned( aFileSet.size() ),
unsigned( GERBER_DRAWLAYERS_COUNT ) );
int layer = 0;
for( unsigned i=0; i<limit; ++i, ++layer )
{
setActiveLayer( layer );
// Try to guess the type of file by its ext
// if it is .drl (Kicad files), it is a drill file
wxFileName fn( aFileSet[i] );
wxString ext = fn.GetExt();
if( ext == "drl" )
LoadExcellonFiles( aFileSet[i] );
else
LoadGerberFiles( aFileSet[i] );
}
}
Zoom_Automatique( true ); // Zoom fit in frame
UpdateTitleAndInfo();
return true;
}
示例2: GetFirstSelected
wxString FOOTPRINTS_LISTBOX::GetSelectedFootprint()
{
wxString footprintName;
int ii = GetFirstSelected();
if( ii >= 0 )
{
wxString msg = m_footprintList[ii];
msg.Trim( true );
msg.Trim( false );
footprintName = msg.AfterFirst( wxChar( ' ' ) );
}
return footprintName;
}
示例3: GetSelectedItem
void MenuEditor::OnMenuRight(wxCommandEvent& )
{
int sel = GetSelectedItem();
int curIdent = GetItemIdentation(sel) + 1;
int parentIdent = sel > 0 ? GetItemIdentation(sel - 1) : -1;
if (parentIdent == -1 || abs(curIdent - parentIdent) > 1)
return;
wxString label = m_menuList->GetItemText(sel);
label.Trim(true);
label.Trim(false);
label = wxString(wxChar(' '), curIdent * IDENTATION) + label;
m_menuList->SetItemText(sel, label);
}
示例4: peek
TemplateParser::Ident TemplateParser::ParseIdent()
{
Ident ident = ID_ERROR;
if (!m_in.Eof())
{
wxString macro;
m_in.GetC();
wxChar peek( m_in.Peek() );
while (peek != wxChar(EOF) && !m_in.Eof() && peek != wxT('#') && peek != wxT('$')
&& ( (peek >= wxT('a') && peek <= wxT('z') ) ||
(peek >= wxT('A') && peek <= wxT('Z') ) ||
(peek >= wxT('0') && peek <= wxT('9') ) ))
{
macro += wxChar( m_in.GetC() );
peek = wxChar( m_in.Peek() );
}
// Searching the identifier
ident = SearchIdent( macro );
}
return ident;
}
示例5: CreateText
void TextCtrlTestCase::LongText()
{
// This test is only possible under MSW as in the other ports
// SetMaxLength() can't be used with multi line text controls.
#ifdef __WXMSW__
delete m_text;
CreateText(wxTE_MULTILINE|wxTE_DONTWRAP);
const int numLines = 1000;
const int lenPattern = 100;
int i;
// Pattern for the line.
wxChar linePattern[lenPattern+1];
for (i = 0; i < lenPattern - 1; i++)
{
linePattern[i] = wxChar('0' + i % 10);
}
linePattern[WXSIZEOF(linePattern) - 1] = wxChar('\0');
// Fill the control.
m_text->SetMaxLength(15000);
for (i = 0; i < numLines; i++)
{
m_text->AppendText(wxString::Format(wxT("[%3d] %s\n"), i, linePattern));
}
// Check the content.
for (i = 0; i < numLines; i++)
{
wxString pattern = wxString::Format(wxT("[%3d] %s"), i, linePattern);
wxString line = m_text->GetLineText(i);
CPPUNIT_ASSERT_EQUAL( line, pattern );
}
#endif // __WXMSW__
}
示例6: TowxString
void ServerEvents::OnMutelistItem(const std::string& /*unused*/, const std::string& mutee, const std::string& description)
{
wxString message = TowxString(mutee);
wxString desc = TowxString(description);
wxString mutetime = desc.AfterFirst(wxChar(' '));
long time;
if (mutetime == _T("indefinite"))
message << _(" indefinite time remaining");
else if (mutetime.ToLong(&time))
message << wxString::Format(_(" %d minutes remaining"), time / 60 + 1);
else
message << mutetime;
if (!desc.IsEmpty())
message << _T(", ") << desc;
mutelistWindow(message);
}
示例7: findNextComponent
SCH_COMPONENT* NETLIST_EXPORTER::findNextComponent( EDA_ITEM* aItem, SCH_SHEET_PATH* aSheetPath )
{
wxString ref;
// continue searching from the middle of a linked list (the draw list)
for( ; aItem; aItem = aItem->Next() )
{
if( aItem->Type() != SCH_COMPONENT_T )
continue;
// found next component
SCH_COMPONENT* comp = (SCH_COMPONENT*) aItem;
// Power symbols and other components which have the reference starting
// with "#" are not included in netlist (pseudo or virtual components)
ref = comp->GetRef( aSheetPath->Last() );
if( ref[0] == wxChar( '#' ) )
continue;
// if( Component->m_FlagControlMulti == 1 )
// continue; /* yes */
// removed because with multiple instances of one schematic
// (several sheets pointing to 1 screen), this will be erroneously be
// toggled.
LIB_PART* part = m_libs->FindLibPart( comp->GetPartName() );
if( !part )
continue;
// If component is a "multi parts per package" type
if( part->GetUnitCount() > 1 )
{
// test if this reference has already been processed, and if so skip
if( m_ReferencesAlreadyFound.Lookup( ref ) )
continue;
}
// record the usage of this library component entry.
m_LibParts.insert( part ); // rejects non-unique pointers
return comp;
}
return NULL;
}
示例8: wxASSERT
void CUtils::dump(const wxChar* title, const unsigned char* data, unsigned int length)
{
wxASSERT(title != NULL);
wxASSERT(data != NULL);
wxLogMessage(wxT("%s"), title);
unsigned int offset = 0U;
while (length > 0U) {
wxString output;
unsigned int bytes = (length > 16U) ? 16U : length;
for (unsigned i = 0U; i < bytes; i++) {
wxString temp;
temp.Printf(wxT("%02X "), data[offset + i]);
output += temp;
}
for (unsigned int i = bytes; i < 16U; i++)
output += wxT(" ");
output += wxT(" *");
for (unsigned i = 0U; i < bytes; i++) {
unsigned char c = data[offset + i];
if (::isprint(c))
output += wxChar(c);
else
output += wxT('.');
}
output += wxT('*');
wxLogMessage(wxT("%04X: %s"), offset, output.c_str());
offset += 16U;
if (length >= 16U)
length -= 16U;
else
length = 0U;
}
}
示例9: FirstChar
bool wxsCorrector::FixVarName(wxString& Name)
{
wxString Corrected;
Name.Trim(true);
Name.Trim(false);
if ( !Name.empty() )
{
// Validating name as C++ ideentifier
// TODO: Other languages ?
static wxString FirstChar(
_T("ABCDEFGHIJKLMNOPQRSTUVWXYZ")
_T("abcdefghijklmnopqrstuvwxyz")
_T("_"));
if ( FirstChar.Find(Name.GetChar(0)) == -1 )
Manager::Get()->GetLogManager()->DebugLog(F(_T("wxSmith: Variable name : \"%s\" is not a valid c++ identifier (invalid character \"%c\" at position %d)"),Name.wx_str(),wxChar(Name.GetChar(0)),0));
else
Corrected.Append(Name.GetChar(0));
static wxString NextChars(
_T("0123456789")
_T("ABCDEFGHIJKLMNOPQRSTUVWXYZ")
_T("abcdefghijklmnopqrstuvwxyz")
_T("_"));
for ( size_t i=1; i<Name.Length(); ++i )
{
if ( NextChars.Find(Name.GetChar(i)) == -1 )
{
Manager::Get()->GetLogManager()->DebugLog(F(_T("wxSmith: Variable name : \"%s\" is not a valid c++ identifier (invalid character \"%c\" at position %lu)"),
Name.wx_str(),
wxChar(Name.GetChar(i)),
static_cast<unsigned long>(i)));
}
else
Corrected.Append(Name.GetChar(i));
}
}
bool Diff = Name != Corrected;
Name = Corrected;
return Diff;
}
示例10: Code128PackDigits
static wxString Code128PackDigits(const wxString& text, size_t& textIndex, int numDigits)
{
wxString code = wxEmptyString;
while (numDigits > 0)
{
if (text[textIndex] == CODE128_FNC1)
{
code += CODE128_FNC1_INDEX;
++textIndex;
continue;
}
numDigits -= 2;
int c1 = text[textIndex++] - wxT('0');
int c2 = text[textIndex++] - wxT('0');
code += wxChar(c1 * 10 + c2);
}
return code;
}
示例11: wxT
wxString
wxPdfFontDetails::CreateSubsetPrefix() const
{
wxString prefix = wxT("WXP");
int k;
int code = m_index;
for (k = 0; k < 3; k++)
{
#if wxCHECK_VERSION(2,9,0)
prefix += wxUniChar(wxT('A' + (code % 26)));
#else
prefix += wxChar(wxT('A' + (code % 26)));
#endif
code /= 26;
}
prefix += wxT("+");
return prefix;
}
示例12: defined
strStream::strStream()
{
static const size_t LEN = 256;
m_str.reserve(LEN);
#if defined(__INTEL_COMPILER) && 1 /* VDM auto patch */
# pragma ivdep
# pragma swp
# pragma unroll
# pragma prefetch
# if 0
# pragma simd noassert
# endif
#endif /* VDM auto patch */
for ( size_t n = 0; n < LEN; n++ )
{
m_str += wxChar(wxT('A') + n % (wxT('Z') - wxT('A') + 1));
}
}
示例13: BAD
bool nwxString::FileNameStringOK(const wxString &s)
{
const wxString BAD("<>:\"/\\|?*'`");
size_t nLen = s.Len();
size_t i;
wxChar x;
bool bRtn = true;
for(i = 0; i < nLen; i++)
{
x = s.GetChar(i);
if( (x & 0x80) || (x < wxChar(' ')) || (BAD.find(x) != (size_t)wxNOT_FOUND) )
{
bRtn = false;
i = nLen;
}
}
return bRtn;
}
示例14: wxUnusedVar
wxString
wxPdfFontDataCore::ConvertCID2GID(const wxString& s,
const wxPdfEncoding* encoding,
wxPdfSortedArrayInt* usedGlyphs,
wxPdfChar2GlyphMap* subsetGlyphs) const
{
// No conversion from cid to gid
wxUnusedVar(usedGlyphs);
wxUnusedVar(subsetGlyphs);
#if wxUSE_UNICODE
const wxPdfChar2GlyphMap* convMap = FindEncodingMap(encoding);
wxString t;
if (convMap != NULL)
{
wxPdfChar2GlyphMap::const_iterator charIter;
wxString::const_iterator ch;
for (ch = s.begin(); ch != s.end(); ++ch)
{
charIter = (*convMap).find(*ch);
if (charIter != (*convMap).end())
{
#if wxCHECK_VERSION(2,9,0)
t.Append(wxUniChar(charIter->second));
#else
t.Append(wxChar(charIter->second));
#endif
}
else
{
t += wxT("?");
}
}
}
else
{
t = s;
}
return t;
#else
// Return unchanged string in ANSI build
wxUnusedVar(encoding);
return s;
#endif
}
示例15: if
PlatformKeyboardEvent::PlatformKeyboardEvent(wxKeyEvent& event)
{
if (event.GetEventType() == wxEVT_KEY_UP)
m_type = PlatformEvent::KeyUp;
else if (event.GetEventType() == wxEVT_KEY_DOWN)
m_type = PlatformEvent::KeyDown;
else if (event.GetEventType() == wxEVT_CHAR)
m_type = PlatformEvent::Char;
else
ASSERT_NOT_REACHED();
if (m_type != PlatformEvent::Char)
m_keyIdentifier = keyIdentifierForWxKeyCode(event.GetKeyCode());
else {
//ENTER is an editing command processed as a char (only Enter and Tab are)
//unfortunately the unicode key for numpad_enter (370) is NOT what we want here (13)
//The unicode values for normal enter and tab are the same as the ASCII values, thus ok
//Note that I think this a wx bug, as the Character Code is actually 13 when
//numpad_enter is a CHAR event.
if (event.GetKeyCode() == 13 && event.GetUnicodeKey() == wxChar(370))
m_text = "\r";
else
m_text = wxString(event.GetUnicodeKey());
m_unmodifiedText = m_text;
}
m_autoRepeat = false; // FIXME: not correct.
m_windowsVirtualKeyCode = windowsKeyCodeForKeyEvent(event.GetKeyCode());
m_nativeVirtualKeyCode = event.GetKeyCode();
m_isKeypad = (event.GetKeyCode() >= WXK_NUMPAD_SPACE) && (event.GetKeyCode() <= WXK_NUMPAD_DIVIDE);
m_modifiers = 0;
if (event.ShiftDown())
m_modifiers |= ShiftKey;
if (event.CmdDown())
m_modifiers |= CtrlKey;
if (event.AltDown())
m_modifiers |= AltKey;
if (event.MetaDown())
m_modifiers |= MetaKey;
m_timestamp = WTF::currentTime();
}