• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ wxString类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中wxString的典型用法代码示例。如果您正苦于以下问题:C++ wxString类的具体用法?C++ wxString怎么用?C++ wxString使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了wxString类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: runTestMr

void modeltest::runTestMr(wxCommandEvent& event)
{
	wxString cmd, pa;
	wxArrayString output, errors;
	string cmdstr;

	if(fileSelectedMr == "")
	{
		wxMessageBox("Please select a file before running. \nClick on Select File button");
	}
	else
	{

#ifdef __WXMSW__
		ofstream batchfile("mr.bat");
		cmd = mrModelP;
		cmd.Append("\"");
#else
		ofstream batchfile("mr.sh");
		cmd = "mrmodeltest2 ";
#endif
		/*if(debugL > 0)
		{
			cmd += " -d";
			dL = debugL;
			pa.Printf("%d", dL);
			cmd += pa;
		}
		if(alphaL > 0)
		{
			cmd += " -a";
			pa.Printf("%lf", alphaL);
			cmd += pa;	
		}
		if(sampleSize > 0)
		{
			cmd += " -c";
			sS = sampleSize;
			pa.Printf("%d", sS);
			cmd += pa;
		}
		if(numberTaxa > 0)
		{
			cmd += " -t";
			nT = numberTaxa;
			pa.Printf("%d", nT);
			cmd += pa;
		}*/
		cmd += " < ";
		if(filePathSelectedMr == "")
		{
			filePathSelectedMr = fileSelectedMr;
		}
		
#ifdef __WXMSW__
		filePathSelectedMr.Append("\"");
		filePathSelectedMr.Prepend("\"");
		cmd.Prepend("\"");
#endif
		cmd += filePathSelectedMr;
		cmdstr = cmd;
		batchfile << cmdstr;
		batchfile.close();
#ifdef __WXMSW__
		long exec = wxExecute("mr.bat", output, errors);
#else
		long exec = wxExecute("bash mr.sh", output, errors);
#endif
		this->outputText->WriteText("\n");
		this->outputText->WriteText(cmd);
		this->outputText->WriteText("\n");
		int count = output.GetCount();
		for ( size_t n = 0; n < count; n++ )
		{
	        	this->outputText->WriteText(output[n]);
			this->outputText->WriteText("\n");
				this->inNexus->Enable(true);
				//this->saveScores->Enable(true);
		}
		count = errors.GetCount();
		for ( size_t n = 0; n < count; n++ )
		{
	        	this->outputText->WriteText(errors[n]);
			this->outputText->WriteText("\n");
		}
		this->outputText->WriteText("\n\nMTgui designed by Paulo Nuin.\nMore info email me at [email protected]");
	}
	debugL = 0;
	alphaL = 0; 
	sampleSize = 0;
	numberTaxa = 0;
}
开发者ID:nuin,项目名称:MrMTgui,代码行数:92,代码来源:mtgui.cpp


示例2: XML_ParserCreate

bool wxXmlDocument::Load(wxInputStream& stream, const wxString& encoding, int flags)
{
#if wxUSE_UNICODE
    (void)encoding;
#else
    m_encoding = encoding;
#endif

    const size_t BUFSIZE = 1024;
    char buf[BUFSIZE];
    wxXmlParsingContext ctx;
    bool done;
    XML_Parser parser = XML_ParserCreate(NULL);

    ctx.root = ctx.node = NULL;
    ctx.encoding = wxT("UTF-8"); // default in absence of encoding=""
    ctx.conv = NULL;
#if !wxUSE_UNICODE
    if ( encoding.CmpNoCase(wxT("UTF-8")) != 0 )
        ctx.conv = new wxCSConv(encoding);
#endif
    ctx.removeWhiteOnlyNodes = (flags & wxXMLDOC_KEEP_WHITESPACE_NODES) == 0;

    XML_SetUserData(parser, (void*)&ctx);
    XML_SetElementHandler(parser, StartElementHnd, EndElementHnd);
    XML_SetCharacterDataHandler(parser, TextHnd);
    XML_SetStartCdataSectionHandler(parser, StartCdataHnd);
    XML_SetCommentHandler(parser, CommentHnd);
    XML_SetDefaultHandler(parser, DefaultHnd);
    XML_SetUnknownEncodingHandler(parser, UnknownEncodingHnd, NULL);

    bool ok = true;
    do
    {
        size_t len = stream.Read(buf, BUFSIZE).LastRead();
        done = (len < BUFSIZE);
        if (!XML_Parse(parser, buf, len, done))
        {
            wxString error(XML_ErrorString(XML_GetErrorCode(parser)),
                           *wxConvCurrent);
            wxLogError(_("XML parsing error: '%s' at line %d"),
                       error.c_str(),
                       XML_GetCurrentLineNumber(parser));
            ok = false;
            break;
        }
    } while (!done);

    if (ok)
    {
        if (!ctx.version.empty())
            SetVersion(ctx.version);
        if (!ctx.encoding.empty())
            SetFileEncoding(ctx.encoding);
        SetRoot(ctx.root);
    }
    else
    {
        delete ctx.root;
    }

    XML_ParserFree(parser);
#if !wxUSE_UNICODE
    if ( ctx.conv )
        delete ctx.conv;
#endif

    return ok;

}
开发者ID:AlexHayton,项目名称:decoda,代码行数:70,代码来源:xml.cpp


示例3: FindNextSymbol

int wxStringFormatter::FindNextSymbol(wxString input)
{
	return input.find_first_of(m_symbolDelims);
}
开发者ID:stahta01,项目名称:wxCode_components,代码行数:4,代码来源:stringformatter.cpp


