Inital fill in background, removed tabs, -1->wxID_ANY, TRUE->true, FALSE->false
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@27470 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -51,12 +51,13 @@ hack doesn't fix.
|
||||
|
||||
static int detail = 9; // CHANGE THIS... 7,8,9 etc
|
||||
|
||||
static bool running = FALSE;
|
||||
static bool running = false;
|
||||
static wxMenuBar *menuBar = NULL;
|
||||
|
||||
// Define a new application type
|
||||
class MyApp: public wxApp
|
||||
{ public:
|
||||
{
|
||||
public:
|
||||
bool OnInit();
|
||||
};
|
||||
|
||||
@@ -70,7 +71,8 @@ public:
|
||||
|
||||
void OnCloseWindow(wxCloseEvent& event);
|
||||
void OnExit(wxCommandEvent& event);
|
||||
DECLARE_EVENT_TABLE()
|
||||
|
||||
DECLARE_EVENT_TABLE()
|
||||
};
|
||||
|
||||
// Define a new canvas which can receive some events
|
||||
@@ -94,7 +96,7 @@ DECLARE_EVENT_TABLE()
|
||||
bool MyApp::OnInit()
|
||||
{
|
||||
// Create the main frame window
|
||||
MyFrame *frame = new MyFrame(NULL, _T("Fractal Mountains for wxWidgets"), wxPoint(-1, -1), wxSize(640, 480));
|
||||
MyFrame *frame = new MyFrame(NULL, _T("Fractal Mountains for wxWidgets"), wxDefaultPosition, wxSize(640, 480));
|
||||
|
||||
// Make a menubar
|
||||
wxMenu *file_menu = new wxMenu;
|
||||
@@ -109,9 +111,9 @@ bool MyApp::OnInit()
|
||||
(void) new MyCanvas(frame);
|
||||
|
||||
// Show the frame
|
||||
frame->Show(TRUE);
|
||||
frame->Show(true);
|
||||
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
BEGIN_EVENT_TABLE(MyFrame, wxFrame)
|
||||
@@ -121,7 +123,7 @@ END_EVENT_TABLE()
|
||||
|
||||
// My frame constructor
|
||||
MyFrame::MyFrame(wxFrame *frame, const wxString& title, const wxPoint& pos, const wxSize& size):
|
||||
wxFrame(frame, -1, title, pos, size, wxDEFAULT_FRAME_STYLE | wxFULL_REPAINT_ON_RESIZE)
|
||||
wxFrame(frame, wxID_ANY, title, pos, size, wxDEFAULT_FRAME_STYLE | wxFULL_REPAINT_ON_RESIZE )
|
||||
{
|
||||
}
|
||||
|
||||
@@ -133,13 +135,13 @@ void MyFrame::OnExit(wxCommandEvent& WXUNUSED(event))
|
||||
|
||||
void MyFrame::OnCloseWindow(wxCloseEvent& WXUNUSED(event))
|
||||
{
|
||||
static bool destroyed = FALSE;
|
||||
static bool destroyed = false;
|
||||
if (destroyed)
|
||||
return;
|
||||
|
||||
this->Destroy();
|
||||
|
||||
destroyed = TRUE;
|
||||
destroyed = true;
|
||||
}
|
||||
|
||||
BEGIN_EVENT_TABLE(MyCanvas, wxWindow)
|
||||
@@ -148,7 +150,7 @@ END_EVENT_TABLE()
|
||||
|
||||
// Define a constructor for my canvas
|
||||
MyCanvas::MyCanvas(wxFrame *frame):
|
||||
wxWindow(frame, -1)
|
||||
wxWindow(frame, wxID_ANY)
|
||||
{
|
||||
wxColour wxCol1(255,255,255);
|
||||
SnowPen = wxPen(wxCol1, 2, wxSOLID);
|
||||
@@ -166,6 +168,7 @@ MyCanvas::MyCanvas(wxFrame *frame):
|
||||
void MyCanvas::OnPaint(wxPaintEvent& WXUNUSED(event))
|
||||
{
|
||||
wxPaintDC dc(this);
|
||||
PrepareDC(dc);
|
||||
Draw(dc);
|
||||
}
|
||||
|
||||
@@ -173,11 +176,14 @@ void MyCanvas::Draw(wxDC& dc)
|
||||
{
|
||||
if (running) return;
|
||||
|
||||
running = TRUE;
|
||||
menuBar->EnableTop(0, FALSE);
|
||||
running = true;
|
||||
menuBar->EnableTop(0, false);
|
||||
|
||||
Randomize();
|
||||
|
||||
dc.SetBackground(*wxLIGHT_GREY_BRUSH);
|
||||
dc.Clear();
|
||||
|
||||
int Left, Top, Right, Bottom;
|
||||
GetClientSize(&Right, &Bottom);
|
||||
|
||||
@@ -203,8 +209,8 @@ void MyCanvas::Draw(wxDC& dc)
|
||||
|
||||
Fractal(dc, Left, Top, Right, Bottom, 0, 0, 0, 0, detail, Std, Ratio);
|
||||
|
||||
menuBar->EnableTop(0, TRUE);
|
||||
running = FALSE;
|
||||
menuBar->EnableTop(0, true);
|
||||
running = false;
|
||||
}
|
||||
|
||||
void MyCanvas::Fractal(wxDC& dc, int X1, int Y1, int X2, int Y2, int Z1, int Z2, int Z3, int Z4, int Iteration, double Std, double Ratio)
|
||||
|
Reference in New Issue
Block a user