Boa noite fiz uma pesquisa acabei descobrindo uma versão Dev c++ lida justamente com interface grafica do wxWidgets, conhecido como wxDev c++ numa tentativa criar uma calculdora claramente programação orientação objeto.
ai esta interface pronta porem ando tendo problemas com codigo, diferente do java implementações do metodo é fora da classe.
Meus codigo:
\\Calculadora.h
//-----------------------------------------------------------------
///
/// @file Calculadora.h
/// @author LeonardoPc
/// Created: 05/09/2022 22:12:28
/// @section DESCRIPTION
/// Calculadora class declaration
///
///------------------------------------------------------------------
#ifndef __CALCULADORA_H__
#define __CALCULADORA_H__
#ifdef __BORLANDC__
#pragma hdrstop
#endif
#ifndef WX_PRECOMP
#include <wx/wx.h>
#include <wx/frame.h>
#else
#include <wx/wxprec.h>
#endif
//Do not add custom headers between
//Header Include Start and Header Include End.
//wxDev-C++ designer will remove them. Add custom headers after the block.
////Header Include Start
#include <wx/xrc/xmlres.h>
#include <wx/xrc/xh_all.h>
#include <wx/button.h>
#include <wx/stattext.h>
#include <wx/panel.h>
////Header Include End
////Dialog Style Start
#undef Calculadora_STYLE
#define Calculadora_STYLE wxCAPTION | wxSYSTEM_MENU | wxMINIMIZE_BOX | wxCLOSE_BOX
////Dialog Style End
class Calculadora : public wxFrame
{
private:
DECLARE_EVENT_TABLE();
public:
Calculadora(wxWindow *parent, wxWindowID id = 1, const wxString &title = wxT("Calculadora"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = Calculadora_STYLE);
virtual ~Calculadora();
void WxButton2Click(wxCommandEvent& event);
void CalculadoraActivate(wxActivateEvent& event);
void WxEdit1Updated(wxCommandEvent& event);
void Wxnum8Click(wxCommandEvent& event);
void Wxnum1Click(wxCommandEvent& event);
void WxPanel1UpdateUI(wxUpdateUIEvent& event);
void WxButton1Click(wxCommandEvent& event);
public:
//Do not add custom control declarations between
//GUI Control Declaration Start and GUI Control Declaration End.
//wxDev-C++ will remove them. Add custom code after the block.
////GUI Control Declaration Start
wxButton *WxButton2;
wxButton *WxButton3;
wxButton *wxsomar;
wxButton *WxButton1;
wxButton *Wxmultiplicar;
wxButton *Wxvingular;
wxButton *Wxnum0;
wxButton *Wxponto;
wxButton *Wxnum3;
wxButton *Wxnum2;
wxButton *Wxnum1;
wxButton *wxnum6;
wxButton *Wxnum5;
wxButton *WXnum4;
wxButton *Wxnum9;
wxButton *Wxnum8;
wxButton *Wxnum7;
wxStaticText *WxStaticText1;
wxPanel *WxPanel1;
////GUI Control Declaration End
private:
//Note: if you receive any error with these enum IDs, then you need to
//change your old form code that are based on the #define control IDs.
//#defines may replace a numeric value for the enum names.
//Try copy and pasting the below block in your old form header files.
enum
{
////GUI Enum Control ID Start
ID_WXBUTTON2 = 1024,
ID_WXBUTTON3 = 1023,
ID_WXBUTTON2 = 1022,
ID_WXBUTTON1 = 1021,
ID_WXBUTTON1 = 1019,
ID_WXBUTTON1 = 1018,
ID_WXBUTTON1 = 1014,
ID_WXBUTTON1 = 1013,
ID_WXBUTTON2 = 1010,
ID_WXNUM9 = 1009,
ID_WXSTATICTEXT1 = 1006,
ID_WXPANEL1 = 1005,
////GUI Enum Control ID End
ID_DUMMY_VALUE_ //don't remove this value unless you have other enum values
};
private:
void OnClose(wxCloseEvent& event);
void CreateGUIControls();
};
#endif
//Calculadora.cpp
///-----------------------------------------------------------------
///
/// @file Calculadora.cpp
/// @author LeonardoPc
/// Created: 05/09/2022 22:12:28
/// @section DESCRIPTION
/// Calculadora class implementation
///
///------------------------------------------------------------------
#include "Calculadora.h"
//Do not add custom headers between
//Header Include Start and Header Include End
//wxDev-C++ designer will remove them
////Header Include Start
////Header Include End
//----------------------------------------------------------------------------
// Calculadora
//----------------------------------------------------------------------------
//Add Custom Events only in the appropriate block.
//Code added in other places will be removed by wxDev-C++
////Event Table Start
BEGIN_EVENT_TABLE(Calculadora,wxFrame)
////Manual Code Start
////Manual Code End
EVT_CLOSE(Calculadora::OnClose)
EVT_ACTIVATE(Calculadora::CalculadoraActivate)
EVT_BUTTON(XRCID(wxT("Wxmultiplicar")),Calculadora::WxButton1Click)
EVT_BUTTON(XRCID(wxT("Wxvingular")),Calculadora::Wxnum1Click)
EVT_BUTTON(XRCID(wxT("Wxnum0")),Calculadora::Wxnum1Click)
EVT_BUTTON(XRCID(wxT("Wxponto")),Calculadora::Wxnum1Click)
EVT_BUTTON(XRCID(wxT("Wxnum1")),Calculadora::Wxnum1Click)
EVT_BUTTON(XRCID(wxT("Wxnum8")),Calculadora::Wxnum8Click)
EVT_UPDATE_UI(XRCID(wxT("WxPanel1")),Calculadora::WxPanel1UpdateUI)
END_EVENT_TABLE()
////Event Table End
Calculadora::Calculadora(wxWindow *parent, wxWindowID id, const wxString &title, const wxPoint &position, const wxSize& size, long style)
: wxFrame(parent, id, title, position, size, style)
{
CreateGUIControls();
}
Calculadora::~Calculadora()
{
}
void Calculadora::CreateGUIControls()
{
//Do not add custom code between
//GUI Items Creation Start and GUI Items Creation End
//wxDev-C++ designer will remove them.
//Add the custom code before or after the blocks
////GUI Items Creation Start
WxPanel1 = wxXmlResource::Get()->LoadPanel(this,wxT("WxPanel1"));
WxStaticText1 = XRCCTRL(*WxPanel1, wxT("WxStaticText1"), wxStaticText);
Wxnum7 = XRCCTRL(*WxPanel1, wxT("Wxnum7"), wxButton);
Wxnum7->SetForegroundColour(wxColour(wxT("WHITE")));
Wxnum7->SetBackgroundColour(wxColour(wxT("BLACK")));
Wxnum8 = XRCCTRL(*WxPanel1, wxT("Wxnum8"), wxButton);
Wxnum8->SetForegroundColour(wxColour(wxT("WHITE")));
Wxnum8->SetBackgroundColour(wxColour(wxT("BLACK")));
Wxnum9 = XRCCTRL(*WxPanel1, wxT("Wxnum9"), wxButton);
Wxnum9->SetBackgroundColour(wxColour(wxT("BLACK")));
WXnum4 = XRCCTRL(*WxPanel1, wxT("WXnum4"), wxButton);
WXnum4->SetBackgroundColour(wxColour(wxT("BLACK")));
Wxnum5 = XRCCTRL(*WxPanel1, wxT("Wxnum5"), wxButton);
Wxnum5->SetBackgroundColour(wxColour(wxT("BLACK")));
wxnum6 = XRCCTRL(*WxPanel1, wxT("wxnum6"), wxButton);
wxnum6->SetBackgroundColour(wxColour(wxT("BLACK")));
Wxnum1 = XRCCTRL(*WxPanel1, wxT("Wxnum1"), wxButton);
Wxnum1->SetForegroundColour(wxColour(wxT("WHITE")));
Wxnum1->SetBackgroundColour(wxColour(wxT("BLACK")));
Wxnum2 = XRCCTRL(*WxPanel1, wxT("Wxnum2"), wxButton);
Wxnum2->SetBackgroundColour(wxColour(wxT("BLACK")));
Wxnum3 = XRCCTRL(*WxPanel1, wxT("Wxnum3"), wxButton);
Wxnum3->SetBackgroundColour(wxColour(wxT("BLACK")));
Wxponto = XRCCTRL(*WxPanel1, wxT("Wxponto"), wxButton);
Wxponto->SetForegroundColour(wxColour(wxT("WHITE")));
Wxponto->SetBackgroundColour(wxColour(wxT("BLACK")));
Wxnum0 = XRCCTRL(*WxPanel1, wxT("Wxnum0"), wxButton);
Wxnum0->SetForegroundColour(wxColour(wxT("WHITE")));
Wxnum0->SetBackgroundColour(wxColour(wxT("BLACK")));
Wxvingular = XRCCTRL(*WxPanel1, wxT("Wxvingular"), wxButton);
Wxvingular->SetForegroundColour(wxColour(wxT("WHITE")));
Wxvingular->SetBackgroundColour(wxColour(wxT("BLACK")));
Wxmultiplicar = XRCCTRL(*WxPanel1, wxT("Wxmultiplicar"), wxButton);
Wxmultiplicar->SetForegroundColour(wxColour(wxT("WHITE")));
Wxmultiplicar->SetBackgroundColour(wxColour(wxT("BLACK")));
Wxmultiplicar->SetFont(wxFont(14, wxSWISS, wxNORMAL, wxNORMAL, false));
WxButton1 = XRCCTRL(*WxPanel1, wxT("WxButton1"), wxButton);
WxButton1->SetForegroundColour(wxColour(wxT("WHITE")));
WxButton1->SetBackgroundColour(wxColour(000,000,000));
WxButton1->SetFont(wxFont(9, wxSWISS, wxNORMAL, wxNORMAL, false, wxT("Arial Narrow")));
wxsomar = XRCCTRL(*WxPanel1, wxT("wxsomar"), wxButton);
wxsomar->SetForegroundColour(wxColour(wxT("WHITE")));
wxsomar->SetBackgroundColour(wxColour(wxT("BLACK")));
WxButton3 = XRCCTRL(*WxPanel1, wxT("WxButton3"), wxButton);
WxButton3->SetForegroundColour(wxColour(wxT("WHITE")));
WxButton3->SetBackgroundColour(wxColour(wxT("BLACK")));
WxButton2 = XRCCTRL(*WxPanel1, wxT("WxButton2"), wxButton);
WxButton2->SetForegroundColour(wxColour(wxT("WHITE")));
WxButton2->SetBackgroundColour(wxColour(wxT("BLACK")));
SetTitle(wxT("Calculadora"));
SetIcon(wxNullIcon);
SetSize(8,8,210,289);
Center();
////GUI Items Creation End
}
void Calculadora::OnClose(wxCloseEvent& event)
{
Destroy();
}
/*
* WxButton2Click
/*
* WxEdit1Updated
*/
void Calculadora::WxEdit1Updated(wxCommandEvent& event)
{
// insert your code here
}
/*
* Wxnum8Click
*/
void Calculadora::Wxnum8Click(wxCommandEvent& event)
{
// insert your code here
}
/*
* Wxnum1Click
*/
void Calculadora::Wxnum1Click(wxCommandEvent& event)
{
// insert your code here
}
/*
* WxPanel1UpdateUI
*/
void Calculadora::WxPanel1UpdateUI(wxUpdateUIEvent& event)
{
// insert your code here
}
/*
* WxButton1Click
*/
void Calculadora::WxButton1Click(wxCommandEvent& event)
{
// insert your code here
}
sem conta tbm utiliza recurso html.