wxUSE_STL fixes and suggested coding of -1/TRUE/FALSE
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@28542 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -83,7 +83,7 @@ protected:
|
|||||||
long m_ySpacing;
|
long m_ySpacing;
|
||||||
long m_topMargin;
|
long m_topMargin;
|
||||||
long m_leftMargin;
|
long m_leftMargin;
|
||||||
bool m_orientation; // TRUE for top-to-bottom, FALSE for left-to-right
|
bool m_orientation; // true for top-to-bottom, false for left-to-right
|
||||||
|
|
||||||
private:
|
private:
|
||||||
DECLARE_ABSTRACT_CLASS(wxTreeLayout)
|
DECLARE_ABSTRACT_CLASS(wxTreeLayout)
|
||||||
|
@@ -103,9 +103,9 @@ bool MyApp::OnInit(void)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Create the main frame window
|
// Create the main frame window
|
||||||
frame = new MyFrame( (wxFrame *) NULL, -1,
|
frame = new MyFrame( (wxFrame *) NULL, wxID_ANY,
|
||||||
wxT("wxWidgets Resource Sample"),
|
wxT("wxWidgets Resource Sample"),
|
||||||
wxPoint(-1, -1), wxSize(300, 250) );
|
wxDefaultPosition, wxSize(300, 250) );
|
||||||
|
|
||||||
#if wxUSE_STATUSBAR
|
#if wxUSE_STATUSBAR
|
||||||
// Give it a status line
|
// Give it a status line
|
||||||
@@ -118,13 +118,13 @@ bool MyApp::OnInit(void)
|
|||||||
frame->SetMenuBar(menu_bar);
|
frame->SetMenuBar(menu_bar);
|
||||||
|
|
||||||
// Make a panel
|
// Make a panel
|
||||||
frame->panel = new MyPanel( frame, -1, wxPoint(0, 0), wxSize(400, 400),
|
frame->panel = new MyPanel( frame, wxID_ANY, wxPoint(0, 0), wxSize(400, 400),
|
||||||
0, wxT("MyMainFrame") );
|
0, wxT("MyMainFrame") );
|
||||||
frame->Show(TRUE);
|
frame->Show(true);
|
||||||
|
|
||||||
SetTopWindow(frame);
|
SetTopWindow(frame);
|
||||||
|
|
||||||
return TRUE;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
MyApp::~MyApp()
|
MyApp::~MyApp()
|
||||||
@@ -181,7 +181,7 @@ void MyFrame::OnAbout( wxCommandEvent& WXUNUSED(event) )
|
|||||||
|
|
||||||
void MyFrame::OnQuit( wxCommandEvent& WXUNUSED(event) )
|
void MyFrame::OnQuit( wxCommandEvent& WXUNUSED(event) )
|
||||||
{
|
{
|
||||||
Close(TRUE);
|
Close(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MyFrame::OnTestDialog(wxCommandEvent& WXUNUSED(event) )
|
void MyFrame::OnTestDialog(wxCommandEvent& WXUNUSED(event) )
|
||||||
@@ -199,7 +199,7 @@ void MyFrame::OnTestDialog(wxCommandEvent& WXUNUSED(event) )
|
|||||||
dialog->ShowModal();
|
dialog->ShowModal();
|
||||||
}
|
}
|
||||||
|
|
||||||
dialog->Close(TRUE);
|
dialog->Close(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
BEGIN_EVENT_TABLE(MyDialog, wxDialog)
|
BEGIN_EVENT_TABLE(MyDialog, wxDialog)
|
||||||
|
@@ -41,7 +41,7 @@ IMPLEMENT_APP(MyApp)
|
|||||||
bool MyApp::OnInit()
|
bool MyApp::OnInit()
|
||||||
{
|
{
|
||||||
// Create the main frame window
|
// Create the main frame window
|
||||||
MyFrame* frame = new MyFrame(NULL, _T("Tree Test"), wxPoint(-1, -1), wxSize(400, 550));
|
MyFrame* frame = new MyFrame(NULL, _T("Tree Test"), wxDefaultPosition, wxSize(400, 550));
|
||||||
|
|
||||||
#if wxUSE_STATUSBAR
|
#if wxUSE_STATUSBAR
|
||||||
// Give it a status line
|
// Give it a status line
|
||||||
@@ -85,14 +85,14 @@ bool MyApp::OnInit()
|
|||||||
dc.SetFont(font);
|
dc.SetFont(font);
|
||||||
TreeTest(*myTree, dc);
|
TreeTest(*myTree, dc);
|
||||||
|
|
||||||
frame->Show(TRUE);
|
frame->Show(true);
|
||||||
|
|
||||||
#if wxUSE_STATUSBAR
|
#if wxUSE_STATUSBAR
|
||||||
frame->SetStatusText(_T("Hello, tree!"));
|
frame->SetStatusText(_T("Hello, tree!"));
|
||||||
#endif // wxUSE_STATUSBAR
|
#endif // wxUSE_STATUSBAR
|
||||||
|
|
||||||
// Return the main frame window
|
// Return the main frame window
|
||||||
return TRUE;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
int MyApp::OnExit()
|
int MyApp::OnExit()
|
||||||
@@ -152,20 +152,20 @@ END_EVENT_TABLE()
|
|||||||
|
|
||||||
// Define my frame constructor
|
// Define my frame constructor
|
||||||
MyFrame::MyFrame(wxWindow *parent, const wxString& title, const wxPoint& pos, const wxSize& size):
|
MyFrame::MyFrame(wxWindow *parent, const wxString& title, const wxPoint& pos, const wxSize& size):
|
||||||
wxFrame(parent, -1, title, pos, size)
|
wxFrame(parent, wxID_ANY, title, pos, size)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void MyFrame::OnQuit(wxCommandEvent& WXUNUSED(event))
|
void MyFrame::OnQuit(wxCommandEvent& WXUNUSED(event))
|
||||||
{
|
{
|
||||||
Close(TRUE);
|
Close(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MyFrame::OnLeftRight(wxCommandEvent& WXUNUSED(event))
|
void MyFrame::OnLeftRight(wxCommandEvent& WXUNUSED(event))
|
||||||
{
|
{
|
||||||
if (myTree)
|
if (myTree)
|
||||||
{
|
{
|
||||||
myTree->SetOrientation(FALSE);
|
myTree->SetOrientation(false);
|
||||||
wxClientDC dc(canvas);
|
wxClientDC dc(canvas);
|
||||||
wxFont font(10, wxROMAN, wxNORMAL, wxBOLD);
|
wxFont font(10, wxROMAN, wxNORMAL, wxBOLD);
|
||||||
dc.SetFont(font);
|
dc.SetFont(font);
|
||||||
@@ -178,7 +178,7 @@ void MyFrame::OnTopBottom(wxCommandEvent& WXUNUSED(event))
|
|||||||
{
|
{
|
||||||
if (myTree)
|
if (myTree)
|
||||||
{
|
{
|
||||||
myTree->SetOrientation(TRUE);
|
myTree->SetOrientation(true);
|
||||||
wxClientDC dc(canvas);
|
wxClientDC dc(canvas);
|
||||||
wxFont font(10, wxROMAN, wxNORMAL, wxBOLD);
|
wxFont font(10, wxROMAN, wxNORMAL, wxBOLD);
|
||||||
dc.SetFont(font);
|
dc.SetFont(font);
|
||||||
@@ -203,7 +203,7 @@ END_EVENT_TABLE()
|
|||||||
|
|
||||||
// Define a constructor for my canvas
|
// Define a constructor for my canvas
|
||||||
MyCanvas::MyCanvas(wxWindow *parent):
|
MyCanvas::MyCanvas(wxWindow *parent):
|
||||||
wxScrolledWindow(parent, -1)
|
wxScrolledWindow(parent, wxID_ANY)
|
||||||
{
|
{
|
||||||
SetBackgroundColour(*wxWHITE);
|
SetBackgroundColour(*wxWHITE);
|
||||||
}
|
}
|
||||||
|
@@ -155,8 +155,8 @@ void wxToolBarSimple::Init()
|
|||||||
|
|
||||||
m_xScrollPixelsPerLine = 1;
|
m_xScrollPixelsPerLine = 1;
|
||||||
m_yScrollPixelsPerLine = 1;
|
m_yScrollPixelsPerLine = 1;
|
||||||
m_xScrollingEnabled = FALSE;
|
m_xScrollingEnabled = false;
|
||||||
m_yScrollingEnabled = FALSE;
|
m_yScrollingEnabled = false;
|
||||||
m_xScrollPosition = 0;
|
m_xScrollPosition = 0;
|
||||||
m_yScrollPosition = 0;
|
m_yScrollPosition = 0;
|
||||||
m_xScrollLines = 0;
|
m_xScrollLines = 0;
|
||||||
@@ -190,7 +190,7 @@ bool wxToolBarSimple::DoInsertTool(size_t WXUNUSED(pos),
|
|||||||
{
|
{
|
||||||
wxToolBarToolSimple *tool = (wxToolBarToolSimple *)toolBase;
|
wxToolBarToolSimple *tool = (wxToolBarToolSimple *)toolBase;
|
||||||
|
|
||||||
wxCHECK_MSG( !tool->IsControl(), FALSE,
|
wxCHECK_MSG( !tool->IsControl(), false,
|
||||||
_T("generic wxToolBarSimple doesn't support controls") );
|
_T("generic wxToolBarSimple doesn't support controls") );
|
||||||
|
|
||||||
tool->m_x = m_xPos;
|
tool->m_x = m_xPos;
|
||||||
@@ -213,7 +213,7 @@ bool wxToolBarSimple::DoInsertTool(size_t WXUNUSED(pos),
|
|||||||
m_maxHeight = (wxCoord)((tool->m_y + tool->GetHeight() + m_yMargin));
|
m_maxHeight = (wxCoord)((tool->m_y + tool->GetHeight() + m_yMargin));
|
||||||
}
|
}
|
||||||
|
|
||||||
return TRUE;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxToolBarSimple::DoDeleteTool(size_t WXUNUSED(pos),
|
bool wxToolBarSimple::DoDeleteTool(size_t WXUNUSED(pos),
|
||||||
@@ -224,7 +224,7 @@ bool wxToolBarSimple::DoDeleteTool(size_t WXUNUSED(pos),
|
|||||||
|
|
||||||
Refresh();
|
Refresh();
|
||||||
|
|
||||||
return TRUE;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxToolBarSimple::Create(wxWindow *parent,
|
bool wxToolBarSimple::Create(wxWindow *parent,
|
||||||
@@ -235,7 +235,7 @@ bool wxToolBarSimple::Create(wxWindow *parent,
|
|||||||
const wxString& name)
|
const wxString& name)
|
||||||
{
|
{
|
||||||
if ( !wxWindow::Create(parent, id, pos, size, style, name) )
|
if ( !wxWindow::Create(parent, id, pos, size, style, name) )
|
||||||
return FALSE;
|
return false;
|
||||||
|
|
||||||
// Set it to grey (or other 3D face colour)
|
// Set it to grey (or other 3D face colour)
|
||||||
SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_3DFACE));
|
SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_3DFACE));
|
||||||
@@ -259,7 +259,7 @@ bool wxToolBarSimple::Create(wxWindow *parent,
|
|||||||
|
|
||||||
SetCursor(*wxSTANDARD_CURSOR);
|
SetCursor(*wxSTANDARD_CURSOR);
|
||||||
|
|
||||||
return TRUE;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
wxToolBarSimple::~wxToolBarSimple()
|
wxToolBarSimple::~wxToolBarSimple()
|
||||||
@@ -366,7 +366,7 @@ bool wxToolBarSimple::Realize()
|
|||||||
|
|
||||||
SetSize(m_maxWidth, m_maxHeight);
|
SetSize(m_maxWidth, m_maxHeight);
|
||||||
|
|
||||||
return TRUE;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
@@ -570,11 +570,11 @@ void wxToolBarSimple::DrawTool(wxDC& dc, wxToolBarToolBase *toolBase)
|
|||||||
// No second bitmap, so draw a thick line around bitmap, or invert if mono
|
// No second bitmap, so draw a thick line around bitmap, or invert if mono
|
||||||
else if ( tool->IsToggled() )
|
else if ( tool->IsToggled() )
|
||||||
{
|
{
|
||||||
bool drawBorder = FALSE;
|
bool drawBorder = false;
|
||||||
#ifdef __X__ // X doesn't invert properly on colour
|
#ifdef __X__ // X doesn't invert properly on colour
|
||||||
drawBorder = wxColourDisplay();
|
drawBorder = wxColourDisplay();
|
||||||
#else // Inversion works fine under Windows
|
#else // Inversion works fine under Windows
|
||||||
drawBorder = FALSE;
|
drawBorder = false;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (!drawBorder)
|
if (!drawBorder)
|
||||||
@@ -730,22 +730,22 @@ void wxToolBarSimple::SetScrollbars (int pixelsPerUnitX, int pixelsPerUnitY,
|
|||||||
if (m_xScrollLines > 0)
|
if (m_xScrollLines > 0)
|
||||||
{
|
{
|
||||||
m_xScrollPosition = xPos;
|
m_xScrollPosition = xPos;
|
||||||
SetScrollPos (wxHORIZONTAL, m_xScrollPosition, TRUE);
|
SetScrollPos (wxHORIZONTAL, m_xScrollPosition, true);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
SetScrollbar(wxHORIZONTAL, 0, 0, 0, FALSE);
|
SetScrollbar(wxHORIZONTAL, 0, 0, 0, false);
|
||||||
m_xScrollPosition = 0;
|
m_xScrollPosition = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_yScrollLines > 0)
|
if (m_yScrollLines > 0)
|
||||||
{
|
{
|
||||||
m_yScrollPosition = yPos;
|
m_yScrollPosition = yPos;
|
||||||
SetScrollPos (wxVERTICAL, m_yScrollPosition, TRUE);
|
SetScrollPos (wxVERTICAL, m_yScrollPosition, true);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
SetScrollbar(wxVERTICAL, 0, 0, 0, FALSE);
|
SetScrollbar(wxVERTICAL, 0, 0, 0, false);
|
||||||
m_yScrollPosition = 0;
|
m_yScrollPosition = 0;
|
||||||
}
|
}
|
||||||
AdjustScrollbars();
|
AdjustScrollbars();
|
||||||
@@ -767,12 +767,12 @@ void wxToolBarSimple::OnScroll(wxScrollEvent& event)
|
|||||||
if (orient == wxHORIZONTAL)
|
if (orient == wxHORIZONTAL)
|
||||||
{
|
{
|
||||||
int newPos = m_xScrollPosition + nScrollInc;
|
int newPos = m_xScrollPosition + nScrollInc;
|
||||||
SetScrollPos(wxHORIZONTAL, newPos, TRUE );
|
SetScrollPos(wxHORIZONTAL, newPos, true );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
int newPos = m_yScrollPosition + nScrollInc;
|
int newPos = m_yScrollPosition + nScrollInc;
|
||||||
SetScrollPos(wxVERTICAL, newPos, TRUE );
|
SetScrollPos(wxVERTICAL, newPos, true );
|
||||||
}
|
}
|
||||||
|
|
||||||
if (orient == wxHORIZONTAL)
|
if (orient == wxHORIZONTAL)
|
||||||
@@ -974,12 +974,12 @@ void wxToolBarSimple::Scroll (int x_pos, int y_pos)
|
|||||||
if (x_pos > -1)
|
if (x_pos > -1)
|
||||||
{
|
{
|
||||||
m_xScrollPosition = x_pos;
|
m_xScrollPosition = x_pos;
|
||||||
SetScrollPos (wxHORIZONTAL, x_pos, TRUE);
|
SetScrollPos (wxHORIZONTAL, x_pos, true);
|
||||||
}
|
}
|
||||||
if (y_pos > -1)
|
if (y_pos > -1)
|
||||||
{
|
{
|
||||||
m_yScrollPosition = y_pos;
|
m_yScrollPosition = y_pos;
|
||||||
SetScrollPos (wxVERTICAL, y_pos, TRUE);
|
SetScrollPos (wxVERTICAL, y_pos, true);
|
||||||
}
|
}
|
||||||
Refresh();
|
Refresh();
|
||||||
|
|
||||||
|
@@ -44,7 +44,7 @@ wxTreeLayout::wxTreeLayout()
|
|||||||
m_ySpacing = 20;
|
m_ySpacing = 20;
|
||||||
m_topMargin = 5;
|
m_topMargin = 5;
|
||||||
m_leftMargin = 5;
|
m_leftMargin = 5;
|
||||||
m_orientation = FALSE;
|
m_orientation = false;
|
||||||
m_parentNode = 0;
|
m_parentNode = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -59,7 +59,7 @@ void wxTreeLayout::DoLayout(wxDC& dc, long topId)
|
|||||||
{
|
{
|
||||||
SetNodeX(id, 0);
|
SetNodeX(id, 0);
|
||||||
SetNodeY(id, 0);
|
SetNodeY(id, 0);
|
||||||
ActivateNode(id, FALSE);
|
ActivateNode(id, false);
|
||||||
id = GetNextNode(id);
|
id = GetNextNode(id);
|
||||||
}
|
}
|
||||||
m_lastY = m_topMargin;
|
m_lastY = m_topMargin;
|
||||||
@@ -144,7 +144,7 @@ void wxTreeLayout::CalcLayout(long nodeId, int level, wxDC& dc)
|
|||||||
GetChildren(nodeId, children);
|
GetChildren(nodeId, children);
|
||||||
int n = children.GetCount();
|
int n = children.GetCount();
|
||||||
|
|
||||||
if (m_orientation == FALSE)
|
if (m_orientation == false)
|
||||||
{
|
{
|
||||||
// Left to right
|
// Left to right
|
||||||
// X Calculations
|
// X Calculations
|
||||||
@@ -160,7 +160,7 @@ void wxTreeLayout::CalcLayout(long nodeId, int level, wxDC& dc)
|
|||||||
SetNodeX(nodeId, (long)(GetNodeX(parentId) + m_xSpacing + x));
|
SetNodeX(nodeId, (long)(GetNodeX(parentId) + m_xSpacing + x));
|
||||||
}
|
}
|
||||||
|
|
||||||
wxNode *node = children.GetFirst();
|
wxList::compatibility_iterator node = children.GetFirst();
|
||||||
while (node)
|
while (node)
|
||||||
{
|
{
|
||||||
CalcLayout((long)node->GetData(), level+1, dc);
|
CalcLayout((long)node->GetData(), level+1, dc);
|
||||||
@@ -169,7 +169,7 @@ void wxTreeLayout::CalcLayout(long nodeId, int level, wxDC& dc)
|
|||||||
|
|
||||||
// Y Calculations
|
// Y Calculations
|
||||||
long averageY;
|
long averageY;
|
||||||
ActivateNode(nodeId, TRUE);
|
ActivateNode(nodeId, true);
|
||||||
|
|
||||||
if (n > 0)
|
if (n > 0)
|
||||||
{
|
{
|
||||||
@@ -209,7 +209,7 @@ void wxTreeLayout::CalcLayout(long nodeId, int level, wxDC& dc)
|
|||||||
SetNodeY(nodeId, (long)(GetNodeY(parentId) + m_ySpacing + y));
|
SetNodeY(nodeId, (long)(GetNodeY(parentId) + m_ySpacing + y));
|
||||||
}
|
}
|
||||||
|
|
||||||
wxNode *node = children.GetFirst();
|
wxList::compatibility_iterator node = children.GetFirst();
|
||||||
while (node)
|
while (node)
|
||||||
{
|
{
|
||||||
CalcLayout((long)node->GetData(), level+1, dc);
|
CalcLayout((long)node->GetData(), level+1, dc);
|
||||||
@@ -218,7 +218,7 @@ void wxTreeLayout::CalcLayout(long nodeId, int level, wxDC& dc)
|
|||||||
|
|
||||||
// X Calculations
|
// X Calculations
|
||||||
long averageX;
|
long averageX;
|
||||||
ActivateNode(nodeId, TRUE);
|
ActivateNode(nodeId, true);
|
||||||
|
|
||||||
if (n > 0)
|
if (n > 0)
|
||||||
{
|
{
|
||||||
@@ -273,7 +273,7 @@ void wxTreeLayoutStored::Initialize(int n)
|
|||||||
for (i = 0; i < n; i++)
|
for (i = 0; i < n; i++)
|
||||||
{
|
{
|
||||||
m_nodes[i].m_name = wxT("");
|
m_nodes[i].m_name = wxT("");
|
||||||
m_nodes[i].m_active = FALSE;
|
m_nodes[i].m_active = false;
|
||||||
m_nodes[i].m_parentId = -1;
|
m_nodes[i].m_parentId = -1;
|
||||||
m_nodes[i].m_x = 0;
|
m_nodes[i].m_x = 0;
|
||||||
m_nodes[i].m_y = 0;
|
m_nodes[i].m_y = 0;
|
||||||
|
Reference in New Issue
Block a user