示例4: Create

bool wxWebViewWebKit::Create(wxWindow *parent,
                      wxWindowID id,
                      const wxString &url,
                      const wxPoint& pos,
                      const wxSize& size,
                      long style,
                      const wxString& name)
{
    m_busy = false;
    m_guard = false;
    m_creating = false;
    FindClear();

    // We currently unconditionally impose scrolling in both directions as it's
    // necessary to show arbitrary pages.
    style |= wxHSCROLL | wxVSCROLL;

    if (!PreCreation( parent, pos, size ) ||
        !CreateBase( parent, id, pos, size, style, wxDefaultValidator, name ))
    {
        wxFAIL_MSG( wxT("wxWebViewWebKit creation failed") );
        return false;
    }

    m_web_view = WEBKIT_WEB_VIEW(webkit_web_view_new());
    GTKCreateScrolledWindowWith(GTK_WIDGET(m_web_view));
    g_object_ref(m_widget);

    g_signal_connect_after(m_web_view, "navigation-policy-decision-requested",
                           G_CALLBACK(wxgtk_webview_webkit_navigation),
                           this);
    g_signal_connect_after(m_web_view, "load-error",
                           G_CALLBACK(wxgtk_webview_webkit_error),
                           this);

    g_signal_connect_after(m_web_view, "new-window-policy-decision-requested",
                           G_CALLBACK(wxgtk_webview_webkit_new_window), this);

    g_signal_connect_after(m_web_view, "title-changed",
                           G_CALLBACK(wxgtk_webview_webkit_title_changed), this);

    g_signal_connect_after(m_web_view, "resource-request-starting",
                           G_CALLBACK(wxgtk_webview_webkit_resource_req), this);
      
#if WEBKIT_CHECK_VERSION(1, 10, 0)    
     g_signal_connect_after(m_web_view, "context-menu",
                           G_CALLBACK(wxgtk_webview_webkit_context_menu), this);
#endif
     
     g_signal_connect_after(m_web_view, "create-web-view",
                           G_CALLBACK(wxgtk_webview_webkit_create_webview), this);

    m_parent->DoAddChild( this );

    PostCreation(size);

    /* Open a webpage */
    webkit_web_view_load_uri(m_web_view, url.utf8_str());

    //Get the initial history limit so we can enable and disable it later
    WebKitWebBackForwardList* history;
    history = webkit_web_view_get_back_forward_list(m_web_view);
    m_historyLimit = webkit_web_back_forward_list_get_limit(history);

    // last to avoid getting signal too early
    g_signal_connect_after(m_web_view, "notify::load-status",
                           G_CALLBACK(wxgtk_webview_webkit_load_status),
                           this);

    return true;
}
开发者ID:0ryuO,项目名称:dolphin-avsync,代码行数:71,代码来源:webview_webkit.cpp


示例5: GetParamValue

