commit 71bff01768f1471a3a1e5d0e95f6ea89d278af69
parent d4a5f322f0f9911ab64b13d147d3e2cc3681c9f2
Author: Alexander Kojevnikov <alexander@kojevnikov.com>
Date: Sun, 5 Aug 2012 16:28:32 -0700
Hello, wxWidgets!
Diffstat:
3 files changed, 94 insertions(+), 5 deletions(-)
diff --git a/configure.ac b/configure.ac
@@ -11,12 +11,32 @@ AC_PROG_CXX
AC_PROG_INSTALL
IT_PROG_INTLTOOL([0.35])
+AC_CHECK_LIB(m, log10)
+
pkg_modules="libavformat >= 52.111 libavcodec >= 52.123 libavutil"
PKG_CHECK_MODULES(SPEK, [$pkg_modules])
AC_SUBST(SPEK_CFLAGS)
AC_SUBST(SPEK_LIBS)
-AC_CHECK_LIB(m, log10)
+AM_OPTIONS_WXCONFIG
+reqwx=2.8.0
+AM_PATH_WXCONFIG($reqwx, wxWin=1)
+if test "$wxWin" != 1; then
+ AC_MSG_ERROR([
+ wxWidgets must be installed on your system.
+
+ Please check that wx-config is in path, the directory
+ where wxWidgets libraries are installed (returned by
+ 'wx-config --libs' or 'wx-config --static --libs' command)
+ is in LD_LIBRARY_PATH or equivalent variable and
+ wxWidgets version is $reqwx or above.
+ ])
+fi
+
+CPPFLAGS="$CPPFLAGS $WX_CPPFLAGS"
+CXXFLAGS="$CXXFLAGS $WX_CXXFLAGS_ONLY"
+CFLAGS="$CFLAGS $WX_CFLAGS_ONLY"
+LIBS="$LIBS $WX_LIBS"
GETTEXT_PACKAGE=spek
AC_DEFINE_UNQUOTED([GETTEXT_PACKAGE], ["$GETTEXT_PACKAGE"], [Gettext Package])
diff --git a/src/Makefile.am b/src/Makefile.am
@@ -3,12 +3,19 @@ bin_PROGRAMS = spek
spek_SOURCES = \
spek.cc
-AM_CPPFLAGS = \
+spek_CPPFLAGS = \
-include config.h \
$(SPEK_CFLAGS) \
-DLOCALEDIR=\""$(localedir)"\" \
-DPKGDATADIR=\""$(pkgdatadir)"\" \
-DPKGLIBDIR=\""$(pkglibdir)"\"
+spek_CFLAGS = \
+ @CFLAGS@
+
+spek_CXXFLAGS = \
+ @CXXFLAGS@
+
spek_LDADD = \
+ @LIBS@ \
$(SPEK_LIBS)
diff --git a/src/spek.cc b/src/spek.cc
@@ -1,6 +1,68 @@
-#include <cstdio>
+#include <wx/wx.h>
-int main()
+class MyApp: public wxApp
{
- printf("Hello, world!\n");
+ 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);
+
+private:
+ 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()
+
+IMPLEMENT_APP(MyApp)
+
+bool MyApp::OnInit()
+{
+ MyFrame *frame = new MyFrame( wxT("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, wxT("&About...") );
+ menuFile->AppendSeparator();
+ menuFile->Append( ID_Quit, wxT("E&xit") );
+
+ wxMenuBar *menuBar = new wxMenuBar;
+ menuBar->Append( menuFile, wxT("&File") );
+
+ SetMenuBar( menuBar );
+
+ CreateStatusBar();
+ SetStatusText( wxT("Welcome to wxWidgets!") );
+}
+
+void MyFrame::OnQuit(wxCommandEvent& WXUNUSED(event))
+{
+ Close( true );
+}
+
+void MyFrame::OnAbout(wxCommandEvent& WXUNUSED(event))
+{
+ wxMessageBox( wxT("This is a wxWidgets' Hello world sample"),
+ wxT("About Hello World"), wxOK | wxICON_INFORMATION );
}