commit 1b62d0dd3ad8c673613a29721d54f2afea5a1a12
parent 71bff01768f1471a3a1e5d0e95f6ea89d278af69
Author: Alexander Kojevnikov <alexander@kojevnikov.com>
Date: Sun, 5 Aug 2012 17:23:29 -0700
SpekWindow
Diffstat:
5 files changed, 76 insertions(+), 64 deletions(-)
diff --git a/configure.ac b/configure.ac
@@ -1,15 +1,13 @@
AC_INIT([spek],[0.7])
AC_CONFIG_SRCDIR([src/spek.cc])
AC_CONFIG_HEADERS([config.h])
-AM_INIT_AUTOMAKE([1.11 foreign no-dist-gzip dist-xz])
-AM_SILENT_RULES
-
-AM_MAINTAINER_MODE
+AM_INIT_AUTOMAKE([1.11.1 foreign no-dist-gzip dist-xz])
+AM_SILENT_RULES([yes])
AC_PROG_CC_C99
AC_PROG_CXX
AC_PROG_INSTALL
-IT_PROG_INTLTOOL([0.35])
+IT_PROG_INTLTOOL([0.40.0])
AC_CHECK_LIB(m, log10)
diff --git a/src/Makefile.am b/src/Makefile.am
@@ -1,7 +1,9 @@
bin_PROGRAMS = spek
spek_SOURCES = \
- spek.cc
+ spek.cc \
+ spek-window.h \
+ spek-window.cc
spek_CPPFLAGS = \
-include config.h \
diff --git a/src/spek-window.cc b/src/spek-window.cc
@@ -0,0 +1,41 @@
+#include "spek-window.h"
+
+enum
+{
+ ID_Quit = 1,
+ ID_About,
+};
+
+BEGIN_EVENT_TABLE(SpekWindow, wxFrame)
+ EVT_MENU(ID_Quit, SpekWindow::OnQuit)
+ EVT_MENU(ID_About, SpekWindow::OnAbout)
+END_EVENT_TABLE()
+
+SpekWindow::SpekWindow(const wxString& title, const wxPoint& pos, const wxSize& size)
+ : 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);
+}
+
+void SpekWindow::OnQuit(wxCommandEvent& WXUNUSED(event))
+{
+ Close(true);
+}
+
+void SpekWindow::OnAbout(wxCommandEvent& WXUNUSED(event))
+{
+ wxMessageBox(
+ wxT("This is a wxWidgets' Hello world sample"),
+ wxT("About Hello World"),
+ wxOK | wxICON_INFORMATION
+ );
+}
diff --git a/src/spek-window.h b/src/spek-window.h
@@ -0,0 +1,21 @@
+// -*-c++-*-
+
+#ifndef SPEK_WINDOW_H_
+#define SPEK_WINDOW_H_
+
+#include <wx/wx.h>
+
+class SpekWindow : public wxFrame
+{
+public:
+ SpekWindow(const wxString& title, const wxPoint& pos, const wxSize& size);
+
+protected:
+ void OnQuit(wxCommandEvent& event);
+ void OnAbout(wxCommandEvent& event);
+
+private:
+ DECLARE_EVENT_TABLE()
+};
+
+#endif
diff --git a/src/spek.cc b/src/spek.cc
@@ -1,68 +1,18 @@
#include <wx/wx.h>
-class MyApp: public wxApp
-{
- 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);
+#include "spek-window.h"
-private:
- DECLARE_EVENT_TABLE()
-};
-
-enum
+class Spek: public wxApp
{
- ID_Quit = 1,
- ID_About,
+ virtual bool OnInit();
};
-BEGIN_EVENT_TABLE(MyFrame, wxFrame)
- EVT_MENU(ID_Quit, MyFrame::OnQuit)
- EVT_MENU(ID_About, MyFrame::OnAbout)
-END_EVENT_TABLE()
+IMPLEMENT_APP(Spek)
-IMPLEMENT_APP(MyApp)
-
-bool MyApp::OnInit()
+bool Spek::OnInit()
{
- MyFrame *frame = new MyFrame( wxT("Hello World"), wxPoint(50,50), wxSize(450,340) );
- frame->Show( true );
- SetTopWindow( frame );
+ SpekWindow *window = new SpekWindow(wxT("Hello World"), wxPoint(50,50), wxSize(450,340));
+ window->Show(true);
+ SetTopWindow(window);
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 );
-}