本文整理汇总了C++中wxSize::GetHeight方法的典型用法代码示例。如果您正苦于以下问题:C++ wxSize::GetHeight方法的具体用法?C++ wxSize::GetHeight怎么用?C++ wxSize::GetHeight使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类wxSize
的用法示例。
在下文中一共展示了wxSize::GetHeight方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Create
bool wxLEDPanel::Create(wxWindow* parent, wxWindowID id, const wxSize& ledsize,
const wxSize& fieldsize, int padding, const wxPoint& pos,
long style, const wxValidator& validator)
{
// save in member
m_ledsize=ledsize;
m_padding=padding;
wxSize size;
size.SetWidth((ledsize.GetWidth()+padding)*fieldsize.GetWidth()+padding);
size.SetHeight((ledsize.GetHeight()+padding)*fieldsize.GetHeight()+padding);
// create the control
if(!wxControl::Create(parent,id,pos,size,style,validator))
return false;
// initialise MatrixObjekt
m_field.Init(0,fieldsize.GetWidth(),fieldsize.GetHeight());
// default backgroundcolor is black (call parent, to prevent the call of PrepareBackground)
wxWindow::SetBackgroundColour(*wxBLACK);
// default led-color is red
this->SetLEDColour(wxLED_COLOUR_RED);
// no Input Events
this->Enable(false);
// bind timer
m_scrollTimer.SetOwner(this,TIMER_SCROLL_ID);
return true;
}
示例2: CheckOnScreen
void CheckOnScreen(wxWindow *win, wxPoint &pos, wxSize &size, const int w0, const int h0)
{
wxRect rect;
int scrH, scrW;
wxSize screenSize = wxGetDisplaySize();
scrW = screenSize.x;
scrH = screenSize.y;
if (pos.x > scrW - w0)
pos.x = scrW - w0;
if (pos.y > scrH - h0)
pos.y = scrH - h0;
if (pos.x < 0)
pos.x = 0;
if (pos.y < 0)
pos.y = 0;
if (size.GetWidth() < w0)
size.SetWidth(w0);
if (size.GetHeight() < h0)
size.SetHeight(h0);
if (size.GetWidth() > scrW)
size.SetWidth(scrW);
if (size.GetHeight() > scrH)
size.SetHeight(scrH);
}
示例3: Create
bool kwxAngularRegulator::Create(wxWindow* parent, const wxWindowID id, const wxPoint& pos, const wxSize& size, const long int style)
{
if(!wxWindow::Create(parent, id, pos, size, style))
return false;
if (parent)
SetBackgroundColour(parent->GetBackgroundColour());
else
SetBackgroundColour(*wxLIGHT_GREY);
SetAutoLayout(TRUE);
Refresh();
m_nClientWidth = size.GetWidth() ;
m_nClientHeight = size.GetHeight() ;
m_nStato = 0 ;
m_nRealVal = 0 ;
m_nScaledVal = 0 ;
m_nTags = 0 ;
m_cExtCircle = *wxLIGHT_GREY ;
m_cIntCircle = *wxLIGHT_GREY ;
m_cLimitsColour = *wxBLACK ;
m_cKnobBorderColour = *wxBLACK ;
m_cKnobColour = *wxLIGHT_GREY ;
m_cTagsColour = *wxBLACK ;
membitmap = new wxBitmap(size.GetWidth(), size.GetHeight()) ;
return true;
}
示例4: CalcContinuumGeometry
//=================================================================================
void SliderControlBase::CalcContinuumGeometry( ContinuumGeometry& continuumGeometry, const wxSize& size )
{
continuumGeometry.radius = size.GetHeight() / 2;
continuumGeometry.leftMostPos.x = continuumGeometry.radius;
continuumGeometry.leftMostPos.y = size.GetHeight() / 2;
continuumGeometry.rightMostPos.x = size.GetWidth() - continuumGeometry.radius;
continuumGeometry.rightMostPos.y = size.GetHeight() / 2;
}
示例5: PrepareIcon
// This function converts to the right size with the given background colour
wxBitmap PrepareIcon(wxIcon icon, wxSize size)
{
if (icon.GetWidth() == size.GetWidth() && icon.GetHeight() == size.GetHeight())
return icon;
wxBitmap bmp;
bmp.CopyFromIcon(icon);
return bmp.ConvertToImage().Rescale(size.GetWidth(), size.GetHeight());
}
示例6: fit
void BubbleHardwareManager::fit(const wxSize& size)
{
//##Crear un panel para alojar al comboBox del port, y que la imagen quede abajo: Además, armar todo esto
//con un flexGrid o algo por el estilo:
if (buttonMainImage)
{
//Margins:
float margin = 0.025;
int iconX = (int)(margin*size.GetWidth());
int iconY = (int)(margin*size.GetHeight());
if (comboBootPortName)
iconY += comboBootPortName->GetSize().GetHeight()*2;
int iconW = size.GetWidth() - 2*iconX;;
int iconH = 0;
//First, it tries to maximize witdh (including margins), and then calculates the corresponding height:
if (buttonMainImage->getImageDefault().GetHeight() > 0)
{
float ratio = ((float)buttonMainImage->getImageDefault().GetHeight()/(float)buttonMainImage->getImageDefault().GetWidth());
iconH = (int)(ratio*iconW);
}
//If the height is too large, maximizes height (including margins) to the available space, and recalculates the width:
if ((iconH + 2*iconY) > (size.GetHeight() - 75)) //##
{
iconH = size.GetHeight() - 75 - 2*iconY;
if (buttonMainImage->getImageDefault().GetWidth() > 0)
{
float ratio = ((float)buttonMainImage->getImageDefault().GetWidth()/(float)buttonMainImage->getImageDefault().GetHeight());
iconW = (int)(ratio*iconH);
}
}
//Finally, centers and scales the image:
iconX = (size.GetWidth() / 2) - (iconW / 2);
// if (buttonGoToDriversDir)
// {
// //20 is a hardcoded small margin:
// iconY = buttonGoToDriversDir->GetPosition().y + buttonGoToDriversDir->GetSize().GetHeight() + 20;
// }
iconY = (size.GetHeight() / 2) - (iconH / 2);
if (lblURL0)
{
//20 is a hardcoded small margin:
iconY = lblURL0->GetPosition().y + lblURL0->GetSize().GetHeight() + 20;
}
if (lblURL1)
{
//20 is a hardcoded small margin:
iconY = lblURL1->GetPosition().y + lblURL1->GetSize().GetHeight() + 20;
}
buttonMainImage->Move(iconX, iconY); //First moves the buttonMethod.
buttonMainImage->SetSize(iconW, iconH);
//buttonMainImage->Lower();
}
}
示例7: Create
bool wxDrawerWindow::Create(wxWindow *parent,
wxWindowID id, const wxString& WXUNUSED(title),
wxSize size, wxDirection edge, const wxString& name)
{
wxASSERT_MSG(NULL != parent, wxT("wxDrawerWindows must be attached to a parent window."));
// Constrain the drawer size to the parent window.
const wxSize parentSize(parent->GetClientSize());
if (wxLEFT == edge || wxRIGHT == edge)
{
if (size.GetHeight() > parentSize.GetHeight())
size.SetHeight(parentSize.GetHeight() - (kLeadingOffset + kTrailingOffset));
}
else
{
if (size.GetWidth() > parentSize.GetWidth())
size.SetWidth(parentSize.GetWidth() - (kLeadingOffset + kTrailingOffset));
}
// Create the drawer window.
const wxPoint pos(0, 0);
const wxSize dummySize(0,0);
const long style = wxFRAME_DRAWER;
bool success = wxNonOwnedWindow::Create(parent, id, pos, size, style, name);
if (success)
{
// this->MacCreateRealWindow(pos, size, style, name);
success = (GetWXWindow() != NULL);
}
if (success)
{
// Use drawer brush.
SetBackgroundColour( wxColour( wxMacCreateCGColorFromHITheme( kThemeBrushDrawerBackground ) ) );
::SetThemeWindowBackground((WindowRef)GetWXWindow(), kThemeBrushDrawerBackground, false);
// Leading and trailing offset are gaps from parent window edges
// to where the drawer starts.
::SetDrawerOffsets((WindowRef)GetWXWindow() , kLeadingOffset, kTrailingOffset);
// Set the drawers parent.
// Is there a better way to get the parent's WindowRef?
wxTopLevelWindow* tlwParent = wxDynamicCast(parent, wxTopLevelWindow);
if (NULL != tlwParent)
{
OSStatus status = ::SetDrawerParent((WindowRef) GetWXWindow(),
(WindowRef)tlwParent->GetWXWindow());
success = (noErr == status);
}
else
success = false;
}
return success && SetPreferredEdge(edge);
}
示例8: 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());
}
示例9: MakeFit
wxSize MakeFit(const wxSize& original, const wxSize& bounds)
{
if ((bounds.GetWidth() <= 0) || (bounds.GetHeight() <= 0))
return wxSize(0, 0);
int sizex = (original.GetWidth() * bounds.GetHeight()) / original.GetHeight();
if (sizex <= bounds.GetWidth()) {
return wxSize(sizex, bounds.GetHeight());
} else {
int sizey = (original.GetHeight() * bounds.GetWidth()) / original.GetWidth();
return wxSize(bounds.GetWidth(), sizey);
}
}
示例10: 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);
}
示例11: 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);
}
示例12: 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());
}
示例13: 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);
}
};
示例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: Init
bool usImage::Init(const wxSize& size)
{
// Allocates space for image and sets params up
// returns true on error
int prev = NPixels;
NPixels = size.GetWidth() * size.GetHeight();
Size = size;
Subframe = wxRect(0, 0, 0, 0);
Min = Max = 0;
if (NPixels != prev)
{
delete[] ImageData;
if (NPixels)
{
ImageData = new unsigned short[NPixels];
if (!ImageData)
{
NPixels = 0;
return true;
}
}
else
ImageData = NULL;
}
return false;
}