示例#1
0


  <!-- NOTE ON THE SECTIONS TO INSERT HERE: you are free to add anything you think
       that will make your component more appealing: some sample snippet of code,
       docs, bugs & feature requests... -->
  <br/><?php 
write_h1("Usage sample");
?>
  <!--<?php 
writeSnippet('
// sample CPP snippet which shows how to use this component:
myComp *newcomp = new myComp();
newcomp->SetAAAA("aaa");
newcomp->SetBBBB("bbb");

// inside this section we can use any character we want except
// for the single quote char: if you need to use it you should
// escape it in this way: \'
newcomp->Show();
');
?>
-->

  <!-- NOTE TO THE DOCUMENTATION: for uploading you component docs in the website,
       see the ReadMe.txt file at wxCode\template... -->
  <br/><?php 
write_h1("Documentation");
?>
  <p>The documentation for this component is available online
  <a href="../../docs/wxChartSUBDIR/">here</a>.</p>
示例#2
0
?>
  <?php 
writeSnippet('
//wxFormatFunction create new inherited classes of wxFormatFunction to provide custom functionality. ...
//example:

	class expandNumberFunc : public wxFormatFunction
	{
	public:
		expandNumberFunc();
		~expandNumberFunc();
		wxString Parse(wxString input)
		{
			...
			change numerals to written numbers
			...
		}
	};

	wxStringFormatter SF;
	SF.AddFormatFunction("EXPAND", new expandNumberFunc());

	wxString sample = "I have EXPAND(1) apple."

	SF.Parse(sample);

	output = I have one apple. ....

');
?>
示例#3
0
write_h1("wxScript usage sample");
?>
  <?php 
writeSnippet('
// load the script
wxString filename(basepath + wxT("myscript"));
wxScriptFile *pf = wxScriptInterpreter::Load(filename, wxRECOGNIZE_FROM_EXTENSION);
if (pf == NULL) {
    wxPrintf(wxT(">Failed to load \'%s\'.\\n"), filename.c_str());
    return;
}

// get the list of the functions
wxScriptFunctionArray arr;
wxScriptInterpreter::GetTotalFunctionList(arr);

// now, check for the presence of the "main" function...
wxScriptFunction *func = arr.Get(wxT("main"));
if (func == NULL) return; // no such function is present ?

// ...and run it with a string as argument
wxScriptVar result;
wxScriptVar args[2];
args[0].Set(wxT("char*"), wxT("my string"));
if (!func->Exec(result, args)) return;

// last, get the result...
wxString str(result.GetContentString());
');
?>

示例#4
0
  </div>
-->


  <!-- NOTE ON THE SECTIONS TO INSERT HERE: you are free to add anything you think
       that will make your component more appealing: some sample snippet of code,
       docs, bugs & feature requests... -->
  <br/><?php 
write_h1("Usage sample");
?>
  <?php 
writeSnippet('
// sample CPP snippet which shows how to use this component:
// LEDPanel with LED-size 4x4 and Panel with 65x9 LEDs, no padding between the LEDs
wxLEDPanel *ledpanel = new wxLEDPanel(this,wxID_ANY,wxSize(4,4),wxSize(65,9),0);
ledpanel->SetLEDColour(wxLED_COLOUR_GREEN);	// Green LEDs
ledpanel->SetText(wxT("WXLEDPANEL"),wxALIGN_CENTER);
// Thats all, if you want the text to scroll, then add this
ledpanel->SetScrollDirection(wxLED_SCROLL_LEFT);
ledpanel->SetScrollspeed(100);
');
?>


  <!-- NOTE TO THE DOCUMENTATION: for uploading you component docs in the website,
       see the ReadMe.txt file at wxCode\template... 
  <br/><?php 
write_h1("Documentation");
?>
  <p>The documentation for this component is available online
  <a href="../../docs/MYCOMPSUBDIR/">here</a>.</p>
-->
示例#5
0
  <!-- NOTE ON THE SECTIONS TO INSERT HERE: you are free to add anything you think
       that will make your component more appealing: some sample snippet of code,
       docs, bugs & feature requests... -->
  <br/><?php 
write_h1("Usage sample");
?>
  <?php 
writeSnippet('
// Usage of wxLatexDC is similar to other DCs (such as wxSVGFileDC):
// ...
wxLatexDC latexDC(filename,GetRect().width,GetRect().height,72.0);
Draw(latexDC);
// ...


% You can then include the output in a LaTeX document
% In your header, you need to include PSTricks:
\\usepackage{pstricks}

% In your document, you simply integrate the tex file:
\\input{./filename}
');
?>


  <!-- NOTE TO THE DOCUMENTATION: for uploading you component docs in the website,
       see the ReadMe.txt file at wxCode\template... -->
  <br/><?php 
write_h1("Documentation");
?>
示例#6
0
writeSnippet('
    // parse an XML file  
    wxXml2Document doc;
    if (!doc.Load("myfile.xml"))
        return false;

    // start processing the XML file
    if (doc.GetRoot()->GetName() != "myroot-node")
        return false;

    wxXml2Node *child = doc.GetRoot()->GetChildren();
    while (child) {

        if (child->GetName() == "tag1") {

            // process text enclosed by tag1/tag1
            wxString content = child->GetNodeContent();

            ...

            // process attributes of tag1
            wxString attrvalue1 =
                child->GetProperty("attr1", "default-value");
            wxString attrvalue2 =
                child->GetProperty("attr2", "default-value");

            ...

        } else if (child->GetName() == "tag2") {

            // process tag2 ...
        }

        child = child->GetNext();
    }
    ');