mirror of
https://github.com/alexkay/spek.git
synced 2025-04-16 08:40:33 +03:00
SpekWindow
This commit is contained in:
parent
71bff01768
commit
1b62d0dd3a
@ -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)
|
||||
|
||||
|
@ -1,7 +1,9 @@
|
||||
bin_PROGRAMS = spek
|
||||
|
||||
spek_SOURCES = \
|
||||
spek.cc
|
||||
spek.cc \
|
||||
spek-window.h \
|
||||
spek-window.cc
|
||||
|
||||
spek_CPPFLAGS = \
|
||||
-include config.h \
|
||||
|
41
src/spek-window.cc
Normal file
41
src/spek-window.cc
Normal file
@ -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
|
||||
);
|
||||
}
|
21
src/spek-window.h
Normal file
21
src/spek-window.h
Normal file
@ -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
|
68
src/spek.cc
68
src/spek.cc
@ -1,68 +1,18 @@
|
||||
#include <wx/wx.h>
|
||||
|
||||
class MyApp: public wxApp
|
||||
#include "spek-window.h"
|
||||
|
||||
class Spek: public wxApp
|
||||
{
|
||||
virtual bool OnInit();
|
||||
};
|
||||
|
||||
class MyFrame: public wxFrame
|
||||
IMPLEMENT_APP(Spek)
|
||||
|
||||
bool Spek::OnInit()
|
||||
{
|
||||
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 );
|
||||
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 );
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user