本文整理汇总了C++中wxS函数的典型用法代码示例。如果您正苦于以下问题:C++ wxS函数的具体用法?C++ wxS怎么用?C++ wxS使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了wxS函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SetWindowStyle
bool wxSpinCtrl::Create(wxWindow *parent,
wxWindowID id,
const wxString& value,
const wxPoint& pos,
const wxSize& size,
long style,
int min, int max, int initial,
const wxString& name)
{
// before using DoGetBestSize(), have to set style to let the base class
// know whether this is a horizontal or vertical control (we're always
// vertical)
style |= wxSP_VERTICAL;
if ( (style & wxBORDER_MASK) == wxBORDER_DEFAULT )
#ifdef __WXWINCE__
style |= wxBORDER_SIMPLE;
#else
style |= wxBORDER_SUNKEN;
#endif
SetWindowStyle(style);
WXDWORD exStyle = 0;
WXDWORD msStyle = MSWGetStyle(GetWindowStyle(), & exStyle) ;
// Scroll text automatically if there is not enough space to show all of
// it, this is better than not allowing to enter more digits at all.
msStyle |= ES_AUTOHSCROLL;
// propagate text alignment style to text ctrl
if ( style & wxALIGN_RIGHT )
msStyle |= ES_RIGHT;
else if ( style & wxALIGN_CENTER )
msStyle |= ES_CENTER;
// calculate the sizes: the size given is the total size for both controls
// and we need to fit them both in the given width (height is the same)
wxSize sizeText(size), sizeBtn(size);
sizeBtn.x = wxSpinButton::DoGetBestSize().x;
if ( sizeText.x <= 0 )
{
// DEFAULT_ITEM_WIDTH is the default width for the text control
sizeText.x = DEFAULT_ITEM_WIDTH + MARGIN_BETWEEN + sizeBtn.x;
}
sizeText.x -= sizeBtn.x + MARGIN_BETWEEN;
if ( sizeText.x <= 0 )
{
wxLogDebug(wxS("wxSpinCtrl \"%s\": initial width %d is too small, ")
wxS("at least %d pixels needed."),
name, size.x, sizeBtn.x + MARGIN_BETWEEN + 1);
}
wxPoint posBtn(pos);
posBtn.x += sizeText.x + MARGIN_BETWEEN;
// we must create the text control before the spin button for the purpose
// of the dialog navigation: if there is a static text just before the spin
// control, activating it by Alt-letter should give focus to the text
// control, not the spin and the dialog navigation code will give focus to
// the next control (at Windows level), not the one after it
// create the text window
m_hwndBuddy = (WXHWND)::CreateWindowEx
(
exStyle, // sunken border
wxT("EDIT"), // window class
NULL, // no window title
msStyle, // style (will be shown later)
pos.x, pos.y, // position
0, 0, // size (will be set later)
GetHwndOf(parent), // parent
(HMENU)-1, // control id
wxGetInstance(), // app instance
NULL // unused client data
);
if ( !m_hwndBuddy )
{
wxLogLastError(wxT("CreateWindow(buddy text window)"));
return false;
}
// create the spin button
if ( !wxSpinButton::Create(parent, id, posBtn, sizeBtn, style, name) )
{
return false;
}
wxSpinButtonBase::SetRange(min, max);
// subclass the text ctrl to be able to intercept some events
gs_spinForTextCtrl[GetBuddyHwnd()] = this;
m_wndProcBuddy = (WXFARPROC)wxSetWindowProc(GetBuddyHwnd(),
wxBuddyTextWndProc);
//.........这里部分代码省略.........
示例2: while
//~~ AdeElementIterator GetFirstComponent() [AdeClass] ~~
wxString entry;
long index;
std::list<wxFileName> ret;
myConfig->SetPath(wxS("/Components"));
bool cont = myConfig->GetFirstEntry(entry, index);
while (cont)
{
ret.push_back(AdeGUIDCache::Instance()->GetCachedEntry(entry));
cont = myConfig->GetNextEntry(entry, index);
}
myConfig->SetPath(wxS("/"));
return AdeElementIterator(ret);
示例3: wxMessageDialog
//~~ void OnReload(wxCommandEvent& event) [SeqFrame] ~~
if (textTab->IsModified())
{
int answer = wxMessageDialog(this, wxS("You made changes. Save?"), wxS("Save Changes?"), wxCANCEL | wxYES | wxNO | wxICON_QUESTION).ShowModal();
wxCommandEvent anEvent;
if (answer == wxID_YES)
Save(anEvent);
if (answer == wxID_CANCEL)
return;
}
Load(currentFile);
示例4: wxS
//~~ void Load(wxConfigBase& configObject) [scPerson] ~~
configObject.Read(wxS("Label"), &myLabel);
myLabel.Trim(false);
myLabel.Trim(true);
myLabel.Replace(wxS("\t"), wxS(" "));
myLabel.Replace(wxS("\n"), wxS(" "));
myLabel.Replace(wxS(" "), wxS(" "));
configObject.Read(wxS("Male"), &male);
configObject.Read(wxS("Child"), &child);
glNode::Load(configObject);
示例5: wxS
return AdeDirectoryElement::CreateNewElement(parentFolder, wxS("relations"), ITEM_IS_RELATIONS, false);
示例6: SetTipShapeAndSize
// Set the size and shape of the tip window and returns the offset of its
// content area from the top (horizontal offset is always 0 currently).
int SetTipShapeAndSize(wxTipKind tipKind, const wxSize& contentSize)
{
#if wxUSE_GRAPHICS_CONTEXT
wxSize size = contentSize;
// The size is the vertical size and the offset is the distance from
// edge for asymmetric tips, currently hard-coded to be the same as the
// size.
const int tipSize = GetTipHeight();
const int tipOffset = tipSize;
// The horizontal position of the tip.
int x = -1;
// The vertical coordinates of the tip base and apex.
int yBase = -1,
yApex = -1;
// The offset of the content part of the window.
int dy = -1;
// Define symbolic names for the rectangle corners and mid-way points
// that we use below in an attempt to make the code more clear. Notice
// that these values must be consecutive as we iterate over them.
enum RectPoint
{
RectPoint_TopLeft,
RectPoint_Top,
RectPoint_TopRight,
RectPoint_Right,
RectPoint_BotRight,
RectPoint_Bot,
RectPoint_BotLeft,
RectPoint_Left,
RectPoint_Max
};
// The starting point for AddArcToPoint() calls below, we iterate over
// all RectPoints from it.
RectPoint pointStart = RectPoint_Max;
// Hard-coded radius of the round main rectangle corners.
const double RADIUS = 5;
// Create a path defining the shape of the tooltip window.
wxGraphicsPath
path = wxGraphicsRenderer::GetDefaultRenderer()->CreatePath();
if ( tipKind == wxTipKind_Auto )
tipKind = GetBestTipKind();
// Points defining the tip shape (in clockwise order as we must end at
// tipPoints[0] after drawing the rectangle outline in this order).
wxPoint2DDouble tipPoints[3];
switch ( tipKind )
{
case wxTipKind_Auto:
wxFAIL_MSG( "Impossible kind value" );
break;
case wxTipKind_TopLeft:
x = tipOffset;
yApex = 0;
yBase = tipSize;
dy = tipSize;
tipPoints[0] = wxPoint2DDouble(x, yBase);
tipPoints[1] = wxPoint2DDouble(x, yApex);
tipPoints[2] = wxPoint2DDouble(x + tipSize, yBase);
pointStart = RectPoint_TopRight;
break;
case wxTipKind_TopRight:
x = size.x - tipOffset;
yApex = 0;
yBase = tipSize;
dy = tipSize;
tipPoints[0] = wxPoint2DDouble(x - tipSize, yBase);
tipPoints[1] = wxPoint2DDouble(x, yApex);
tipPoints[2] = wxPoint2DDouble(x, yBase);
pointStart = RectPoint_TopRight;
break;
case wxTipKind_BottomLeft:
x = tipOffset;
yApex = size.y + tipSize;
yBase = size.y;
dy = 0;
tipPoints[0] = wxPoint2DDouble(x + tipSize, yBase);
tipPoints[1] = wxPoint2DDouble(x, yApex);
tipPoints[2] = wxPoint2DDouble(x, yBase);
//.........这里部分代码省略.........
示例7: wxMenu
//~~ wxMenu* CreateRepositoryMenu() [AstadeModel] ~~
wxMenu* aSubUp = new wxMenu(wxEmptyString);
aSubUp->AppendRadioItem(ID_SELECTNONE, wxS("none"));
aSubUp->AppendRadioItem(ID_SELECTSVN, wxS("SVN / git-svn"));
aSubUp->Enable(ID_SELECTSVN, AdeRevisionControlSVN::IsAvailable());
aSubUp->AppendRadioItem(ID_SELECTGIT, wxS("Git"));
aSubUp->Enable(ID_SELECTGIT, AdeRevisionControlGIT::IsAvailable());
aSubUp->AppendRadioItem(ID_SELECTHG, wxS("Mercurial"));
aSubUp->Enable(ID_SELECTHG, AdeRevisionControlHg::IsAvailable());
aSubUp->AppendRadioItem(ID_SELECTMKS, wxS("MKS"));
aSubUp->Enable(ID_SELECTMKS, AdeRevisionControlMKS::IsAvailable());
aSubUp->AppendRadioItem(ID_SELECTCVS, wxS("CVS"));
AdeModel* theModel = dynamic_cast<AdeModel*>(myModelElement);
if (!theModel->GetRepository().CmpNoCase(wxS("CVS")))
aSubUp->Check(ID_SELECTCVS, true);
else if (!theModel->GetRepository().CmpNoCase(wxS("SVN")))
aSubUp->Check(ID_SELECTSVN, true);
else if (!theModel->GetRepository().CmpNoCase(wxS("MKS")))
aSubUp->Check(ID_SELECTMKS, true);
else if (!theModel->GetRepository().CmpNoCase(wxS("Mercurial")))
aSubUp->Check(ID_SELECTHG, true);
else if (!theModel->GetRepository().CmpNoCase(wxS("Git")))
aSubUp->Check(ID_SELECTGIT, true);
else
aSubUp->Check(ID_SELECTNONE, true);
return aSubUp;
示例8: out
//~~ void doH() [CGenerator] ~~
target.SetExt(wxS("h"));
std::ofstream out(target.GetFullPath().utf8_str());
wxFileName PrefixName(myAdeComponent->GetFileName());
PrefixName.SetFullName(wxS("prolog.h"));
wxTextFile Gprefixtext(PrefixName.GetFullPath());
if (Gprefixtext.Exists())
Gprefixtext.Open();
if (Gprefixtext.IsOpened() && Gprefixtext.GetLineCount() > 0)
{
wxString str;
for (str = Gprefixtext.GetFirstLine(); !Gprefixtext.Eof(); str = Gprefixtext.GetNextLine())
out << str.utf8_str() << std::endl;
if (!str.empty())
out << str.utf8_str() << std::endl;
out << std::endl;
}
PrintHeader(out);
wxString defname(target.GetFullName());
defname.MakeUpper();
defname.Replace(wxS("."), wxS("_"));
out << "#ifndef __" << defname.utf8_str() << std::endl;
out << "# define __" << defname.utf8_str() << std::endl;
out << std::endl;
PrefixName = source->GetFileName();
示例9: wxStaticText
//~~ void AddBrowseLine(wxSizer* topsizer, wxString staticText, wxTextCtrl*& theTextControl, int browseButtonID) [AstadeDirDialog] ~~
topsizer->Add(new wxStaticText(this, 0, staticText), 0, wxRIGHT, 10);
theTextControl = new wxTextCtrl(this, 0, wxEmptyString);
topsizer->Add(theTextControl, 1, wxRIGHT | wxEXPAND, 10);
topsizer->Add(new wxButton(this, browseButtonID, wxS("browse")), 0, wxRIGHT, 10);
示例10: degrees
void wxSVGFileDCImpl::DoDrawEllipticArc(wxCoord x, wxCoord y, wxCoord w, wxCoord h, double sa, double ea)
{
/*
Draws an arc of an ellipse. The current pen is used for drawing the arc
and the current brush is used for drawing the pie.
x and y specify the x and y coordinates of the upper-left corner of the
rectangle that contains the ellipse.
width and height specify the width and height of the rectangle that
contains the ellipse.
start and end specify the start and end of the arc relative to the
three-o'clock position from the center of the rectangle. Angles are
specified in degrees (360 is a complete circle). Positive values mean
counter-clockwise motion. If start is equal to end, a complete ellipse
will be drawn. */
//radius
double rx = w / 2.0;
double ry = h / 2.0;
// center
double xc = x + rx;
double yc = y + ry;
// start and end coords
double xs, ys, xe, ye;
xs = xc + rx * cos (wxDegToRad(sa));
xe = xc + rx * cos (wxDegToRad(ea));
ys = yc - ry * sin (wxDegToRad(sa));
ye = yc - ry * sin (wxDegToRad(ea));
// svg arcs have 0 degrees at 12-o'clock instead of 3-o'clock
double start = (sa - 90);
if (start < 0)
start += 360;
while (abs(start) > 360)
start -= (start / abs(start)) * 360;
double end = (ea - 90);
if (end < 0)
end += 360;
while (abs(end) > 360)
end -= (end / abs(end)) * 360;
// svg arcs are in clockwise direction, reverse angle
double angle = end - start;
if (angle <= 0)
angle += 360;
int fArc = angle > 180 ? 1 : 0; // flag for large or small arc
int fSweep = 0; // flag for sweep always 0
wxString arcPath;
if (angle == 360)
{
// Drawing full circle fails with default arc. Draw two half arcs instead.
fArc = 1;
arcPath = wxString::Format(wxS(" <path d=\"M%s %s a%s %s 0 %d %d %s %s a%s %s 0 %d %d %s %s"),
NumStr(x), NumStr(y + ry),
NumStr(rx), NumStr(ry), fArc, fSweep, NumStr( rx * 2), NumStr(0),
NumStr(rx), NumStr(ry), fArc, fSweep, NumStr(-rx * 2), NumStr(0));
}
else
{
arcPath = wxString::Format(wxS(" <path d=\"M%s %s A%s %s 0 %d %d %s %s"),
NumStr(xs), NumStr(ys),
NumStr(rx), NumStr(ry), fArc, fSweep, NumStr(xe), NumStr(ye));
}
// Workaround so SVG does not draw an extra line from the centre of the drawn arc
// to the start point of the arc.
// First draw the arc with the current brush, without a border,
// then draw the border without filling the arc.
if (GetBrush().GetStyle() != wxBRUSHSTYLE_TRANSPARENT)
{
wxDCPenChanger setTransp(*GetOwner(), *wxTRANSPARENT_PEN);
NewGraphicsIfNeeded();
wxString arcFill = arcPath;
arcFill += wxString::Format(wxS(" L%s %s z"), NumStr(xc), NumStr(yc));
arcFill += wxS("\"/>\n");
write(arcFill);
}
wxDCBrushChanger setTransp(*GetOwner(), *wxTRANSPARENT_BRUSH);
NewGraphicsIfNeeded();
wxString arcLine = arcPath + wxS("\"/>\n");
write(arcLine);
}
示例11: stamp
//~~ wxString GetEventText(int eventNumber) [SeqDataBase] ~~
if (eventNumber < 0 ||
static_cast<unsigned>(eventNumber) >= itsEvents.size())
return wxEmptyString;
wxString format;
format.Printf(wxS("%%04d %%%ds %%%ds %%s %%-%ds %%s\n"), longestTimeStamp, longestObjectName, longestObjectName);
wxString ret;
wxString stamp(itsEvents[eventNumber].aTimeStamp+itsEvents[eventNumber].threadID);
switch (itsEvents[eventNumber].eventID)
{
case ID_EXIST:
ret.Printf(wxS("! %s\n"), classes[itsEvents[eventNumber].destinationObject].c_str());
break;
case ID_STATECHANGE:
ret.Printf(format, eventNumber, stamp.c_str(), classes[itsEvents[eventNumber].sourceObject].c_str(), wxS(">>>"), itsEvents[eventNumber].label.c_str(), wxEmptyString);
break;
case ID_NOTE:
ret.Printf(format, eventNumber, stamp.c_str(), classes[itsEvents[eventNumber].sourceObject].c_str(), wxS("note:"), itsEvents[eventNumber].label.c_str(), wxEmptyString);
break;
case ID_GLOBALCALL:
ret.Printf(format, eventNumber, stamp.c_str(), wxS("~"), wxS("==>"), classes[itsEvents[eventNumber].destinationObject].c_str(), itsEvents[eventNumber].label.c_str());
break;
case ID_CALL:
示例12: at
void wxSVGFileDCImpl::DoDrawArc(wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2, wxCoord xc, wxCoord yc)
{
/* Draws an arc of a circle, centred on (xc, yc), with starting point
(x1, y1) and ending at (x2, y2). The current pen is used for the outline
and the current brush for filling the shape.
The arc is drawn in an anticlockwise direction from the start point to
the end point.
Might be better described as Pie drawing */
NewGraphicsIfNeeded();
wxString s;
// we need the radius of the circle which has two estimates
double r1 = sqrt ( double( (x1-xc)*(x1-xc) ) + double( (y1-yc)*(y1-yc) ) );
double r2 = sqrt ( double( (x2-xc)*(x2-xc) ) + double( (y2-yc)*(y2-yc) ) );
wxASSERT_MSG( (fabs ( r2-r1 ) <= 3), wxS("wxSVGFileDC::DoDrawArc Error in getting radii of circle"));
if ( fabs ( r2-r1 ) > 3 ) //pixels
{
s = wxS("<!--- wxSVGFileDC::DoDrawArc Error in getting radii of circle -->\n");
write(s);
}
double theta1 = atan2((double)(yc - y1), (double)(x1 - xc));
if (theta1 < 0)
theta1 = theta1 + M_PI * 2;
double theta2 = atan2((double)(yc - y2), (double)(x2 - xc));
if (theta2 < 0)
theta2 = theta2 + M_PI * 2;
if (theta2 < theta1) theta2 = theta2 + M_PI * 2;
int fArc; // flag for large or small arc 0 means less than 180 degrees
if (fabs(theta2 - theta1) > M_PI)
fArc = 1; else fArc = 0;
int fSweep = 0; // flag for sweep always 0
if (x1 == x2 && y1 == y2)
{
// drawing full circle fails with default arc. Draw two half arcs instead.
s = wxString::Format(wxS(" <path d=\"M%d %d a%s %s 0 %d %d %s %s a%s %s 0 %d %d %s %s"),
x1, y1,
NumStr(r1), NumStr(r2), fArc, fSweep, NumStr( r1 * 2), NumStr(0),
NumStr(r1), NumStr(r2), fArc, fSweep, NumStr(-r1 * 2), NumStr(0));
}
else
{
// comply to wxDC specs by drawing closing line if brush is not transparent
wxString line;
if (GetBrush().GetStyle() != wxBRUSHSTYLE_TRANSPARENT)
line = wxString::Format(wxS("L%d %d z"), xc, yc);
s = wxString::Format(wxS(" <path d=\"M%d %d A%s %s 0 %d %d %d %d %s"),
x1, y1, NumStr(r1), NumStr(r2), fArc, fSweep, x2, y2, line);
}
s += wxS("\"/>\n");
write(s);
}
示例13: NewGraphicsIfNeeded
void wxSVGFileDCImpl::DoDrawRotatedText(const wxString& sText, wxCoord x, wxCoord y, double angle)
{
//known bug; if the font is drawn in a scaled DC, it will not behave exactly as wxMSW
NewGraphicsIfNeeded();
wxString s;
// Get extent of whole text.
wxCoord w, h, heightLine;
GetOwner()->GetMultiLineTextExtent(sText, &w, &h, &heightLine);
// Compute the shift for the origin of the next line.
const double rad = wxDegToRad(angle);
const double dx = heightLine * sin(rad);
const double dy = heightLine * cos(rad);
// wxS("upper left") and wxS("upper right")
CalcBoundingBox(x, y);
CalcBoundingBox((wxCoord)(x + w*cos(rad)), (wxCoord)(y - h*sin(rad)));
// wxS("bottom left") and wxS("bottom right")
CalcBoundingBox((wxCoord)(x + h*sin(rad)), (wxCoord)(y + h*cos(rad)));
CalcBoundingBox((wxCoord)(x + h*sin(rad) + w*cos(rad)), (wxCoord)(y + h*cos(rad) - w*sin(rad)));
if (m_backgroundMode == wxBRUSHSTYLE_SOLID)
{
// draw background first
// just like DoDrawRectangle except we pass the text color to it and set the border to a 1 pixel wide text background
s += wxString::Format(wxS(" <rect x=\"%d\" y=\"%d\" width=\"%d\" height=\"%d\" "), x, y, w, h);
s += wxS("style=\"") + wxBrushString(m_textBackgroundColour);
s += wxS("stroke-width:1; ") + wxPenString(m_textBackgroundColour);
s += wxString::Format(wxS("\" transform=\"rotate(%s %d %d)\"/>"), NumStr(-angle), x, y);
s += wxS("\n");
write(s);
}
// Draw all text line by line
const wxArrayString lines = wxSplit(sText, '\n', '\0');
for (size_t lineNum = 0; lineNum < lines.size(); lineNum++)
{
// convert x,y to SVG text x,y (the coordinates of the text baseline)
wxCoord ww, hh, desc;
DoGetTextExtent(lines[lineNum], &ww, &hh, &desc);
int xx = x + wxRound(lineNum * dx) + (hh - desc) * sin(rad);
int yy = y + wxRound(lineNum * dy) + (hh - desc) * cos(rad);
//now do the text itself
s += wxString::Format(wxS(" <text x=\"%d\" y=\"%d\" textLength=\"%d\" "), xx, yy, ww);
wxString fontName(m_font.GetFaceName());
if (fontName.Len() > 0)
s += wxS("style=\"font-family:") + fontName + wxS("; ");
else
s += wxS("style=\" ");
wxString fontweight;
switch (m_font.GetWeight())
{
case wxFONTWEIGHT_MAX:
wxFAIL_MSG(wxS("invalid font weight value"));
wxFALLTHROUGH;
case wxFONTWEIGHT_NORMAL:
fontweight = wxS("normal");
break;
case wxFONTWEIGHT_LIGHT:
fontweight = wxS("lighter");
break;
case wxFONTWEIGHT_BOLD:
fontweight = wxS("bold");
break;
}
wxASSERT_MSG(!fontweight.empty(), wxS("unknown font weight value"));
s += wxS("font-weight:") + fontweight + wxS("; ");
wxString fontstyle;
switch (m_font.GetStyle())
{
case wxFONTSTYLE_MAX:
wxFAIL_MSG(wxS("invalid font style value"));
wxFALLTHROUGH;
case wxFONTSTYLE_NORMAL:
fontstyle = wxS("normal");
break;
case wxFONTSTYLE_ITALIC:
fontstyle = wxS("italic");
break;
case wxFONTSTYLE_SLANT:
fontstyle = wxS("oblique");
break;
}
wxASSERT_MSG(!fontstyle.empty(), wxS("unknown font style value"));
//.........这里部分代码省略.........
示例14: theConfig
//~~ int GetIconIndex() [AstadeTransition] ~~
wxArrayString names;
wxFileConfig theConfig(wxEmptyString, wxEmptyString, wxEmptyString, myModelElement->GetFileName().GetFullPath());
wxString TransitionType = theConfig.Read(wxS("Astade/TransitionType"));
if (TransitionType == wxS("Self"))
names.Add(wxS("selftransition"));
else if (TransitionType == wxS("Internal"))
names.Add(wxS("internaltransition"));
else
names.Add(wxS("transition"));
if (search->isSet(AdeSearch::SearchIsActive))
{
switch (myModelElement->Search(*search))
{
case AdeSearch::contain:
names.Add(wxS("hasfound"));
break;
case AdeSearch::found:
names.Add(wxS("found"));
break;
default:
break;
}
}
else
{
示例15: wxS
//~~ void AppendMenuItems(wxMenu& aPopUp) [AstadeFile] ~~
aPopUp.Append(ID_EDIT, wxS("edit"), wxEmptyString, wxITEM_NORMAL);
aPopUp.AppendSeparator();
aPopUp.Append(ID_DELETE, wxS("delete"), wxEmptyString, wxITEM_NORMAL);