int wxSizerXmlHandler::GetSizerFlags()
{
    const wxString s = GetParamValue(wxS("flag"));
    if ( s.empty() )
        return 0;

    // Parse flags keeping track of invalid combinations. This is somewhat
    // redundant with the checks performed in wxSizer subclasses themselves but
    // doing it here allows us to give the exact line number at which the
    // offending line numbers are given, which is very valuable.
    //
    // We also can detect invalid flags combinations involving wxALIGN_LEFT and
    // wxALIGN_TOP here, while this is impossible at wxSizer level as both of
    // these flags have value of 0.


    // As the logic is exactly the same in horizontal and vertical
    // orientations, use arrays and loops to avoid duplicating the code.

    enum Orient
    {
        Orient_Horz,
        Orient_Vert,
        Orient_Max
    };

    const char* const orientName[] = { "horizontal", "vertical" };

    // The already seen alignment flag in the given orientation or empty if
    // none have been seen yet.
    wxString alignFlagIn[] = { wxString(), wxString() };

    // Either "wxEXPAND" or "wxGROW" depending on the string used in the input,
    // or empty string if none is specified.
    wxString expandFlag;

    // Either "wxALIGN_CENTRE" or "wxALIGN_CENTER" if either flag was found or
    // empty string.
    wxString centreFlag;

    // Indicates whether we can use alignment in the given orientation at all.
    bool alignAllowedIn[] = { true, true };

    // Find out the sizer orientation: it is the principal/major size direction
    // for the 1D sizers and undefined/invalid for the 2D ones.
    Orient orientSizer;
    if ( wxBoxSizer* const boxSizer = wxDynamicCast(m_parentSizer, wxBoxSizer) )
    {
        orientSizer = boxSizer->GetOrientation() == wxHORIZONTAL
                        ? Orient_Horz
                        : Orient_Vert;

        // Alignment can be only used in the transversal/minor direction.
        alignAllowedIn[orientSizer] = false;
    }
    else
    {
        orientSizer = Orient_Max;
    }

    int flags = 0;

    wxStringTokenizer tkn(s, wxS("| \t\n"), wxTOKEN_STRTOK);
    while ( tkn.HasMoreTokens() )
    {
        const wxString flagName = tkn.GetNextToken();
        const int n = m_styleNames.Index(flagName);
        if ( n == wxNOT_FOUND )
        {
            ReportParamError
            (
                "flag",
                wxString::Format("unknown sizer flag \"%s\"", flagName)
            );
            continue;
        }

        // Flag description is the string that appears in the error messages,
        // the main difference from the flag name is that it can indicate that
        // wxALIGN_CENTRE_XXX flag could have been encountered as part of
        // wxALIGN_CENTRE which should make the error message more clear as
        // seeing references to e.g. wxALIGN_CENTRE_VERTICAL when it's never
        // used could be confusing.
        wxString flagDesc = wxS('"') + flagName + wxS('"');

        int flag = m_styleValues[n];

        bool flagSpecifiesAlignIn[] = { false, false };

        switch ( flag )
        {
            case wxALIGN_CENTRE_HORIZONTAL:
            case wxALIGN_RIGHT:
                flagSpecifiesAlignIn[Orient_Horz] = true;
                break;

            case wxALIGN_CENTRE_VERTICAL:
            case wxALIGN_BOTTOM:
                flagSpecifiesAlignIn[Orient_Vert] = true;
                break;
//.........这里部分代码省略.........
开发者ID:AaronDP,项目名称:wxWidgets,代码行数:101,代码来源:xh_sizer.cpp


示例6: UnixFilename

bool Parser::Parse(const wxString& filename, bool isLocal, bool locked, LoaderBase* loader)
{
    ParserThreadOptions opts;
    opts.wantPreprocessor      = m_Options.wantPreprocessor;
    opts.useBuffer             = false;
    opts.bufferSkipBlocks      = false;
    opts.bufferSkipOuterBlocks = false;
    opts.followLocalIncludes   = m_Options.followLocalIncludes;
    opts.followGlobalIncludes  = m_Options.followGlobalIncludes;
    opts.parseComplexMacros    = m_Options.parseComplexMacros;
    opts.loader                = loader; // maybe 0 at this point

    const wxString unixFilename = UnixFilename(filename);
    bool result = false;
    do
    {
        bool canparse = false;
        {
            if (!locked)
            {
                TRACK_THREAD_LOCKER(s_TokensTreeCritical);
                s_TokensTreeCritical.Enter();
                THREAD_LOCKER_SUCCESS(s_TokensTreeCritical);
            }

            canparse = !m_TokensTree->IsFileParsed(unixFilename);
            if (canparse)
                canparse = m_TokensTree->ReserveFileForParsing(unixFilename, true) != 0;

            if (!locked)
                s_TokensTreeCritical.Leave();
        }

        if (!canparse)
        {
           if (opts.loader) // if a loader is already open at this point, the caller must clean it up
               CCLogger::Get()->DebugLog(_T("Parse() : CodeCompletion Plugin: FileLoader memory leak ")
                                         _T("likely while loading file ") + unixFilename);
           break;
        }

        // this should always be true
        // memory will leak if a loader has already been initialized before this point
        if (!opts.loader)
            opts.loader = Manager::Get()->GetFileManager()->Load(unixFilename, m_NeedsReparse);

        ParserThread* thread = new ParserThread(this, unixFilename, isLocal, opts, m_TokensTree);
        TRACE(_T("Parse() : Parsing %s"), unixFilename.wx_str());

        if (m_IsPriority)
        {
            if (isLocal) // Parsing priority files
            {
                TRACE(_T("Parse() : Parsing priority header, %s"), unixFilename.wx_str());

                if (!locked)
                {
                    TRACK_THREAD_LOCKER(s_TokensTreeCritical);
                    s_TokensTreeCritical.Enter();
                    THREAD_LOCKER_SUCCESS(s_TokensTreeCritical);
                }

                result = thread->Parse();
                delete thread;

                if (!locked)
                    s_TokensTreeCritical.Leave();
                return true;
            }
            else // Add task when parsing priority files
            {
                TRACK_THREAD_LOCKER(s_ParserCritical);
                wxCriticalSectionLocker locker(s_ParserCritical);
                THREAD_LOCKER_SUCCESS(s_ParserCritical);

                TRACE(_T("Parse() : Add task for priority header, %s"), unixFilename.wx_str());
                m_PoolTask.push(PTVector());
                m_PoolTask.back().push_back(thread);
            }
        }
        else
        {
            TRACK_THREAD_LOCKER(s_ParserCritical);
            wxCriticalSectionLocker locker(s_ParserCritical);
            THREAD_LOCKER_SUCCESS(s_ParserCritical);

            TRACE(_T("Parse() : Parallel Parsing %s"), unixFilename.wx_str());

            // Add a task for all project files
            if (m_IsFirstBatch)
            {
                m_IsFirstBatch = false;
                m_PoolTask.push(PTVector());
            }

            if (m_IsParsing)
                m_Pool.AddTask(thread, true);
            else
            {
                if (!m_PoolTask.empty())
//.........这里部分代码省略.........
开发者ID:stahta01,项目名称:codeblocks_r7456,代码行数:101,代码来源:parser.cpp


示例7: InsertPage

// same as AddPage() but does it at given position
bool wxNotebook::InsertPage(size_t nPage,
                            wxNotebookPage *pPage,
                            const wxString& strText,
                            bool bSelect,
                            int imageId)
{
    wxCHECK_MSG( pPage != NULL, false, wxT("NULL page in wxNotebook::InsertPage") );
    wxCHECK_MSG( IS_VALID_PAGE(nPage) || nPage == GetPageCount(), false,
                 wxT("invalid index in wxNotebook::InsertPage") );

    wxASSERT_MSG( pPage->GetParent() == this,
                  wxT("notebook pages must have notebook as parent") );

    // add a new tab to the control
    // ----------------------------

    // init all fields to 0
    TC_ITEM tcItem;
    wxZeroMemory(tcItem);

    // set the image, if any
    if ( imageId != -1 )
    {
        tcItem.mask |= TCIF_IMAGE;
        tcItem.iImage  = imageId;
    }

    // and the text
    if ( !strText.empty() )
    {
        tcItem.mask |= TCIF_TEXT;
        tcItem.pszText = wxMSW_CONV_LPTSTR(strText);
    }

    // hide the page: unless it is selected, it shouldn't be shown (and if it
    // is selected it will be shown later)
    HWND hwnd = GetWinHwnd(pPage);
    SetWindowLong(hwnd, GWL_STYLE, GetWindowLong(hwnd, GWL_STYLE) & ~WS_VISIBLE);

    // this updates internal flag too -- otherwise it would get out of sync
    // with the real state
    pPage->Show(false);


    // fit the notebook page to the tab control's display area: this should be
    // done before adding it to the notebook or TabCtrl_InsertItem() will
    // change the notebooks size itself!
    AdjustPageSize(pPage);

    // finally do insert it
    if ( TabCtrl_InsertItem(GetHwnd(), nPage, &tcItem) == -1 )
    {
        wxLogError(wxT("Can't create the notebook page '%s'."), strText.c_str());

        return false;
    }

    // need to update the bg brush when the first page is added
    // so the first panel gets the correct themed background
    if ( m_pages.empty() )
    {
#if wxUSE_UXTHEME
        UpdateBgBrush();
#endif // wxUSE_UXTHEME
    }

    // succeeded: save the pointer to the page
    m_pages.Insert(pPage, nPage);

    // we may need to adjust the size again if the notebook size changed:
    // normally this only happens for the first page we add (the tabs which
    // hadn't been there before are now shown) but for a multiline notebook it
    // can happen for any page at all as a new row could have been started
    if ( m_pages.GetCount() == 1 || HasFlag(wxNB_MULTILINE) )
    {
        AdjustPageSize(pPage);

        // Additionally, force the layout of the notebook itself by posting a
        // size event to it. If we don't do it, notebooks with pages on the
        // left or the right side may fail to account for the fact that they
        // are now big enough to fit all all of their pages on one row and
        // still reserve space for the second row of tabs, see #1792.
        const wxSize s = GetSize();
        ::PostMessage(GetHwnd(), WM_SIZE, SIZE_RESTORED, MAKELPARAM(s.x, s.y));
    }

    // now deal with the selection
    // ---------------------------

    // if the inserted page is before the selected one, we must update the
    // index of the selected page
    if ( int(nPage) <= m_selection )
    {
        // one extra page added
        m_selection++;
    }

    DoSetSelectionAfterInsertion(nPage, bSelect);

//.........这里部分代码省略.........
开发者ID:stefanos82,项目名称:wxWidgets,代码行数:101,代码来源:notebook.cpp


示例8: wxT

bool SjVirtKeybdLayout::LoadLayoutFromFile(const wxString& file__, wxArrayString* allNames)
{
	// split index from file name
	wxString file;
	long currIndex = -1, wantedIndex = 0;
	if( file__.Find(wxT(','), TRUE) <= file__.Find(wxT('.'), TRUE) )
	{
		file = file__;
	}
	else
	{
		if( !file__.AfterLast(wxT(',')).ToLong(&wantedIndex, 10) ) { wantedIndex = 0; }
		file = file__.BeforeLast(wxT(','));
	}

	// init
	m_keys.Clear();
	m_file = file;
	m_name = file;
	m_lineCount = 1;
	m_totalRelWidth = 0;

	if( allNames )
	{
		allNames->Clear();
	}

	// read file content
	wxFileSystem fs;
	wxFSFile* fsFile = fs.OpenFile(file);
	if( fsFile == NULL )
	{
		return FALSE;
	}

	wxString fileContent = SjTools::GetFileContent(fsFile->GetStream(), &wxConvISO8859_1);
	delete fsFile;

	// parse file
	fileContent.Replace(wxT(";"), wxT("\n"));

	SjLineTokenizer tkz(fileContent);
	wxChar*         linePtr;
	wxString        line, lineType, lineValue;
	SjVirtKeybdKey* currKey = NULL;
	while( (linePtr=tkz.GetNextLine()) != NULL )
	{
		line = linePtr;

		// get key'n'value pair (currLine is already trimmed aleft and aright)
		if( line.Find('=') != -1 )
		{
			lineType = line.BeforeFirst('=').Trim().Lower();
			lineValue = line.AfterFirst('=').Trim(FALSE);
		}
		else
		{
			lineType = line.Lower();
			lineValue.Empty();
		}

		if( lineType == wxT("layout") )
		{
			if( allNames )
			{
				allNames->Add(lineValue);
			}

			currIndex++;
			if( currIndex == wantedIndex )
			{
				m_name = lineValue;
			}
		}
		else if( currIndex != wantedIndex )
		{
			;
		}
		else if( lineType == wxT("key") )
		{
			currKey = new SjVirtKeybdKey(lineValue);
			m_keys.Add(currKey);
		}
		else if( lineType == wxT("spacer") || lineType == wxT("nextline") )
		{
			currKey = new SjVirtKeybdKey(lineType);
			m_keys.Add(currKey);
		}
		else if( currKey )
		{
			if( lineType == wxT("width") )
			{
				currKey->SetRelWidth(lineValue);
			}
			else
			{
				currKey->SetKey(lineType, lineValue);
			}
		}
	}
//.........这里部分代码省略.........
开发者ID:boh1996,项目名称:silverjuke,代码行数:101,代码来源:virtkeybd.cpp


示例9: SetMask

void wxMaskController::SetMask(wxString mask)
{
	if(mask.IsEmpty())
	{
		mask = wxT("");
	}
	DeleteContents();
	
	wxFieldMaskData* pobjData = NULL;
	for(unsigned int i = 0;i < mask.Length(); i++)
	{
		wxChar chNew = mask[i];
		pobjData = new wxFieldMaskData();
		if(pobjData)
		{
			m_listData.Append(pobjData);
			pobjData->m_eSubType = MaskDataSubTypeNONE;

			switch(chNew)
			{
				case chMaskPlaceholderDECIMALSEPARATOR:
					pobjData->m_eType = MaskDataTypeDECIMALSEPARATOR;
					pobjData->m_chValue = m_chIntlDecimal;
					break;

				case chMaskPlaceholderTHOUSANDSSEPARATOR:
					pobjData->m_eType = MaskDataTypeTHOUSANDSSEPARATOR;
					pobjData->m_chValue = m_chIntlThousands;
					break;
				
				case chMaskPlaceholderTIMESEPARATOR:
					pobjData->m_eType = MaskDataTypeTIMESEPARATOR;
					pobjData->m_chValue = m_chIntlTime;
					break;
			
				case chMaskPlaceholderDATESEPARATOR:
					pobjData->m_eType = MaskDataTypeDATESEPARATOR;
					pobjData->m_chValue = m_chIntlDate;
					break;
		
				case chMaskPlaceholderDIGIT:
					pobjData->m_eType = MaskDataTypeDIGIT;
					pobjData->m_chValue = m_chPromptSymbol;
					break;
		
				case chMaskPlaceholderALPHANUMERIC:
					pobjData->m_eType = MaskDataTypeALPHANUMERIC;
					pobjData->m_chValue = m_chPromptSymbol;
					break;
			
				case chMaskPlaceholderALPHABETIC:
					pobjData->m_eType = MaskDataTypeALPHABETIC;
					pobjData->m_chValue = m_chPromptSymbol;
					break;
			
				case chMaskPlaceholderALPHABETICUPPER:
					pobjData->m_eType = MaskDataTypeALPHAETICUPPER;
					pobjData->m_chValue = m_chPromptSymbol;
					break;
			
				case chMaskPlaceholderALPHABETICLOWER:
					pobjData->m_eType = MaskDataTypeALPHAETICLOWER;
					pobjData->m_chValue = m_chPromptSymbol;
					break;
			
				case chMaskPlaceholderCHARACTER:
					pobjData->m_eType = MaskDataTypeCHARACTER;
					pobjData->m_chValue = m_chPromptSymbol;
					break;

				default:
					if(chNew == chMaskPlaceholderLITERALESCAPE)
					{
						// It is the next character that is inserted. 
						chNew = mask[++i];
						if(chNew)
						{
							pobjData->m_eType = MaskDataTypeLITERALESCAPE;
							pobjData->m_chValue = chNew;
							break;
						}
					}
					else if(chNew == chMaskPlaceholderDATEDAY)
					{
						// It is the next character that is inserted. 
						wxChar chNext = (i < (mask.Length()-1) ? mask[i+1] : wxT('\0'));
						wxChar chBefore = (i > 0 ? mask[i-1] : wxT('\0'));
						if((chNext == chMaskPlaceholderDATEDAY || chBefore == chMaskPlaceholderDATEDAY) && chBefore != chNext)
						{
							pobjData->m_eType = MaskDataTypeDIGIT;
							pobjData->m_eSubType = MaskDataSubTypeDATEDAY;
							pobjData->m_chValue = m_chPromptSymbol;
							break;
						}
					}
					else if(chNew == chMaskPlaceholderDATEMONTH)
					{
						// It is the next character that is inserted. 
						wxChar chNext = (i < (mask.Length()-1) ? mask[i+1] : wxT('\0'));
						wxChar chBefore = (i > 0 ? mask[i-1] : wxT('\0'));
//.........这里部分代码省略.........
开发者ID:jumandan,项目名称:cafe,代码行数:101,代码来源:wxMaskController.cpp


示例10: GetCursorWord

bool ThreadSearch::GetCursorWord(wxString& sWord)
{
    bool wordFound = false;
    sWord = wxEmptyString;

    // Gets active editor
    cbEditor* ed = Manager::Get()->GetEditorManager()->GetBuiltinActiveEditor();
    if ( ed != NULL )
    {
        cbStyledTextCtrl* control = ed->GetControl();

        sWord = control->GetSelectedText();
        if (sWord != wxEmptyString)
        {
            sWord.Trim(true);
            sWord.Trim(false);

            wxString::size_type pos = sWord.find(wxT('\n'));
            if (pos != wxString::npos)
            {
                sWord.Remove(pos, sWord.length() - pos);
                sWord.Trim(true);
                sWord.Trim(false);
            }

            return !sWord.IsEmpty();
        }

        // Gets word under cursor
        int pos = control->GetCurrentPos();
        int ws  = control->WordStartPosition(pos, true);
        int we  = control->WordEndPosition(pos, true);
        const wxString word = control->GetTextRange(ws, we);
        if (!word.IsEmpty()) // Avoid empty strings
        {
            sWord.Clear();
            while (--ws > 0)
            {
                const wxChar ch = control->GetCharAt(ws);
                if (ch <= _T(' '))
                    continue;
                else if (ch == _T('~'))
                    sWord << _T("~");
                break;
            }
            // m_SearchedWord will be used if 'Find occurrences' ctx menu is clicked
            sWord << word;
            wordFound = true;
        }
    }

    return wordFound;
}
开发者ID:SaturnSDK,项目名称:Saturn-SDK-IDE,代码行数:53,代码来源:ThreadSearch.cpp


示例11: key

wxString SjVirtKeybdKey::ParseKey(const wxString& key__, const wxString& defaultKey, wxString& retKeyTitle, long& retKeyFlags)
{
	wxString key(key__);

	// strip title from key (the title may be added using double quotes)
	if( !key.IsEmpty() && key.Last() == wxT('"') )
	{
		int p = key.Find(wxT('"'));
		wxASSERT( p != -1 );
		if( p != (int)key.Len()-1 )
		{
			retKeyTitle = key.Mid(p+1);
			retKeyTitle = retKeyTitle.Left(retKeyTitle.Len()-1);
			retKeyTitle.Replace(wxT("\\n"), wxT("\n"));

			key = key.Left(p).Trim();
		}
	}

	// strip flags from key
	while( key.Find(wxT(' ')) != wxNOT_FOUND )
	{
		wxString flag = key.AfterLast(wxT(' '));    // read flag ...
		key = key.BeforeLast(wxT(' '));             // ... before overwriting key
		if( flag == wxT("lock") )
		{
			retKeyFlags |= SJ_VK_LOCK;
		}
	}


	// parse key
	if( key.IsEmpty() )
	{
		return defaultKey;
	}
	else if( key == wxT("nextline")
	      || key == wxT("shift")
	      || key == wxT("nop")
	      || key == wxT("backsp")
	      || key == wxT("clearall")
	      || key == wxT("enter")
	      || key == wxT("spacer") )
	{
		return key;
	}
	else if( key.Left(3) == wxT("alt") )
	{
		long l;
		if( key.Mid(3).ToLong(&l, 10)
		 && l >= 0
		 && l < SJ_VK_MAX_ALT )
		{
			return key;
		}
		else
		{
			return defaultKey;
		}
	}
	else if( key.Left(2) == wxT("0x") )
	{
		long l;
		if( key.Mid(2).ToLong(&l, 16)
		 && l >= 0 )
		{
			#if wxUSE_UNICODE
				// in ISO8859-1 the "Euro" sign has the code 0x80 where
				// in Unicode the code is 0x20AC - fix this little incompatibility as the file encoding
				// is defined to use ISO8859-1.
				if( l == 0x0080 )
				{
					l = 0x20AC;
				}
			#endif

			return wxString((wxChar)l);
		}
		else
		{
			return defaultKey;
		}
	}
	else
	{
		#if wxUSE_UNICODE
			// see remark above
			if( key[0] == 0x0080 )
			{
				return wxString((wxChar)0x20AC);
			}
		#endif

		return key;
	}
}
开发者ID:boh1996,项目名称:silverjuke,代码行数:96,代码来源:virtkeybd.cpp


示例12: FromString

bool wxKeyTextCtrl::FromString(const wxString &s, int &mod, int &key)
{
	return ParseString(s.c_str(), s.size(), mod, key);
}
开发者ID:MrSwiss,项目名称:visualboyadvance-m,代码行数:4,代码来源:keyedit.cpp


示例13: FromString

bool wxNumberFormatter::FromString(wxString s, double *val)
{
    RemoveThousandsSeparators(s);
    return s.ToDouble(val);
}
开发者ID:0ryuO,项目名称:dolphin-avsync,代码行数:5,代码来源:numformatter.cpp


示例14: SkipSpace

void pgHbaConfigLine::Init(const wxString &line)
{
    connectType = PGC_INVALIDCONF;
    changed = false;

    if (line.IsEmpty())
        return;

    text = line;

    const wxChar *p0=line.c_str();

    if (*p0 == '#')
    {
        isComment = true;
        p0++;
        SkipSpace(p0);
    }
    else
        isComment = false;


    const wxChar *p1=p0;
    SkipNonspace(p1);

    wxString str=line.Mid(p0-line.c_str(), p1-p0);
    
    int i=FindToken(str, pgHbaConnectTypeStrings);

    if (i >= 0)
        connectType = (pgHbaConnectType)i;
    else
    {
        connectType = PGC_INVALIDCONF;
        isComment = true;
        return;
    }

    SkipSpace(p1);

    const wxChar *p2=p1;
    bool quoted=false;

    while (*p2)
    {
        if (!quoted && IsSpaceChar(*p2))
            break;
        if (*p2 == '"')
            quoted ^= quoted;
        p2++;
    }

    database = line.Mid(p1-line.c_str(), p2-p1);

    SkipSpace(p2);

    const wxChar *p3=p2;

    quoted=false;
    while (*p3)
    {
        if (!quoted && IsSpaceChar(*p3))
            break;
        if (*p3 == '"')
            quoted ^= quoted;
        p3++;
    }

    user = line.Mid(p2-line.c_str(), p3-p2);

    SkipSpace(p3);

    const wxChar *p4=p3;

    if (connectType == PGC_LOCAL)
    {
        // no ip address
    }
    else
    {
        bool hasCidr=false;
        while (*p4 && !IsSpaceChar(*p4))
        {
            if (*p4 == '/')
                hasCidr=true;
            p4++;
        }
        if (!hasCidr)
        {
            SkipSpace(p4);
            SkipNonspace(p4);
        }

        ipaddress = line.Mid(p3-line.c_str(), p4-p3);
        SkipSpace(p4);
    }

    const wxChar *p5=p4;
    SkipNonspace(p5);

//.........这里部分代码省略.........
开发者ID:lhcezar,项目名称:pgadmin3,代码行数:101,代码来源:pgconfig.cpp


示例15: GetInputData

bool wxMaskController::SetInputData(wxString value, int nBeginPos/*=0*/, bool bAllowPrompt/*=TRUE*/)
{
	wxString csFullInput;

	m_bNeedValidation = TRUE;
	m_bValidation = FALSE;


	// Start with existing data and append the new data. 
	csFullInput = GetInputData();
	csFullInput = csFullInput.Left(nBeginPos);
	
	if(bAllowPrompt)
		csFullInput += value;
	else
	{
		// If the prompt symbol is not valid, then 
		// add the data one-by-one ignoring any prompt symbols. 
		for(unsigned int i = 0;i < value.Length();i++)
		{
			if(value[i] != m_chPromptSymbol)
				csFullInput += value[i];
		}
	}
	
	bool bCompleteSuccess=TRUE;
	wxString pszReplaceData=csFullInput;
	wxFieldMaskData* pobjData=NULL;
	unsigned int posReplaceData=0;

	for(unsigned long pos = 0; pos < m_listData.GetCount();pos++)
	{
		pobjData = (wxFieldMaskData *) (m_listData.Item(pos))->GetData();

		// Ignore everything that is not data. 
		if(pobjData->IsInputData())
		{
			// If we run out of replacement data, then use the prompt symbol. 
			// Make sure we iterate through the entire list so that the 
			// prompt symbol is applied to any empty areas. 
			if(posReplaceData < pszReplaceData.Length())
			{
				// This inner while loop is so that we can re-apply input data 
				// after an error.  This will allow us to skip over invalid 
				// input data and try the next character. 
				while(posReplaceData< pszReplaceData.Length())
				{
					wxChar chReplace = pszReplaceData[posReplaceData++];
					
					// Make sure to follow the input validation. 
					// The prompt symbol is always valid at this level. 
					// This allows the user to erase a string by overtyping a space. 
					// On error, just skip the character being inserted. 
					// This will allow the DeleteRange() function to have the remaining 
					// characters validated. 
					if((chReplace == m_chPromptSymbol) || pobjData->IsValidInput(chReplace))
					{
						pobjData->m_chValue = pobjData->PreProcessChar(chReplace);
						break;
					}
					else
						bCompleteSuccess = FALSE;
				}
			}
			else
				pobjData->m_chValue = m_chPromptSymbol;
		}
	}
	
	Update();

	return bCompleteSuccess;
}
开发者ID:jumandan,项目名称:cafe,代码行数:73,代码来源:wxMaskController.cpp


示例16: wxT

// replaces special tags such as %TITLE% with info from the song
void CTunage::ParseTags( wxString& str )
{
	CNiceFilesize filesize;
	filesize.AddB( m_Song.MetaData.nFilesize );
	wxString sFilesize = filesize.GetFormatted();

	str.Replace( wxT("$ARTIST"), ConvFromUTF8( m_Song.MetaData.Artist ));
	str.Replace( wxT("$ALBUM"), ConvFromUTF8( m_Song.MetaData.Album ));
	str.Replace( wxT("$TITLE"), ConvFromUTF8(m_Song.MetaData.Title ));
	str.Replace( wxT("$YEAR"), ConvFromUTF8(m_Song.MetaData.Year ));

	if ( m_Song.MetaData.nFilesize == -1 )
		str.Replace( wxT("$NAME"), wxGetApp().Prefs.sTunageStoppedText );
	else
		str.Replace( wxT("$NAME"), wxString::Format( wxT("%s - %s"),(const wxChar*)ConvFromUTF8(m_Song.MetaData.Artist), (const wxChar *)ConvFromUTF8(m_Song.MetaData.Title) ) );

	str.Replace( wxT("$FILENAME"), m_Song.MetaData.Filename.GetFullPath() );
	str.Replace( wxT("$FILESIZE"), sFilesize );
	str.Replace( wxT("$BITRATE"), wxString::Format( wxT("%d"), m_Song.MetaData.nBitrate ) );
	str.Replace( wxT("$TRACKLENGTH"), SecToStr( m_Song.MetaData.nDuration_ms /1000 ) );

	str.Replace( wxT("$TIMESPLAYED"), wxString::Format( wxT("%d"), m_Song.TimesPlayed ) );
	str.Replace( wxT("$TRACKNUM"), wxString::Format( wxT("%.2d"), m_Song.MetaData.nTracknum ) );
}
开发者ID:BackupTheBerlios,项目名称:musik-svn,代码行数:25,代码来源:Tunage.cpp


示例17: is_named_process_running

bool os_msw::is_named_process_running( const wxString& process_name )
{

    // A more wxWindows type interface
    const char *szToTerminate = process_name.c_str();

    // Created: 6/23/2000  (RK)
    // Last modified: 3/10/2002  (RK)
    // Please report any problems or bugs to [email protected]
    // The latest version of this routine can be found at:
    //     http://www.neurophys.wisc.edu/ravi/software/killproc/
    // Terminate the process "szToTerminate" if it is currently running
    // This works for Win/95/98/ME and also Win/NT/2000/XP
    // The process name is case-insensitive, i.e. "notepad.exe" and "NOTEPAD.EXE"
    // will both work (for szToTerminate)
    // Return codes are as follows:
    //   0   = Process was successfully terminated
    //   603 = Process was not currently running
    //   604 = No permission to terminate process
    //   605 = Unable to load PSAPI.DLL
    //   602 = Unable to terminate process for some other reason
    //   606 = Unable to identify system type
    //   607 = Unsupported OS
    //   632 = Invalid process name
    //   700 = Unable to get procedure address from PSAPI.DLL
    //   701 = Unable to get process list, EnumProcesses failed
    //   702 = Unable to load KERNEL32.DLL
    //   703 = Unable to get procedure address from KERNEL32.DLL
    //   704 = CreateToolhelp32Snapshot failed
    // Change history:
    //   modified 3/8/2002  - Borland-C compatible if BORLANDC is defined as
    //                        suggested by Bob Christensen
    //   modified 3/10/2002 - Removed memory leaks as suggested by
    //					      Jonathan Richard-Brochu (handles to Proc and Snapshot
    //                        were not getting closed properly in some cases)
	
	BOOL bResult,bResultm;
	DWORD aiPID[1000],iCb=1000,iNumProc,iV2000=0;
	DWORD iCbneeded,i,iFound=0;
	char szName[MAX_PATH],szToTermUpper[MAX_PATH];
	HANDLE hProc,hSnapShot,hSnapShotm;
	OSVERSIONINFO osvi;
    HINSTANCE hInstLib;
	int iLen,iLenP,indx;
    HMODULE hMod;
	PROCESSENTRY32 procentry;      
	MODULEENTRY32 modentry;

	// Transfer Process name into "szToTermUpper" and
	// convert it to upper case
	iLenP=strlen(szToTerminate);
	if(iLenP<1 || iLenP>MAX_PATH) return FALSE;
	for(indx=0;indx<iLenP;indx++)
		szToTermUpper[indx]=toupper(szToTerminate[indx]);
	szToTermUpper[iLenP]=0;

     // PSAPI Function Pointers.
     BOOL (WINAPI *lpfEnumProcesses)( DWORD *, DWORD cb, DWORD * );
     BOOL (WINAPI *lpfEnumProcessModules)( HANDLE, HMODULE *,
        DWORD, LPDWORD );
     DWORD (WINAPI *lpfGetModuleBaseName)( HANDLE, HMODULE,
        LPTSTR, DWORD );

      // ToolHelp Function Pointers.
      HANDLE (WINAPI *lpfCreateToolhelp32Snapshot)(DWORD,DWORD) ;
      BOOL (WINAPI *lpfProcess32First)(HANDLE,LPPROCESSENTRY32) ;
      BOOL (WINAPI *lpfProcess32Next)(HANDLE,LPPROCESSENTRY32) ;
      BOOL (WINAPI *lpfModule32First)(HANDLE,LPMODULEENTRY32) ;
      BOOL (WINAPI *lpfModule32Next)(HANDLE,LPMODULEENTRY32) ;

	// First check what version of Windows we're in
	osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
    bResult=GetVersionEx(&osvi);
	if(!bResult)     // Unable to identify system version
	    return FALSE;

	// At Present we only support Win/NT/2000/XP or Win/9x/ME
	if((osvi.dwPlatformId != VER_PLATFORM_WIN32_NT) &&
		(osvi.dwPlatformId != VER_PLATFORM_WIN32_WINDOWS))
		return FALSE;

    if(osvi.dwPlatformId==VER_PLATFORM_WIN32_NT)
	{
		// Win/NT or 2000 or XP

         // Load library and get the procedures explicitly. We do
         // this so that we don't have to worry about modules using
         // this code failing to load under Windows 9x, because
         // it can't resolve references to the PSAPI.DLL.
         hInstLib = LoadLibraryA("PSAPI.DLL");
         if(hInstLib == NULL)
            return FALSE;

         // Get procedure addresses.
         lpfEnumProcesses = (BOOL(WINAPI *)(DWORD *,DWORD,DWORD*))
            GetProcAddress( hInstLib, "EnumProcesses" ) ;
         lpfEnumProcessModules = (BOOL(WINAPI *)(HANDLE, HMODULE *,
            DWORD, LPDWORD)) GetProcAddress( hInstLib,
            "EnumProcessModules" ) ;
         lpfGetModuleBaseName =(DWORD (WINAPI *)(HANDLE, HMODULE,
//.........这里部分代码省略.........
开发者ID:TimofonicJunkRoom,项目名称:plucker-1,代码行数:101,代码来源:os_msw_with_extra_process_killing.cpp


示例18: GetEOL

wxString wxTextBuffer::Translate(const wxString& text, wxTextFileType type)
{
    // don't do anything if there is nothing to do
    if ( type == wxTextFileType_None )
        return text;

    // nor if it is empty
    if ( text.empty() )
        return text;

    wxString eol = GetEOL(type), result;

    // optimization: we know that the length of the new string will be about
    // the same as the length of the old one, so prealloc memory to avoid
    // unnecessary relocations
    result.Alloc(text.Len());

    wxChar chLast = 0;
    for ( wxString::const_iterator i = text.begin(); i != text.end(); ++i )
    {
        wxChar ch = *i;
        switch ( ch ) {
            case wxT('\n'):
                // Dos/Unix line termination
                result += eol;
                chLast = 0;
                break;

            case wxT('\r'):
                if ( chLast == wxT('\r') ) {
                    // Mac empty line
                    result += eol;
                }
                else {
                    // just remember it: we don't know whether it is just "\r"
                    // or "\r\n" yet
                    chLast = wxT('\r');
                }
                break;

            default:
                if ( chLast == wxT('\r') ) {
                    // Mac line termination
                    result += eol;

                    // reset chLast to avoid inserting another eol before the
                    // next character
                    chLast = 0;
                }

                // add to the current line
                result += ch;
        }
    }

    if ( chLast ) {
        // trailing '\r'
        result += eol;
    }

    return result;
}
开发者ID:DumaGit,项目名称:winsparkle,代码行数:62,代码来源:textbuf.cpp


示例19: terminate_process_by_name

该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ wxStyledTextEvent类代码示例发布时间:2022-05-31
下一篇:
C++ wxStaticText类代码示例发布时间:2022-05-31
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap