Yes, it's a GUI. I put a wxImage in this project by using the symbol of wxSmith. This is my entire code:
Code: Select all
/***************************************************************
* Name: createprodukt_testMain.cpp
* Purpose: Code for Application Frame
* Author: Thomas ()
* Created: 2018-04-15
* Copyright: Thomas ()
* License:
**************************************************************/
#include "createprodukt_testMain.h"
#include <wx/msgdlg.h>
#include <wx/bitmap.h>
#include <wx/log.h>
//(*InternalHeaders(createprodukt_testFrame)
#include <wx/intl.h>
#include <wx/string.h>
#include <wx/image.h>
#include <wx/dcclient.h>
//*)
//helper functions
enum wxbuildinfoformat {
short_f, long_f };
wxString wxbuildinfo(wxbuildinfoformat format)
{
wxString wxbuild(wxVERSION_STRING);
if (format == long_f )
{
#if defined(__WXMSW__)
wxbuild << _T("-Windows");
#elif defined(__UNIX__)
wxbuild << _T("-Linux");
#endif
#if wxUSE_UNICODE
wxbuild << _T("-Unicode build");
#else
wxbuild << _T("-ANSI build");
#endif // wxUSE_UNICODE
}
return wxbuild;
}
//(*IdInit(createprodukt_testFrame)
const long createprodukt_testFrame::ID_BUTTON1 = wxNewId();
const long createprodukt_testFrame::ID_PANEL1 = wxNewId();
const long createprodukt_testFrame::idMenuQuit = wxNewId();
const long createprodukt_testFrame::idMenuAbout = wxNewId();
const long createprodukt_testFrame::ID_STATUSBAR1 = wxNewId();
//*)
BEGIN_EVENT_TABLE(createprodukt_testFrame,wxFrame)
//(*EventTable(createprodukt_testFrame)
//*)
END_EVENT_TABLE()
createprodukt_testFrame::createprodukt_testFrame(wxWindow* parent,wxWindowID id)
{
//(*Initialize(createprodukt_testFrame)
wxMenuItem* MenuItem2;
wxMenuItem* MenuItem1;
wxBoxSizer* BoxSizer2;
wxMenu* Menu1;
wxBoxSizer* BoxSizer1;
wxMenuBar* MenuBar1;
wxMenu* Menu2;
Create(parent, id, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxDEFAULT_FRAME_STYLE, _T("id"));
BoxSizer1 = new wxBoxSizer(wxHORIZONTAL);
Panel1 = new wxPanel(this, ID_PANEL1, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL, _T("ID_PANEL1"));
BoxSizer2 = new wxBoxSizer(wxHORIZONTAL);
Button1 = new wxButton(Panel1, ID_BUTTON1, _("Label"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T("ID_BUTTON1"));
BoxSizer2->Add(Button1, 1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
Panel1->SetSizer(BoxSizer2);
BoxSizer2->Fit(Panel1);
BoxSizer2->SetSizeHints(Panel1);
BoxSizer1->Add(Panel1, 1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
SetSizer(BoxSizer1);
MenuBar1 = new wxMenuBar();
Menu1 = new wxMenu();
MenuItem1 = new wxMenuItem(Menu1, idMenuQuit, _("Quit\tAlt-F4"), _("Quit the application"), wxITEM_NORMAL);
Menu1->Append(MenuItem1);
MenuBar1->Append(Menu1, _("&File"));
Menu2 = new wxMenu();
MenuItem2 = new wxMenuItem(Menu2, idMenuAbout, _("About\tF1"), _("Show info about this application"), wxITEM_NORMAL);
Menu2->Append(MenuItem2);
MenuBar1->Append(Menu2, _("Help"));
SetMenuBar(MenuBar1);
StatusBar1 = new wxStatusBar(this, ID_STATUSBAR1, 0, _T("ID_STATUSBAR1"));
int __wxStatusBarWidths_1[1] = { -1 };
int __wxStatusBarStyles_1[1] = { wxSB_NORMAL };
StatusBar1->SetFieldsCount(1,__wxStatusBarWidths_1);
StatusBar1->SetStatusStyles(1,__wxStatusBarStyles_1);
SetStatusBar(StatusBar1);
Image1 = new wxImage();
Image1_BMP = new wxBitmap();
BoxSizer1->Fit(this);
BoxSizer1->SetSizeHints(this);
Connect(idMenuQuit,wxEVT_COMMAND_MENU_SELECTED,(wxObjectEventFunction)&createprodukt_testFrame::OnQuit);
Connect(idMenuAbout,wxEVT_COMMAND_MENU_SELECTED,(wxObjectEventFunction)&createprodukt_testFrame::OnAbout);
//*)
}
createprodukt_testFrame::~createprodukt_testFrame()
{
//(*Destroy(createprodukt_testFrame)
//*)
}
void createprodukt_testFrame::OnQuit(wxCommandEvent& event)
{
Close();
}
void createprodukt_testFrame::OnAbout(wxCommandEvent& event)
{
wxString msg = wxbuildinfo(long_f);
wxMessageBox(msg, _("Welcome to..."));
}
void createprodukt_testFrame::OnButton1Click(wxCommandEvent& event)
{
wxInitAllImageHandlers();
wxImage img;
bool Loadimage = img.LoadFile("C:\\programmieren\\images.jpg", wxBITMAP_TYPE_ANY, -1);
if ( img.IsOk() )
wxLogMessage("Image is OK");
else
wxLogError("Image is NOT OK");
img.SetOption(wxIMAGE_OPTION_QUALITY, 80);
img.SaveFile(wxT("c:\\programmieren\\test\\test.jpg"), wxBITMAP_TYPE_JPEG);
}
I'm sorry, I'm quite a beginner and I even don't know where to find the errors that the wxLog functions might set...