-1->wxID_ANY, TRUE->true, FALSE->false, wxDefaultPosition & wxDefaultSize replacements
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@27473 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -160,7 +160,7 @@ bool MyApp::OnInit()
|
|||||||
wxPoint(50, 50), wxSize(450, 340));
|
wxPoint(50, 50), wxSize(450, 340));
|
||||||
|
|
||||||
// Show it and tell the application that it's our main window
|
// Show it and tell the application that it's our main window
|
||||||
frame->Show(TRUE);
|
frame->Show(true);
|
||||||
SetTopWindow(frame);
|
SetTopWindow(frame);
|
||||||
|
|
||||||
// Init dial up manager
|
// Init dial up manager
|
||||||
@@ -175,12 +175,12 @@ bool MyApp::OnInit()
|
|||||||
// do it here, OnExit() won't be called
|
// do it here, OnExit() won't be called
|
||||||
delete m_dial;
|
delete m_dial;
|
||||||
|
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
frame->SetStatusText(GetDialer()->IsAlwaysOnline() ? _T("LAN") : _T("No LAN"), 2);
|
frame->SetStatusText(GetDialer()->IsAlwaysOnline() ? _T("LAN") : _T("No LAN"), 2);
|
||||||
|
|
||||||
return TRUE;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
int MyApp::OnExit()
|
int MyApp::OnExit()
|
||||||
@@ -216,7 +216,7 @@ void MyApp::OnConnected(wxDialUpEvent& event)
|
|||||||
|
|
||||||
// frame constructor
|
// frame constructor
|
||||||
MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size)
|
MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size)
|
||||||
: wxFrame((wxFrame *)NULL, -1, title, pos, size)
|
: wxFrame((wxFrame *)NULL, wxID_ANY, title, pos, size)
|
||||||
{
|
{
|
||||||
// create a menu bar
|
// create a menu bar
|
||||||
wxMenu *menuFile = new wxMenu;
|
wxMenu *menuFile = new wxMenu;
|
||||||
@@ -249,8 +249,8 @@ MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size)
|
|||||||
|
|
||||||
void MyFrame::OnQuit(wxCommandEvent& WXUNUSED(event))
|
void MyFrame::OnQuit(wxCommandEvent& WXUNUSED(event))
|
||||||
{
|
{
|
||||||
// TRUE is to force the frame to close
|
// true is to force the frame to close
|
||||||
Close(TRUE);
|
Close(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MyFrame::OnAbout(wxCommandEvent& WXUNUSED(event))
|
void MyFrame::OnAbout(wxCommandEvent& WXUNUSED(event))
|
||||||
@@ -328,7 +328,7 @@ void MyFrame::OnUpdateUI(wxUpdateUIEvent& event)
|
|||||||
|
|
||||||
void MyFrame::OnIdle(wxIdleEvent& WXUNUSED(event))
|
void MyFrame::OnIdle(wxIdleEvent& WXUNUSED(event))
|
||||||
{
|
{
|
||||||
static int s_isOnline = -1; // not TRUE nor FALSE
|
static int s_isOnline = -1; // not true nor false
|
||||||
|
|
||||||
bool isOnline = wxGetApp().GetDialer()->IsOnline();
|
bool isOnline = wxGetApp().GetDialer()->IsOnline();
|
||||||
if ( s_isOnline != (int)isOnline )
|
if ( s_isOnline != (int)isOnline )
|
||||||
|
@@ -252,7 +252,7 @@ void DoodleSegment::Draw(wxDC *dc)
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
DrawingCommand::DrawingCommand(const wxString& name, int command, DrawingDocument *ddoc, DoodleSegment *seg):
|
DrawingCommand::DrawingCommand(const wxString& name, int command, DrawingDocument *ddoc, DoodleSegment *seg):
|
||||||
wxCommand(TRUE, name)
|
wxCommand(true, name)
|
||||||
{
|
{
|
||||||
doc = ddoc;
|
doc = ddoc;
|
||||||
segment = seg;
|
segment = seg;
|
||||||
@@ -281,7 +281,7 @@ bool DrawingCommand::Do(void)
|
|||||||
segment = (DoodleSegment *)node->GetData();
|
segment = (DoodleSegment *)node->GetData();
|
||||||
doc->GetDoodleSegments().Erase(node);
|
doc->GetDoodleSegments().Erase(node);
|
||||||
|
|
||||||
doc->Modify(TRUE);
|
doc->Modify(true);
|
||||||
doc->UpdateAllViews();
|
doc->UpdateAllViews();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -289,12 +289,12 @@ bool DrawingCommand::Do(void)
|
|||||||
case DOODLE_ADD:
|
case DOODLE_ADD:
|
||||||
{
|
{
|
||||||
doc->GetDoodleSegments().Append(new DoodleSegment(*segment));
|
doc->GetDoodleSegments().Append(new DoodleSegment(*segment));
|
||||||
doc->Modify(TRUE);
|
doc->Modify(true);
|
||||||
doc->UpdateAllViews();
|
doc->UpdateAllViews();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return TRUE;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DrawingCommand::Undo(void)
|
bool DrawingCommand::Undo(void)
|
||||||
@@ -307,11 +307,11 @@ bool DrawingCommand::Undo(void)
|
|||||||
if (segment)
|
if (segment)
|
||||||
{
|
{
|
||||||
doc->GetDoodleSegments().Append(segment);
|
doc->GetDoodleSegments().Append(segment);
|
||||||
doc->Modify(TRUE);
|
doc->Modify(true);
|
||||||
doc->UpdateAllViews();
|
doc->UpdateAllViews();
|
||||||
segment = (DoodleSegment *) NULL;
|
segment = (DoodleSegment *) NULL;
|
||||||
}
|
}
|
||||||
doc->Modify(TRUE);
|
doc->Modify(true);
|
||||||
doc->UpdateAllViews();
|
doc->UpdateAllViews();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -325,12 +325,12 @@ bool DrawingCommand::Undo(void)
|
|||||||
delete seg;
|
delete seg;
|
||||||
doc->GetDoodleSegments().Erase(node);
|
doc->GetDoodleSegments().Erase(node);
|
||||||
|
|
||||||
doc->Modify(TRUE);
|
doc->Modify(true);
|
||||||
doc->UpdateAllViews();
|
doc->UpdateAllViews();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return TRUE;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
IMPLEMENT_DYNAMIC_CLASS(TextEditDocument, wxDocument)
|
IMPLEMENT_DYNAMIC_CLASS(TextEditDocument, wxDocument)
|
||||||
@@ -342,25 +342,25 @@ bool TextEditDocument::OnSaveDocument(const wxString& filename)
|
|||||||
TextEditView *view = (TextEditView *)GetFirstView();
|
TextEditView *view = (TextEditView *)GetFirstView();
|
||||||
|
|
||||||
if (!view->textsw->SaveFile(filename))
|
if (!view->textsw->SaveFile(filename))
|
||||||
return FALSE;
|
return false;
|
||||||
Modify(FALSE);
|
Modify(false);
|
||||||
#ifdef __WXMAC__
|
#ifdef __WXMAC__
|
||||||
wxFileName fn(filename) ;
|
wxFileName fn(filename) ;
|
||||||
fn.MacSetDefaultTypeAndCreator() ;
|
fn.MacSetDefaultTypeAndCreator() ;
|
||||||
#endif
|
#endif
|
||||||
return TRUE;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool TextEditDocument::OnOpenDocument(const wxString& filename)
|
bool TextEditDocument::OnOpenDocument(const wxString& filename)
|
||||||
{
|
{
|
||||||
TextEditView *view = (TextEditView *)GetFirstView();
|
TextEditView *view = (TextEditView *)GetFirstView();
|
||||||
if (!view->textsw->LoadFile(filename))
|
if (!view->textsw->LoadFile(filename))
|
||||||
return FALSE;
|
return false;
|
||||||
|
|
||||||
SetFilename(filename, TRUE);
|
SetFilename(filename, true);
|
||||||
Modify(FALSE);
|
Modify(false);
|
||||||
UpdateAllViews();
|
UpdateAllViews();
|
||||||
return TRUE;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool TextEditDocument::IsModified(void) const
|
bool TextEditDocument::IsModified(void) const
|
||||||
|
@@ -48,7 +48,7 @@ MyFrame *frame = (MyFrame *) NULL;
|
|||||||
|
|
||||||
// In single window mode, don't have any child windows; use
|
// In single window mode, don't have any child windows; use
|
||||||
// main window.
|
// main window.
|
||||||
bool singleWindowMode = FALSE;
|
bool singleWindowMode = false;
|
||||||
|
|
||||||
IMPLEMENT_APP(MyApp)
|
IMPLEMENT_APP(MyApp)
|
||||||
|
|
||||||
@@ -67,7 +67,7 @@ bool MyApp::OnInit(void)
|
|||||||
{
|
{
|
||||||
if (wxStrcmp(argv[1], _T("-single")) == 0)
|
if (wxStrcmp(argv[1], _T("-single")) == 0)
|
||||||
{
|
{
|
||||||
singleWindowMode = TRUE;
|
singleWindowMode = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -99,7 +99,7 @@ bool MyApp::OnInit(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
//// Create the main frame window
|
//// Create the main frame window
|
||||||
frame = new MyFrame(m_docManager, (wxFrame *) NULL, -1, _T("DocView Demo"), wxPoint(0, 0), wxSize(500, 400), wxDEFAULT_FRAME_STYLE);
|
frame = new MyFrame(m_docManager, (wxFrame *) NULL, wxID_ANY, _T("DocView Demo"), wxPoint(0, 0), wxSize(500, 400), wxDEFAULT_FRAME_STYLE);
|
||||||
|
|
||||||
//// Give it an icon (this is ignored in MDI mode: uses resources)
|
//// Give it an icon (this is ignored in MDI mode: uses resources)
|
||||||
#ifdef __WXMSW__
|
#ifdef __WXMSW__
|
||||||
@@ -155,10 +155,10 @@ bool MyApp::OnInit(void)
|
|||||||
frame->SetMenuBar(menu_bar);
|
frame->SetMenuBar(menu_bar);
|
||||||
|
|
||||||
frame->Centre(wxBOTH);
|
frame->Centre(wxBOTH);
|
||||||
frame->Show(TRUE);
|
frame->Show(true);
|
||||||
|
|
||||||
SetTopWindow(frame);
|
SetTopWindow(frame);
|
||||||
return TRUE;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
int MyApp::OnExit(void)
|
int MyApp::OnExit(void)
|
||||||
@@ -176,7 +176,7 @@ int MyApp::OnExit(void)
|
|||||||
wxFrame *MyApp::CreateChildFrame(wxDocument *doc, wxView *view, bool isCanvas)
|
wxFrame *MyApp::CreateChildFrame(wxDocument *doc, wxView *view, bool isCanvas)
|
||||||
{
|
{
|
||||||
//// Make a child frame
|
//// Make a child frame
|
||||||
wxDocChildFrame *subframe = new wxDocChildFrame(doc, view, GetMainFrame(), -1, _T("Child Frame"),
|
wxDocChildFrame *subframe = new wxDocChildFrame(doc, view, GetMainFrame(), wxID_ANY, _T("Child Frame"),
|
||||||
wxPoint(10, 10), wxSize(300, 300), wxDEFAULT_FRAME_STYLE);
|
wxPoint(10, 10), wxSize(300, 300), wxDEFAULT_FRAME_STYLE);
|
||||||
|
|
||||||
#ifdef __WXMSW__
|
#ifdef __WXMSW__
|
||||||
|
@@ -49,7 +49,7 @@ bool DrawingView::OnCreate(wxDocument *doc, long WXUNUSED(flags) )
|
|||||||
if (!singleWindowMode)
|
if (!singleWindowMode)
|
||||||
{
|
{
|
||||||
// Multiple windows
|
// Multiple windows
|
||||||
frame = wxGetApp().CreateChildFrame(doc, this, TRUE);
|
frame = wxGetApp().CreateChildFrame(doc, this, true);
|
||||||
frame->SetTitle(_T("DrawingView"));
|
frame->SetTitle(_T("DrawingView"));
|
||||||
|
|
||||||
canvas = GetMainFrame()->CreateCanvas(this, frame);
|
canvas = GetMainFrame()->CreateCanvas(this, frame);
|
||||||
@@ -57,9 +57,9 @@ bool DrawingView::OnCreate(wxDocument *doc, long WXUNUSED(flags) )
|
|||||||
// X seems to require a forced resize
|
// X seems to require a forced resize
|
||||||
int x, y;
|
int x, y;
|
||||||
frame->GetSize(&x, &y);
|
frame->GetSize(&x, &y);
|
||||||
frame->SetSize(-1, -1, x, y);
|
frame->SetSize(wxDefaultPosition.x, wxDefaultPosition.y, x, y);
|
||||||
#endif
|
#endif
|
||||||
frame->Show(TRUE);
|
frame->Show(true);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -73,14 +73,14 @@ bool DrawingView::OnCreate(wxDocument *doc, long WXUNUSED(flags) )
|
|||||||
|
|
||||||
// Make sure the document manager knows that this is the
|
// Make sure the document manager knows that this is the
|
||||||
// current view.
|
// current view.
|
||||||
Activate(TRUE);
|
Activate(true);
|
||||||
|
|
||||||
// Initialize the edit menu Undo and Redo items
|
// Initialize the edit menu Undo and Redo items
|
||||||
doc->GetCommandProcessor()->SetEditMenu(((MyFrame *)frame)->editMenu);
|
doc->GetCommandProcessor()->SetEditMenu(((MyFrame *)frame)->editMenu);
|
||||||
doc->GetCommandProcessor()->Initialize();
|
doc->GetCommandProcessor()->Initialize();
|
||||||
}
|
}
|
||||||
|
|
||||||
return TRUE;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Sneakily gets used for default print/preview
|
// Sneakily gets used for default print/preview
|
||||||
@@ -123,7 +123,7 @@ void DrawingView::OnUpdate(wxView *WXUNUSED(sender), wxObject *WXUNUSED(hint))
|
|||||||
bool DrawingView::OnClose(bool deleteWindow)
|
bool DrawingView::OnClose(bool deleteWindow)
|
||||||
{
|
{
|
||||||
if (!GetDocument()->Close())
|
if (!GetDocument()->Close())
|
||||||
return FALSE;
|
return false;
|
||||||
|
|
||||||
// Clear the canvas in case we're in single-window mode,
|
// Clear the canvas in case we're in single-window mode,
|
||||||
// and the canvas stays.
|
// and the canvas stays.
|
||||||
@@ -137,14 +137,14 @@ bool DrawingView::OnClose(bool deleteWindow)
|
|||||||
|
|
||||||
SetFrame((wxFrame *) NULL);
|
SetFrame((wxFrame *) NULL);
|
||||||
|
|
||||||
Activate(FALSE);
|
Activate(false);
|
||||||
|
|
||||||
if (deleteWindow && !singleWindowMode)
|
if (deleteWindow && !singleWindowMode)
|
||||||
{
|
{
|
||||||
delete frame;
|
delete frame;
|
||||||
return TRUE;
|
return true;
|
||||||
}
|
}
|
||||||
return TRUE;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void DrawingView::OnCut(wxCommandEvent& WXUNUSED(event) )
|
void DrawingView::OnCut(wxCommandEvent& WXUNUSED(event) )
|
||||||
@@ -157,7 +157,7 @@ IMPLEMENT_DYNAMIC_CLASS(TextEditView, wxView)
|
|||||||
|
|
||||||
bool TextEditView::OnCreate(wxDocument *doc, long WXUNUSED(flags) )
|
bool TextEditView::OnCreate(wxDocument *doc, long WXUNUSED(flags) )
|
||||||
{
|
{
|
||||||
frame = wxGetApp().CreateChildFrame(doc, this, FALSE);
|
frame = wxGetApp().CreateChildFrame(doc, this, false);
|
||||||
|
|
||||||
int width, height;
|
int width, height;
|
||||||
frame->GetClientSize(&width, &height);
|
frame->GetClientSize(&width, &height);
|
||||||
@@ -168,13 +168,13 @@ bool TextEditView::OnCreate(wxDocument *doc, long WXUNUSED(flags) )
|
|||||||
// X seems to require a forced resize
|
// X seems to require a forced resize
|
||||||
int x, y;
|
int x, y;
|
||||||
frame->GetSize(&x, &y);
|
frame->GetSize(&x, &y);
|
||||||
frame->SetSize(-1, -1, x, y);
|
frame->SetSize(wxDefaultPosition.x, wxDefaultPosition.y, x, y);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
frame->Show(TRUE);
|
frame->Show(true);
|
||||||
Activate(TRUE);
|
Activate(true);
|
||||||
|
|
||||||
return TRUE;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Handled by wxTextWindow
|
// Handled by wxTextWindow
|
||||||
@@ -189,16 +189,16 @@ void TextEditView::OnUpdate(wxView *WXUNUSED(sender), wxObject *WXUNUSED(hint) )
|
|||||||
bool TextEditView::OnClose(bool deleteWindow)
|
bool TextEditView::OnClose(bool deleteWindow)
|
||||||
{
|
{
|
||||||
if (!GetDocument()->Close())
|
if (!GetDocument()->Close())
|
||||||
return FALSE;
|
return false;
|
||||||
|
|
||||||
Activate(FALSE);
|
Activate(false);
|
||||||
|
|
||||||
if (deleteWindow)
|
if (deleteWindow)
|
||||||
{
|
{
|
||||||
delete frame;
|
delete frame;
|
||||||
return TRUE;
|
return true;
|
||||||
}
|
}
|
||||||
return TRUE;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -211,7 +211,7 @@ END_EVENT_TABLE()
|
|||||||
|
|
||||||
// Define a constructor for my canvas
|
// Define a constructor for my canvas
|
||||||
MyCanvas::MyCanvas(wxView *v, wxFrame *frame, const wxPoint& pos, const wxSize& size, const long style):
|
MyCanvas::MyCanvas(wxView *v, wxFrame *frame, const wxPoint& pos, const wxSize& size, const long style):
|
||||||
wxScrolledWindow(frame, -1, pos, size, style)
|
wxScrolledWindow(frame, wxID_ANY, pos, size, style)
|
||||||
{
|
{
|
||||||
view = v;
|
view = v;
|
||||||
}
|
}
|
||||||
@@ -253,7 +253,7 @@ void MyCanvas::OnMouseEvent(wxMouseEvent& event)
|
|||||||
|
|
||||||
doc->GetCommandProcessor()->Submit(new DrawingCommand(_T("Add Segment"), DOODLE_ADD, doc, currentSegment));
|
doc->GetCommandProcessor()->Submit(new DrawingCommand(_T("Add Segment"), DOODLE_ADD, doc, currentSegment));
|
||||||
|
|
||||||
view->GetDocument()->Modify(TRUE);
|
view->GetDocument()->Modify(true);
|
||||||
currentSegment = (DoodleSegment *) NULL;
|
currentSegment = (DoodleSegment *) NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -278,7 +278,7 @@ void MyCanvas::OnMouseEvent(wxMouseEvent& event)
|
|||||||
|
|
||||||
// Define a constructor for my text subwindow
|
// Define a constructor for my text subwindow
|
||||||
MyTextWindow::MyTextWindow(wxView *v, wxFrame *frame, const wxPoint& pos, const wxSize& size, const long style):
|
MyTextWindow::MyTextWindow(wxView *v, wxFrame *frame, const wxPoint& pos, const wxSize& size, const long style):
|
||||||
wxTextCtrl(frame, -1, _T(""), pos, size, style)
|
wxTextCtrl(frame, wxID_ANY, _T(""), pos, size, style)
|
||||||
{
|
{
|
||||||
view = v;
|
view = v;
|
||||||
}
|
}
|
||||||
|
@@ -52,7 +52,7 @@ public:
|
|||||||
bool OnCreate(wxDocument *doc, long flags);
|
bool OnCreate(wxDocument *doc, long flags);
|
||||||
void OnDraw(wxDC *dc);
|
void OnDraw(wxDC *dc);
|
||||||
void OnUpdate(wxView *sender, wxObject *hint = (wxObject *) NULL);
|
void OnUpdate(wxView *sender, wxObject *hint = (wxObject *) NULL);
|
||||||
bool OnClose(bool deleteWindow = TRUE);
|
bool OnClose(bool deleteWindow = true);
|
||||||
|
|
||||||
void OnCut(wxCommandEvent& event);
|
void OnCut(wxCommandEvent& event);
|
||||||
|
|
||||||
@@ -73,7 +73,7 @@ public:
|
|||||||
bool OnCreate(wxDocument *doc, long flags);
|
bool OnCreate(wxDocument *doc, long flags);
|
||||||
void OnDraw(wxDC *dc);
|
void OnDraw(wxDC *dc);
|
||||||
void OnUpdate(wxView *sender, wxObject *hint = (wxObject *) NULL);
|
void OnUpdate(wxView *sender, wxObject *hint = (wxObject *) NULL);
|
||||||
bool OnClose(bool deleteWindow = TRUE);
|
bool OnClose(bool deleteWindow = true);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
Reference in New Issue
Block a user