本文整理汇总了C++中wxSize::GetWidth方法的典型用法代码示例。如果您正苦于以下问题:C++ wxSize::GetWidth方法的具体用法?C++ wxSize::GetWidth怎么用?C++ wxSize::GetWidth使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类wxSize
的用法示例。
在下文中一共展示了wxSize::GetWidth方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: OneLargeRegion
void ClippingBoxTestCaseBase::OneLargeRegion()
{
// Setting one clipping box larger then DC surface.
// Final clipping box should be limited to the DC extents.
m_dc->SetClippingRegion(-10, -20,
s_dcSize.GetWidth()+30, s_dcSize.GetHeight()+50);
m_dc->SetBackground(wxBrush(s_fgColour, wxBRUSHSTYLE_SOLID));
m_dc->Clear();
CheckBox(0, 0, s_dcSize.GetWidth(), s_dcSize.GetHeight());
}
示例2: GetSizeInOrientation
static int GetSizeInOrientation(wxSize size, wxOrientation orientation)
{
switch(orientation)
{
case wxHORIZONTAL: return size.GetWidth();
case wxVERTICAL: return size.GetHeight();
case wxBOTH: return size.GetWidth() * size.GetHeight();
default: return 0;
}
}
示例3: AdjustFontSize
static void AdjustFontSize(wxFont& font, wxDC& dc, const wxSize& pixelSize)
{
int currentSize = 0;
int largestGood = 0;
int smallestBad = 0;
bool initialGoodFound = false;
bool initialBadFound = false;
// NB: this assignment was separated from the variable definition
// in order to fix a gcc v3.3.3 compiler crash
currentSize = font.GetPointSize();
while (currentSize > 0)
{
dc.SetFont(font);
// if currentSize (in points) results in a font that is smaller
// than required by pixelSize it is considered a good size
if (dc.GetCharHeight() <= pixelSize.GetHeight() &&
(!pixelSize.GetWidth() ||
dc.GetCharWidth() <= pixelSize.GetWidth()))
{
largestGood = currentSize;
initialGoodFound = true;
}
else
{
smallestBad = currentSize;
initialBadFound = true;
}
if (!initialGoodFound)
{
currentSize /= 2;
}
else if (!initialBadFound)
{
currentSize *= 2;
}
else
{
int distance = smallestBad - largestGood;
if (distance == 1)
break;
currentSize = largestGood + distance / 2;
}
font.SetPointSize(currentSize);
}
if (currentSize != largestGood)
font.SetPointSize(largestGood);
}
示例4: CreateBitmap
// {{{ wxBitmap ArtProvider::CreateBitmap(const wxArtID &id, const wxArtClient &client, const wxSize &size)
wxBitmap ArtProvider::CreateBitmap(const wxArtID &id, const wxArtClient &client, const wxSize &size) {
#ifdef BUILTIN_IMAGES
const Images::Image *img = Images::GetImage(id);
if (img == NULL) {
return wxNullBitmap;
}
wxMemoryInputStream mis(img->image, img->size);
wxImage image(mis, wxBITMAP_TYPE_PNG);
#elif __WXMAC__
wxString path(wxGetCwd());
path << wxT("/Dubnium.app/Contents/Resources/") << id << wxT(".png");
if (!wxFileExists(path)) {
return wxNullBitmap;
}
wxImage image(path, wxBITMAP_TYPE_PNG);
#elif DUBNIUM_DEBUG
wxString path(wxT(__FILE__));
path = wxPathOnly(path);
path << wxT("/../../images/") << id << wxT(".png");
if (!wxFileExists(path)) {
/* This is a debug message only, since for built-in IDs like
* wxART_DELETE this will just fall through to the wxWidgets
* default provider and isn't an error. */
wxLogDebug(wxT("Requested image ID: %s; NOT FOUND as %s"), id.c_str(), path.c_str());
return wxNullBitmap;
}
wxLogDebug(wxT("Requested image ID: %s; found as %s"), id.c_str(), path.c_str());
wxImage image(path, wxBITMAP_TYPE_PNG);
#else
wxString path;
path << wxT(PREFIX) << wxT("/share/dubnium/") << id << wxT(".png");
if (!wxFileExists(path)) {
return wxNullBitmap;
}
wxImage image(path, wxBITMAP_TYPE_PNG);
#endif
/* There seems to be a tendency for wxArtProvider to request images of
* size (-1, -1), so we need to avoid trying to rescale for them. */
if (wxSize(image.GetWidth(), image.GetHeight()) != size && size.GetWidth() > 0 && size.GetHeight() > 0) {
wxLogDebug(wxT("Requested width: %d; height: %d"), size.GetWidth(), size.GetHeight());
image.Rescale(size.GetWidth(), size.GetHeight(), wxIMAGE_QUALITY_HIGH);
}
return wxBitmap(image);
}
示例5: Align
wxPoint Align(wxSize referenceSize, wxSize objectSize, AlignmentDefinition alignment) {
int x = 0;
int y = 0;
if (alignment.GetHorizontal() == HA_LEFT) x = 0;
if (alignment.GetHorizontal() == HA_CENTER) x = (referenceSize.GetWidth() - objectSize.GetWidth()) / 2;
if (alignment.GetHorizontal() == HA_RIGHT) x = referenceSize.GetWidth() - objectSize.GetWidth();
if (alignment.GetVertical() == VA_TOP) y = 0;
if (alignment.GetVertical() == VA_CENTER) y = (referenceSize.GetHeight() - objectSize.GetHeight()) / 2;
if (alignment.GetVertical() == VA_BOTTOM) y = referenceSize.GetHeight() - objectSize.GetHeight();
return wxPoint(x, y);
}
示例6: wxDialog
ConfigDialog::ConfigDialog ( wxWindow * parent, wxWindowID id, const wxString & title,
config::Config *c,
const wxPoint & position, const wxSize & size, long style )
: wxDialog( parent, id, title, position, size, style)
{
config = c;
wxString dimensions = "", s;
wxPoint p;
wxSize sz, sizebox;
sz.SetWidth(size.GetWidth() - 20);
sz.SetHeight(size.GetHeight() - 70);
sizebox.SetWidth(size.GetWidth()/2 - 10);
sizebox.SetHeight(20);
p.x = 6; p.y = 2;
//s.Printf(_(" x = %d y = %d\n"), p.x, p.y);
dimensions.append(s);
// s.Printf(_(" width = %d height = %d\n"), sz.GetWidth(), sz.GetHeight());
dimensions.append(s);
dimensions.append("");
raioText = new wxTextCtrl ( this, -1, dimensions, wxPoint(size.GetWidth()/2, 2),
sizebox, wxTE_MULTILINE );
chkDesenhaPontos = new wxCheckBox (this, -1, "desenha pontos", p);
p.y += sizebox.GetHeight() + 2;
chkDesenhaContornos = new wxCheckBox (this, -1, "desenha contornos", p);
p.y += sizebox.GetHeight() + 2;
chkDesenhaMapa = new wxCheckBox (this, -1, "desenha mapa", p);
p.y += sizebox.GetHeight() + 2;
chkDesenhaVeiculos = new wxCheckBox (this, -1, "mostra veiculos", p);
chkDesenhaPontos->SetValue(config->getBool(CONFIG_DESENHA_PONTOS));
chkDesenhaContornos->SetValue(config->getBool(CONFIG_DESENHA_CONTORNOS));
chkDesenhaMapa->SetValue(config->getBool(CONFIG_DESENHA_MAPA));
chkDesenhaVeiculos->SetValue(config->getBool(CONFIG_DESENHA_VEICULOS));
//
// raioText = new wxTextCtrl ( this, -1, dimensions, wxPoint(size.GetWidth()/2, 2),
// sizebox, wxTE_MULTILINE );
p.y += size.GetHeight() - 70;
wxButton * b = new wxButton( this, wxID_OK, _("OK"), p, wxDefaultSize );
p.x += 100;
wxButton * b2 = new wxButton( this, wxID_CANCEL, _("Cancel"), p, wxDefaultSize );
raio = "";
Bind(wxEVT_COMMAND_BUTTON_CLICKED, &ConfigDialog::OnOk,
this, b->GetId());
}
示例7: DrawKDETheme
static void DrawKDETheme(wxDC& dc,wxSize size)
{
wxPen pen;
pen.SetStyle(wxSOLID);
wxBrush brush(kdetheme[13],wxSOLID);
dc.SetBackground(brush);
dc.Clear();
for(int i=0;i<14;i++) {
pen.SetColour(kdetheme[i]);
dc.SetPen(pen);
dc.DrawLine(0,i,size.GetWidth()-1,i);
dc.DrawLine(0,size.GetHeight()-1-i,
size.GetWidth()-1,size.GetHeight()-1-i);
}
};
示例8: loadBitmapFromFile
wxBitmap ArtProvider::loadBitmapFromFile(const wxArtID& id, wxSize size)
{
wxString name(id.Lower());
if (name.substr(0, 4) == "art_")
name.erase(0, 4);
if (size == wxDefaultSize)
size = wxSize(32, 32);
wxFileName fname(config().getImagesPath() + name
+ wxString::Format("_%dx%d", size.GetWidth(), size.GetHeight()));
wxArrayString imgExts;
imgExts.Add("png");
imgExts.Add("xpm");
imgExts.Add("bmp");
for (size_t i = 0; i < imgExts.GetCount(); ++i)
{
fname.SetExt(imgExts[i]);
wxLogDebug("Trying to load image file \"%s\"",
fname.GetFullPath().c_str());
if (fname.FileExists())
{
wxImage img(fname.GetFullPath());
if (img.IsOk() && wxSize(img.GetWidth(), img.GetHeight()) == size)
return wxBitmap(img);
}
}
return wxNullBitmap;
}
示例9: SetWindowSize
void edSETTINGS::SetWindowSize(const wxSize& size)
{
if (size.GetWidth() > 0 || size.GetHeight() > 0)
{
mWindowSize = size;
}
}
示例10: s
std::list<wxString> CThemeProvider::GetSearchDirs(const wxSize& size)
{
const int s(size.GetWidth());
// Sort order:
// - Current theme before general resource dir
// - Try current size first
// - Then try scale down next larger icon
// - Then try scaling up next smaller icon
int sizes[] = { 48,32,24,20,16 };
const int count = static_cast<int>(sizeof(sizes) / sizeof(int));
std::list<wxString> sizeStrings;
for (int i = 0; i < count && sizes[i] > s; ++i)
sizeStrings.push_front(SubdirFromSize(sizes[i]));
for (int i = 0; i < count; ++i)
if (sizes[i] < s)
sizeStrings.push_back(SubdirFromSize(sizes[i]));
sizeStrings.push_front(SubdirFromSize(s));
std::list<wxString> dirs;
for (std::list<wxString>::const_iterator it = sizeStrings.begin(); it != sizeStrings.end(); ++it)
dirs.push_back(m_themePath + *it);
const wxString resourceDir(wxGetApp().GetResourceDir());
for (std::list<wxString>::const_iterator it = sizeStrings.begin(); it != sizeStrings.end(); ++it)
dirs.push_back(resourceDir + *it);
return dirs;
}
示例11: wxDialog
ListaDialog::ListaDialog ( wxWindow * parent, wxWindowID id, const wxString & title,
const std::string lista,
const wxPoint & position, const wxSize & size, long style )
: wxDialog( parent, id, title, position, size, style)
{
wxPoint p;
wxSize sz;
wxString text = "";
text.append (lista);
sz.SetWidth(size.GetWidth() - 20);
sz.SetHeight(size.GetHeight() - 70);
p.x = 6; p.y = 2;
dialogText = new wxTextCtrl ( this, -1, text, p, sz, wxTE_MULTILINE );
p.y += sz.GetHeight() + 10;
wxButton * b = new wxButton( this, wxID_OK, _("OK"), p, wxDefaultSize );
p.x += 110;
Bind(wxEVT_COMMAND_BUTTON_CLICKED, &ListaDialog::OnOk,
this, b->GetId());
}
示例12: SetPadding
void wxNotebook::SetPadding( const wxSize &padding )
{
wxCHECK_RET( m_widget != NULL, wxT("invalid notebook") );
m_padding = padding.GetWidth();
int i;
#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 (i=0; i<int(GetPageCount()); i++)
{
wxGtkNotebookPage* nb_page = GetNotebookPage(i);
wxASSERT(nb_page != NULL);
if (nb_page->m_image != -1)
{
// gtk_box_set_child_packing sets padding on BOTH sides
// icon provides left padding, label provides center and right
int image = nb_page->m_image;
SetPageImage(i,-1);
SetPageImage(i,image);
}
wxASSERT(nb_page->m_label);
gtk_box_set_child_packing(GTK_BOX(nb_page->m_box),
GTK_WIDGET(nb_page->m_label),
FALSE, FALSE, m_padding, GTK_PACK_END);
}
}
示例13: SetBaseRenderBin
tcGameOutcomePopup::tcGameOutcomePopup(const wxPoint& pos, const wxSize& size)
: tc3DWindow2(parent, pos, size, "GameOutcome", parent)
{
SetBaseRenderBin(parent->GetBaseRenderBin() + 10);
Raise();
birthCount = tcTime::Get()->Get30HzCount();
SetBorderDraw(true);
int w = 70;
int h = 15;
int x = (size.GetWidth() - w) / 2;
int y = size.GetHeight() - 25;
tcButton* exitButton = new tcButton(this, wxPoint(x - w, y), wxSize(w, h), "XBUTTON");
exitButton->SetCaption("EXIT GAME");
exitButton->SetFontSize(fontSize + 2.0f);
exitButton->SetOffColor(Vec4(0.2f, 0.2f, 0.2f, 0.5f));
exitButton->SetOverColor(Vec4(0.25f, 0.25f, 0.25f, 0.5f));
exitButton->SetCommand(86);
tcButton* continueButton = new tcButton(this, wxPoint(x + w, y), wxSize(w, h), "XBUTTON");
continueButton->SetCaption("PLAY ON");
continueButton->SetFontSize(fontSize + 2.0f);
continueButton->SetOffColor(Vec4(0.2f, 0.2f, 0.2f, 0.5f));
continueButton->SetOverColor(Vec4(0.25f, 0.25f, 0.25f, 0.5f));
continueButton->SetCommand(123);
}
示例14: InitialState
void ClippingBoxTestCaseBase::InitialState()
{
// Initial clipping box should be the same as the entire DC surface.
m_dc->SetBackground(wxBrush(s_fgColour, wxBRUSHSTYLE_SOLID));
m_dc->Clear();
CheckBox(0, 0, s_dcSize.GetWidth(), s_dcSize.GetHeight());
}
示例15: img
cBitmap2ButtonEx::cBitmap2ButtonEx(
wxWindow *parent,
wxWindowID id,
const wxString& fileName,
const wxPoint& pos,
const wxSize& size,
long style,
BUTTON2_TYPE::TYPE buttonImageType
)
: cBitmap3ButtonEx(parent, id, pos, size, style)
, m_buttonImgType(buttonImageType)
{
int w = size.GetWidth();
int h = size.GetHeight();
if (!fileName.IsEmpty())
{
wxImage img(fileName + _("_0") + GetFileExt());
w = img.GetWidth();
h = img.GetHeight();
}
SetMinSize(wxSize(w, h));
// 버튼이미지 업데이트
SetButton2Bitmap(fileName);
}