Пример #1
0
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;
}
Пример #2
0
 void AGGWindow::onSize(wxSizeEvent& event) {
     const wxSize size = GetClientSize();
     if (bitmap && size.GetWidth() == bitmap->GetWidth() && size.GetHeight() == bitmap->GetHeight())
         return;
     
     init(size.GetWidth(), size.GetHeight());
 }
Пример #3
0
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);
}
Пример #4
0
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;
}
Пример #5
0
// 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
0
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
0
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
0
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;
    }
}
Пример #9
0
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());
}
Пример #10
0
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);
	}
}
Пример #11
0
// {{{ 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);
}
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
0
    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);
    }
Пример #14
0
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);
    }
};
Пример #15
0
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);
}
Пример #16
0
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());


}
Пример #17
0
ConfigDialog::ConfigDialog ( wxWindow * parent, wxWindowID id, const wxString & title,
                           const wxPoint & position, const wxSize & size, long style )
: wxDialog( parent, id, title, position, size, style)
{
	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 );

	p.y += sz.GetHeight() + 10;
	wxButton * b = new wxButton( this, wxID_OK, _("OK"), p, wxDefaultSize );
	p.x += 110;
	wxButton * c = new wxButton( this, wxID_CANCEL, _("Cancel"), p, wxDefaultSize );

	raio = "";
	Bind(wxEVT_COMMAND_BUTTON_CLICKED, &ConfigDialog::OnOk,
	            this, b->GetId());
}
Пример #18
0
/* My frame constructor */
OSGPanel::OSGPanel( wxWindow* parent, wxWindowID id, const wxPoint& pos,
				   const wxSize& size, long style ) 
				   : wxPanel( parent, id, pos, size, style )
{
	// create osg canvas
	//    - initialize
	int width, height;
	width = size.GetWidth();
	height = size.GetHeight();

	int *attributes = new int[7];
	attributes[0] = int(WX_GL_DOUBLEBUFFER);
	attributes[1] = WX_GL_RGBA;
	attributes[2] = WX_GL_DEPTH_SIZE;
	attributes[3] = 8;
	attributes[4] = WX_GL_STENCIL_SIZE;
	attributes[5] = 8;
	attributes[6] = 0;

	_canvas = new OSGCanvas(this, wxID_ANY, wxDefaultPosition,
		wxSize(width, height), wxNO_BORDER, wxT("osgviewerWX"), attributes);

	GraphicsWindowWX* gw = new GraphicsWindowWX(_canvas);

	_canvas->SetGraphicsWindow(gw);

	_viewer = new osgViewer::Viewer;
	_viewer->getCamera()->setGraphicsContext(gw);
	_viewer->getCamera()->setViewport(0, 0, width, height);
	_viewer->addEventHandler(new osgViewer::StatsHandler);
	_viewer->addEventHandler(SmartSingleton<KeyboardHandler>::getInstance());
	_viewer->addEventHandler(new osgViewer::WindowSizeHandler);

	_viewer->setThreadingModel(osgViewer::Viewer::SingleThreaded);
}
Пример #19
0
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());
}
Пример #20
0
void edSETTINGS::SetWindowSize(const wxSize& size)
{
  if (size.GetWidth() > 0 || size.GetHeight() > 0)
  {
    mWindowSize = size;
  }
}
Пример #21
0
LineChart::LineChart(		wxWindow *parent,
							wxWindowID id,
							const wxPoint &pos,
							const wxSize &size)
							: wxWindow(parent, id, pos, size),
								m_viewOffsetFactor(0),
								m_markerIndex(0),
								_zoomPercentage(DEFAULT_ZOOM),
								_currentWidth(0),
								_currentHeight(0),
								_memBitmap(NULL),
								_backgroundColor(*wxBLACK),
								m_showScale(true),
								m_showData(false),
								m_mouseX(0),
								m_mouseY(0),
								m_leftEdge(0)
{
	if (parent){
		SetBackgroundColour(parent->GetBackgroundColour());
	}
	else{
		SetBackgroundColour(*wxBLACK);
	}
	_currentWidth = size.GetWidth();
	_currentHeight = size.GetHeight();
	_memBitmap = new wxBitmap(_currentWidth, _currentHeight);
	m_leftEdge = 0;
}
Пример #22
0
wxlCan::wxlCan( wxWindow *parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style ):
    wxScrolledWindow( parent, id, pos, size, style )
{
    m_luastate = NULL;

    int w,h;

    GetVirtualSize( &w, &h );

    m_buffer = wxBitmap( size.GetWidth(), size.GetHeight() );
    m_pendingObjects = false;

    //set one to one mapping as default
    m_xpp = 1;
    m_ypp = 1;

    m_virt_minX = 0;
    m_virt_minY = 0;

    m_transx = 0;
    m_transy = 0;

    m_scalex = 1;
    m_scaley = 1;

    m_rootobject.SetCanvas( this );

    m_hit = NULL;

    m_cmdh = new wxlLuaCanCmd( this );
}
Пример #23
0
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;
}
Пример #24
0
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);

}
Пример #25
0
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;
}
Пример #26
0
static bool OutOfRoom(wxSize frameSize, double camX, double camY, int margin)
{
    return camX < margin ||
        camY < margin ||
        camX >= frameSize.GetWidth() - margin ||
        camY >= frameSize.GetHeight() - margin;
}
Пример #27
0
    void RenderCanvas::Init(  )
    {
        // must be called explicitly after the parent frame is opened
		const wxSize clientSize = GetClientSize();
		m_RenderManager->GetRenderProfile()->OpenScreen( clientSize.GetWidth(), clientSize.GetHeight(), 0, "" );
		Activate( true );
    }
Пример #28
0
bool COptionsPage::CreatePage(COptions* pOptions, CSettingsDialog* pOwner, wxWindow* parent, wxSize& maxSize)
{
	m_pOwner = pOwner;
	m_pOptions = pOptions;

	if (!wxXmlResource::Get()->LoadPanel(this, parent, GetResourceName()))
		return false;

	wxSize size = GetSize();

#ifdef __WXGTK__
	// wxStaticBox draws its own border coords -1.
	// Adjust this window so that the left border is fully visible.
	Move(1, 0);
	size.x += 1;
#endif

	if (size.GetWidth() > maxSize.GetWidth())
		maxSize.SetWidth(size.GetWidth());
	if (size.GetHeight() > maxSize.GetHeight())
		maxSize.SetHeight(size.GetHeight());

	m_was_selected = false;

	return true;
}
Пример #29
0
QSize  wxQtConvertSize( const wxSize &size )
{
    if (size == wxDefaultSize)
        return QSize();

    return QSize(size.GetWidth(), size.GetHeight());
}
Пример #30
-1
//=================================================================================
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;
}