fix warning about signed/unsigned comparison; use STL-compatible methods; deTABified

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_8_BRANCH@45825 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2007-05-05 14:19:50 +00:00
parent 374dd72767
commit 89add395bb

View File

@@ -502,7 +502,7 @@ wxAuiManager::wxAuiManager(wxWindow* managed_wnd, unsigned int flags)
m_dock_constraint_x = 0.3; m_dock_constraint_x = 0.3;
m_dock_constraint_y = 0.3; m_dock_constraint_y = 0.3;
m_reserved = NULL; m_reserved = NULL;
if (managed_wnd) if (managed_wnd)
{ {
SetManagedWindow(managed_wnd); SetManagedWindow(managed_wnd);
@@ -511,12 +511,12 @@ wxAuiManager::wxAuiManager(wxWindow* managed_wnd, unsigned int flags)
wxAuiManager::~wxAuiManager() wxAuiManager::~wxAuiManager()
{ {
for(int i = 0; i < m_panes.Count(); i++ ) for(size_t i = 0; i < m_panes.size(); i++ )
{ {
wxAuiPaneInfo& pinfo = m_panes.Item(i); wxAuiPaneInfo& pinfo = m_panes[i];
if( pinfo.window && pinfo.window->GetParent() == 0 ) if( pinfo.window && !pinfo.window->GetParent() )
delete pinfo.window; delete pinfo.window;
} }
delete m_art; delete m_art;
} }
@@ -618,7 +618,7 @@ void wxAuiManager::SetFlags(unsigned int flags)
// set the new flags // set the new flags
m_flags = flags; m_flags = flags;
if (update_hint_wnd) if (update_hint_wnd)
{ {
UpdateHintWindowConfig(); UpdateHintWindowConfig();
@@ -656,7 +656,7 @@ wxAuiManager* wxAuiManager::GetManager(wxWindow* window)
evt.ResumePropagation(wxEVENT_PROPAGATE_MAX); evt.ResumePropagation(wxEVENT_PROPAGATE_MAX);
if (!window->ProcessEvent(evt)) if (!window->ProcessEvent(evt))
return NULL; return NULL;
return evt.GetManager(); return evt.GetManager();
} }
@@ -665,7 +665,7 @@ void wxAuiManager::UpdateHintWindowConfig()
{ {
// find out if the the system can do transparent frames // find out if the the system can do transparent frames
bool can_do_transparent = false; bool can_do_transparent = false;
wxWindow* w = m_frame; wxWindow* w = m_frame;
while (w) while (w)
{ {
@@ -675,10 +675,10 @@ void wxAuiManager::UpdateHintWindowConfig()
can_do_transparent = f->CanSetTransparent(); can_do_transparent = f->CanSetTransparent();
break; break;
} }
w = w->GetParent(); w = w->GetParent();
} }
// if there is an existing hint window, delete it // if there is an existing hint window, delete it
if (m_hint_wnd) if (m_hint_wnd)
{ {
@@ -688,9 +688,9 @@ void wxAuiManager::UpdateHintWindowConfig()
m_hint_fademax = 50; m_hint_fademax = 50;
m_hint_wnd = NULL; m_hint_wnd = NULL;
if ((m_flags & wxAUI_MGR_TRANSPARENT_HINT) && can_do_transparent) if ((m_flags & wxAUI_MGR_TRANSPARENT_HINT) && can_do_transparent)
{ {
// Make a window to use for a transparent hint // Make a window to use for a transparent hint
#if defined(__WXMSW__) || defined(__WXGTK__) #if defined(__WXMSW__) || defined(__WXGTK__)
m_hint_wnd = new wxFrame(m_frame, wxID_ANY, wxEmptyString, m_hint_wnd = new wxFrame(m_frame, wxID_ANY, wxEmptyString,
@@ -718,7 +718,7 @@ void wxAuiManager::UpdateHintWindowConfig()
// blue. // blue.
p->SetBackgroundColour(*wxBLUE); p->SetBackgroundColour(*wxBLUE);
#endif #endif
} }
else else
{ {
@@ -878,14 +878,14 @@ bool wxAuiManager::AddPane(wxWindow* window, const wxAuiPaneInfo& pane_info)
button.button_id = wxAUI_BUTTON_MAXIMIZE_RESTORE; button.button_id = wxAUI_BUTTON_MAXIMIZE_RESTORE;
pinfo.buttons.Add(button); pinfo.buttons.Add(button);
} }
if (pinfo.HasPinButton()) if (pinfo.HasPinButton())
{ {
wxAuiPaneButton button; wxAuiPaneButton button;
button.button_id = wxAUI_BUTTON_PIN; button.button_id = wxAUI_BUTTON_PIN;
pinfo.buttons.Add(button); pinfo.buttons.Add(button);
} }
if (pinfo.HasCloseButton()) if (pinfo.HasCloseButton())
{ {
wxAuiPaneButton button; wxAuiPaneButton button;
@@ -1041,7 +1041,7 @@ bool wxAuiManager::DetachPane(wxWindow* window)
{ {
m_action_window = NULL; m_action_window = NULL;
} }
p.window->Reparent(m_frame); p.window->Reparent(m_frame);
p.frame->SetSizer(NULL); p.frame->SetSizer(NULL);
p.frame->Destroy(); p.frame->Destroy();
@@ -1102,7 +1102,7 @@ void wxAuiManager::ClosePane(wxAuiPaneInfo& pane_info)
} }
// now we need to either destroy or hide the pane // now we need to either destroy or hide the pane
if (pane_info.IsDestroyOnClose()) if (pane_info.IsDestroyOnClose())
{ {
wxWindow * window = pane_info.window; wxWindow * window = pane_info.window;
DetachPane(window); DetachPane(window);
@@ -1110,8 +1110,8 @@ void wxAuiManager::ClosePane(wxAuiPaneInfo& pane_info)
{ {
window->Destroy(); window->Destroy();
} }
} }
else else
{ {
pane_info.Hide(); pane_info.Hide();
} }
@@ -1128,7 +1128,7 @@ void wxAuiManager::MaximizePane(wxAuiPaneInfo& pane_info)
if (!p.IsToolbar()) if (!p.IsToolbar())
{ {
p.Restore(); p.Restore();
// save hidden state // save hidden state
p.SetFlag(wxAuiPaneInfo::savedHiddenState, p.SetFlag(wxAuiPaneInfo::savedHiddenState,
p.HasFlag(wxAuiPaneInfo::optionHidden)); p.HasFlag(wxAuiPaneInfo::optionHidden));
@@ -1614,7 +1614,7 @@ void wxAuiManager::LayoutAddPane(wxSizer* cont,
part.sizer_item = sizer_item; part.sizer_item = sizer_item;
uiparts.Add(part); uiparts.Add(part);
} }
// if we have buttons, add a little space to the right // if we have buttons, add a little space to the right
// of them to ease visual crowding // of them to ease visual crowding
if (button_count >= 1) if (button_count >= 1)
@@ -1748,7 +1748,7 @@ void wxAuiManager::LayoutAddDock(wxSizer* cont,
{ {
wxAuiPaneInfo& pane = *(dock.panes.Item(pane_i)); wxAuiPaneInfo& pane = *(dock.panes.Item(pane_i));
int pane_pos = pane_positions.Item(pane_i); int pane_pos = pane_positions.Item(pane_i);
if (pane.IsMaximized()) if (pane.IsMaximized())
has_maximized_pane = true; has_maximized_pane = true;
@@ -1795,7 +1795,7 @@ void wxAuiManager::LayoutAddDock(wxSizer* cont,
for (pane_i = 0; pane_i < pane_count; ++pane_i) for (pane_i = 0; pane_i < pane_count; ++pane_i)
{ {
wxAuiPaneInfo& pane = *(dock.panes.Item(pane_i)); wxAuiPaneInfo& pane = *(dock.panes.Item(pane_i));
if (pane.IsMaximized()) if (pane.IsMaximized())
has_maximized_pane = true; has_maximized_pane = true;
@@ -1874,10 +1874,10 @@ wxSizer* wxAuiManager::LayoutAll(wxAuiPaneInfoArray& panes,
for (i = 0, dock_count = docks.GetCount(); i < dock_count; ++i) for (i = 0, dock_count = docks.GetCount(); i < dock_count; ++i)
{ {
wxAuiDockInfo& dock = docks.Item(i); wxAuiDockInfo& dock = docks.Item(i);
// empty out all panes, as they will be readded below // empty out all panes, as they will be readded below
dock.panes.Empty(); dock.panes.Empty();
if (dock.fixed) if (dock.fixed)
{ {
// always reset fixed docks' sizes, because // always reset fixed docks' sizes, because
@@ -2000,10 +2000,10 @@ wxSizer* wxAuiManager::LayoutAll(wxAuiPaneInfoArray& panes,
// new dock's size may not be more than the dock constraint // new dock's size may not be more than the dock constraint
// parameter specifies. See SetDockSizeConstraint() // parameter specifies. See SetDockSizeConstraint()
int max_dock_x_size = (int)(m_dock_constraint_x * ((double)cli_size.x)); int max_dock_x_size = (int)(m_dock_constraint_x * ((double)cli_size.x));
int max_dock_y_size = (int)(m_dock_constraint_y * ((double)cli_size.y)); int max_dock_y_size = (int)(m_dock_constraint_y * ((double)cli_size.y));
if (dock.IsHorizontal()) if (dock.IsHorizontal())
size = wxMin(size, max_dock_y_size); size = wxMin(size, max_dock_y_size);
else else
@@ -2012,7 +2012,7 @@ wxSizer* wxAuiManager::LayoutAll(wxAuiPaneInfoArray& panes,
// absolute minimum size for a dock is 10 pixels // absolute minimum size for a dock is 10 pixels
if (size < 10) if (size < 10)
size = 10; size = 10;
dock.size = size; dock.size = size;
} }
@@ -2259,7 +2259,7 @@ void wxAuiManager::GetDockSizeConstraint(double* width_pct, double* height_pct)
{ {
if (width_pct) if (width_pct)
*width_pct = m_dock_constraint_x; *width_pct = m_dock_constraint_x;
if (height_pct) if (height_pct)
*height_pct = m_dock_constraint_y; *height_pct = m_dock_constraint_y;
} }
@@ -2314,7 +2314,7 @@ void wxAuiManager::Update()
{ {
m_action_window = NULL; m_action_window = NULL;
} }
p.window->Reparent(m_frame); p.window->Reparent(m_frame);
p.frame->SetSizer(NULL); p.frame->SetSizer(NULL);
p.frame->Destroy(); p.frame->Destroy();
@@ -2656,10 +2656,10 @@ bool wxAuiManager::DoDrop(wxAuiDockInfoArray& docks,
int new_layer = wxMax(wxMax(GetMaxLayer(docks, wxAUI_DOCK_LEFT), int new_layer = wxMax(wxMax(GetMaxLayer(docks, wxAUI_DOCK_LEFT),
GetMaxLayer(docks, wxAUI_DOCK_BOTTOM)), GetMaxLayer(docks, wxAUI_DOCK_BOTTOM)),
GetMaxLayer(docks, wxAUI_DOCK_TOP)) + 1; GetMaxLayer(docks, wxAUI_DOCK_TOP)) + 1;
if (drop.IsToolbar()) if (drop.IsToolbar())
new_layer = auiToolBarLayer; new_layer = auiToolBarLayer;
drop.Dock().Left(). drop.Dock().Left().
Layer(new_layer). Layer(new_layer).
Row(0). Row(0).
@@ -2672,10 +2672,10 @@ bool wxAuiManager::DoDrop(wxAuiDockInfoArray& docks,
int new_layer = wxMax(wxMax(GetMaxLayer(docks, wxAUI_DOCK_TOP), int new_layer = wxMax(wxMax(GetMaxLayer(docks, wxAUI_DOCK_TOP),
GetMaxLayer(docks, wxAUI_DOCK_LEFT)), GetMaxLayer(docks, wxAUI_DOCK_LEFT)),
GetMaxLayer(docks, wxAUI_DOCK_RIGHT)) + 1; GetMaxLayer(docks, wxAUI_DOCK_RIGHT)) + 1;
if (drop.IsToolbar()) if (drop.IsToolbar())
new_layer = auiToolBarLayer; new_layer = auiToolBarLayer;
drop.Dock().Top(). drop.Dock().Top().
Layer(new_layer). Layer(new_layer).
Row(0). Row(0).
@@ -2687,11 +2687,11 @@ bool wxAuiManager::DoDrop(wxAuiDockInfoArray& docks,
{ {
int new_layer = wxMax(wxMax(GetMaxLayer(docks, wxAUI_DOCK_RIGHT), int new_layer = wxMax(wxMax(GetMaxLayer(docks, wxAUI_DOCK_RIGHT),
GetMaxLayer(docks, wxAUI_DOCK_TOP)), GetMaxLayer(docks, wxAUI_DOCK_TOP)),
GetMaxLayer(docks, wxAUI_DOCK_BOTTOM)) + 1; GetMaxLayer(docks, wxAUI_DOCK_BOTTOM)) + 1;
if (drop.IsToolbar()) if (drop.IsToolbar())
new_layer = auiToolBarLayer; new_layer = auiToolBarLayer;
drop.Dock().Right(). drop.Dock().Right().
Layer(new_layer). Layer(new_layer).
Row(0). Row(0).
@@ -2704,10 +2704,10 @@ bool wxAuiManager::DoDrop(wxAuiDockInfoArray& docks,
int new_layer = wxMax( wxMax( GetMaxLayer(docks, wxAUI_DOCK_BOTTOM), int new_layer = wxMax( wxMax( GetMaxLayer(docks, wxAUI_DOCK_BOTTOM),
GetMaxLayer(docks, wxAUI_DOCK_LEFT)), GetMaxLayer(docks, wxAUI_DOCK_LEFT)),
GetMaxLayer(docks, wxAUI_DOCK_RIGHT)) + 1; GetMaxLayer(docks, wxAUI_DOCK_RIGHT)) + 1;
if (drop.IsToolbar()) if (drop.IsToolbar())
new_layer = auiToolBarLayer; new_layer = auiToolBarLayer;
drop.Dock().Bottom(). drop.Dock().Bottom().
Layer(new_layer). Layer(new_layer).
Row(0). Row(0).
@@ -3056,7 +3056,7 @@ void wxAuiManager::ShowHint(const wxRect& rect)
m_last_hint = rect; m_last_hint = rect;
m_hint_fadeamt = m_hint_fademax; m_hint_fadeamt = m_hint_fademax;
if ((m_flags & wxAUI_MGR_HINT_FADE) if ((m_flags & wxAUI_MGR_HINT_FADE)
&& !((m_hint_wnd->IsKindOf(CLASSINFO(wxPseudoTransparentFrame))) && && !((m_hint_wnd->IsKindOf(CLASSINFO(wxPseudoTransparentFrame))) &&
(m_flags & wxAUI_MGR_NO_VENETIAN_BLINDS_FADE)) (m_flags & wxAUI_MGR_NO_VENETIAN_BLINDS_FADE))
@@ -3088,7 +3088,7 @@ void wxAuiManager::ShowHint(const wxRect& rect)
{ {
if (!(m_flags & wxAUI_MGR_RECTANGLE_HINT)) if (!(m_flags & wxAUI_MGR_RECTANGLE_HINT))
return; return;
if (m_last_hint != rect) if (m_last_hint != rect)
{ {
// remove the last hint rectangle // remove the last hint rectangle
@@ -3170,7 +3170,7 @@ void wxAuiManager::StartPaneDrag(wxWindow* pane_window,
wxAuiPaneInfo& pane = GetPane(pane_window); wxAuiPaneInfo& pane = GetPane(pane_window);
if (!pane.IsOk()) if (!pane.IsOk())
return; return;
if (pane.IsToolbar()) if (pane.IsToolbar())
{ {
m_action = actionDragToolbarPane; m_action = actionDragToolbarPane;
@@ -3179,7 +3179,7 @@ void wxAuiManager::StartPaneDrag(wxWindow* pane_window,
{ {
m_action = actionDragFloatingPane; m_action = actionDragFloatingPane;
} }
m_action_window = pane_window; m_action_window = pane_window;
m_action_offset = offset; m_action_offset = offset;
m_frame->CaptureMouse(); m_frame->CaptureMouse();
@@ -3286,7 +3286,7 @@ void wxAuiManager::DrawHintRect(wxWindow* pane_window,
const wxPoint& offset) const wxPoint& offset)
{ {
wxRect rect = CalculateHintRect(pane_window, pt, offset); wxRect rect = CalculateHintRect(pane_window, pt, offset);
if (rect.IsEmpty()) if (rect.IsEmpty())
{ {
HideHint(); HideHint();
@@ -3517,7 +3517,7 @@ void wxAuiManager::OnFloatingPaneClosed(wxWindow* wnd, wxCloseEvent& evt)
evt.Veto(); evt.Veto();
return; return;
} }
else else
{ {
ClosePane(pane); ClosePane(pane);
} }
@@ -3657,7 +3657,7 @@ void wxAuiManager::OnSize(wxSizeEvent& event)
{ {
DoFrameLayout(); DoFrameLayout();
Repaint(); Repaint();
#if wxUSE_MDI #if wxUSE_MDI
if (m_frame->IsKindOf(CLASSINFO(wxMDIParentFrame))) if (m_frame->IsKindOf(CLASSINFO(wxMDIParentFrame)))
{ {
@@ -3681,7 +3681,7 @@ void wxAuiManager::OnFindManager(wxAuiManagerEvent& evt)
evt.SetManager(NULL); evt.SetManager(NULL);
return; return;
} }
// if we are managing a child frame, get the 'real' manager // if we are managing a child frame, get the 'real' manager
if (window->IsKindOf(CLASSINFO(wxAuiFloatingFrame))) if (window->IsKindOf(CLASSINFO(wxAuiFloatingFrame)))
{ {
@@ -3689,7 +3689,7 @@ void wxAuiManager::OnFindManager(wxAuiManagerEvent& evt)
evt.SetManager(float_frame->GetOwnerManager()); evt.SetManager(float_frame->GetOwnerManager());
return; return;
} }
// return pointer to ourself // return pointer to ourself
evt.SetManager(this); evt.SetManager(this);
} }
@@ -3738,7 +3738,7 @@ void wxAuiManager::UpdateButtonOnScreen(wxAuiDockUIPart* button_ui_part,
wxAuiDockUIPart* hit_test = HitTest(event.GetX(), event.GetY()); wxAuiDockUIPart* hit_test = HitTest(event.GetX(), event.GetY());
if (!hit_test || !button_ui_part) if (!hit_test || !button_ui_part)
return; return;
int state = wxAUI_BUTTON_STATE_NORMAL; int state = wxAUI_BUTTON_STATE_NORMAL;
if (hit_test == button_ui_part) if (hit_test == button_ui_part)
@@ -3783,7 +3783,7 @@ void wxAuiManager::OnLeftDown(wxMouseEvent& event)
{ {
if (part->dock && part->dock->dock_direction == wxAUI_DOCK_CENTER) if (part->dock && part->dock->dock_direction == wxAUI_DOCK_CENTER)
return; return;
// a dock may not be resized if it has a single // a dock may not be resized if it has a single
// pane which is not resizable // pane which is not resizable
if (part->type == wxAuiDockUIPart::typeDockSizer && part->dock && if (part->type == wxAuiDockUIPart::typeDockSizer && part->dock &&
@@ -3819,8 +3819,8 @@ void wxAuiManager::OnLeftDown(wxMouseEvent& event)
// we are an embedded wxAuiManager inside the wxAuiFloatingFrame. // we are an embedded wxAuiManager inside the wxAuiFloatingFrame.
// We want to initiate a toolbar drag in our owner manager // We want to initiate a toolbar drag in our owner manager
wxWindow* managed_wnd = GetManagedWindow(); wxWindow* managed_wnd = GetManagedWindow();
if (part->pane && if (part->pane &&
part->pane->window && part->pane->window &&
managed_wnd && managed_wnd &&
managed_wnd->IsKindOf(CLASSINFO(wxAuiFloatingFrame))) managed_wnd->IsKindOf(CLASSINFO(wxAuiFloatingFrame)))
@@ -3832,9 +3832,9 @@ void wxAuiManager::OnLeftDown(wxMouseEvent& event)
event.m_y - part->rect.y)); event.m_y - part->rect.y));
return; return;
} }
if (part->dock && part->dock->dock_direction == wxAUI_DOCK_CENTER) if (part->dock && part->dock->dock_direction == wxAUI_DOCK_CENTER)
return; return;
@@ -4259,12 +4259,12 @@ void wxAuiManager::OnMotion(wxMouseEvent& event)
UpdateButtonOnScreen(m_hover_button, event); UpdateButtonOnScreen(m_hover_button, event);
Repaint(); Repaint();
} }
// mouse is over a button, so repaint the // mouse is over a button, so repaint the
// button in hover mode // button in hover mode
UpdateButtonOnScreen(part, event); UpdateButtonOnScreen(part, event);
m_hover_button = part; m_hover_button = part;
} }
} }
else else