Anyway, I installed wxwidgets, but I can't get my application to include the library, even after hours of trying and googling, it just wont work >_< ... if anyone has any idea, then help would be appreciated, fast ^^ (assignment due friday)
Anyway, here is the code for anyone who is interested ...
base.h
Code: Select all
#ifndef BASE_H
#define BASE_H
class MyApp: public wxApp
{
public:
virtual bool OnInit();
};
class MyFrame: public wxFrame
{
public:
MyFrame(const wxString &title, const wxPoint &pos, const wxSize &size);
void OnQuit(wxCommandEvent &event);
void OnAbout(wxCommandEvent &event);
DECLARE_EVENT_TABLE()
};
enum
{
ID_Quit = 1,
ID_About,
};
BEGIN_EVENT_TABLE(MyFrame, wxFrame)
EVT_MENU(ID_Quit, MyFrame::OnQuit)
EVT_MENU(ID_About, MyFrame::OnAbout)
END_EVENT_TABLE()
#endif
base.cpp
Code: Select all
#include <wx/wx.h>
#include "base.h"
IMPLEMENT_APP(MyApp)
bool MyApp::OnInit()
{
MyFrame *frame = new MyFrame( _T("Hello World"), wxPoint(50,50), wxSize(450, 340));
frame -> Show(TRUE);
SetTopWindow(frame);
return TRUE;
}
MyFrame::MyFrame(const wxString &title, const wxPoint &pos, const wxSize &size): wxFrame((wxFrame *)NULL, -1, title, pos, size)
{
wxMenu *menuFile = new wxMenu;
menuFile -> Append(ID_About, _T("&About..."));
menuFile -> AppendSeperator();
MenuFile -> Append(ID_Quit, _T("E&xit"));
wxMenuBar *menuBar = new wxMenuBar;
menuBar -> Append(menuFile, _T("&File"));
SetmenuBar(menuBar);
CreateStatusBar();
SetStatusText( _T("Welcome to wxWidgets!"));
};
void MyFrame::OnQuit(wxCommandEvent &WXUNUSED(event))
{
Close(TRUE);
}
void Myframe::OnAbout(wxCommandEvent &WXUNUSED(event))
{
wxMessageBox(_T("This is a blabla box"), _T("About hello world"), wxOK | wxICON_INFORMATION, this);
}