#include "wx/defs.h"
-#if USE_CONSTRAINTS
-
#ifndef WX_PRECOMP
#include "wx/window.h"
#include "wx/utils.h"
#include "wx/dialog.h"
#include "wx/msgdlg.h"
+#include <wx/intl.h>
#endif
#include "wx/layout.h"
}
-wxIndividualLayoutConstraint::wxIndividualLayoutConstraint(void)
+wxIndividualLayoutConstraint::wxIndividualLayoutConstraint()
{
myEdge = wxTop; relationship = wxUnconstrained; margin = 0; value = 0; percent = 0; otherEdge = wxTop;
- done = FALSE; otherWin = NULL;
+ done = FALSE; otherWin = (wxWindow *) NULL;
}
-wxIndividualLayoutConstraint::~wxIndividualLayoutConstraint(void)
+wxIndividualLayoutConstraint::~wxIndividualLayoutConstraint()
{
}
if (otherW == otherWin)
{
myEdge = wxTop; relationship = wxAsIs; margin = 0; value = 0; percent = 0; otherEdge = wxTop;
- otherWin = NULL;
+ otherWin = (wxWindow *) NULL;
return TRUE;
}
else
// Get the value of this edge or dimension, or if this
// is not determinable, -1.
-int wxIndividualLayoutConstraint::GetEdge(wxEdge which, wxWindow *thisWin, wxWindow *other)
+int wxIndividualLayoutConstraint::GetEdge(wxEdge which,
+ wxWindow *thisWin,
+ wxWindow *other) const
{
// If the edge or dimension belongs to the parent, then we
// know the dimension is obtainable immediately.
// E.g. a wxExpandSizer may contain a button (but the button's
// true parent is a panel, not the sizer)
- if (other->GetChildren()->Member(thisWin))
+ if (other->GetChildren().Member(thisWin))
{
switch (which)
{
return -1;
}
-wxLayoutConstraints::wxLayoutConstraints(void)
+wxLayoutConstraints::wxLayoutConstraints()
{
left.SetEdge(wxLeft);
top.SetEdge(wxTop);
height.SetEdge(wxHeight);
}
-wxLayoutConstraints::~wxLayoutConstraints(void)
+wxLayoutConstraints::~wxLayoutConstraints()
{
}
*nChanges = noChanges;
- return (left.GetDone() && top.GetDone() && right.GetDone() && bottom.GetDone() &&
- centreX.GetDone() && centreY.GetDone());
+ return AreSatisfied();
}
/*
doneSoFar.Append(win);
- wxNode *node = win->GetChildren()->First();
+ wxNode *node = win->GetChildren().First();
while (node)
{
wxWindow *child = (wxWindow *)node->Data();
while ((noChanges > 0) && (noIterations < maxIterations))
{
noChanges = 0;
- wxNode *node = win->GetChildren()->First();
+ wxNode *node = win->GetChildren().First();
while (node)
{
wxWindow *child = (wxWindow *)node->Data();
if (constr)
{
int tempNoChanges = 0;
- (void) constr->SatisfyConstraints(child, &tempNoChanges);
+ (void)constr->SatisfyConstraints(child, &tempNoChanges);
noChanges += tempNoChanges;
}
node = node->Next();
// failed, so we can print a specific diagnostic message.
if (noFailures > 0)
{
- wxDebugMsg("wxWindow::Layout() failed.\n");
+ wxDebugMsg(_("wxWindow::Layout() failed.\n"));
}
*/
// Now set the sizes and positions of the children, and
// recursively call Layout().
- node = win->GetChildren()->First();
+ node = win->GetChildren().First();
while (node)
{
wxWindow *child = (wxWindow *)node->Data();
return TRUE;
}
-wxSizer::wxSizer(void)
+wxSizer::wxSizer()
{
sizerBehaviour = wxSizerNone;
borderX = 2;
return TRUE;
}
-wxSizer::~wxSizer(void)
+wxSizer::~wxSizer()
{
// Remove all children without deleting them,
// or ~wxbWindow will delete proper windows _twice_
- wxNode *node = GetChildren()->First();
+ wxNode *node = GetChildren().First();
while (node)
{
wxNode *next = node->Next();
if (!win->IsKindOf(CLASSINFO(wxSizer)))
{
delete node;
- win->SetSizerParent(NULL);
+ win->SetSizerParent((wxWindow *) NULL);
}
else
{
if (m_sizerParent) // && !m_sizerParent->IsKindOf(CLASSINFO(wxSizer)))
{
- m_sizerParent->SetSizer(NULL);
- m_sizerParent = NULL;
+ m_sizerParent->SetSizer((wxSizer *) NULL);
+ m_sizerParent = (wxWindow *) NULL;
}
}
void wxSizer::AddSizerChild(wxWindow *child)
{
child->SetSizerParent(this);
- GetChildren()->Append(child);
+ GetChildren().Append(child);
// Add some constraints for the purpose of storing
// the relative position of the window/sizer
void wxSizer::RemoveSizerChild(wxWindow *child)
{
- GetChildren()->DeleteObject(child);
+ GetChildren().DeleteObject(child);
}
-void wxSizer::SetSize(const int x, const int y, const int w, const int h, const int WXUNUSED(flags))
+void wxSizer::DoSetSize(int x, int y, int w, int h, int WXUNUSED(flags))
{
wxLayoutConstraints *constr = GetConstraints();
if (x != -1)
}
}
-void wxSizer::Move(const int x, const int y)
-{
- wxLayoutConstraints *constr = GetConstraints();
- if (x != -1)
- {
- sizerX = x;
- if (constr)
- constr->left.SetValue(x);
- }
- if (y != -1)
- {
- sizerY = y;
- if (constr)
- constr->top.SetValue(y);
- }
-}
-
void wxSizer::GetSize(int *w, int *h) const
{
*w = sizerWidth;
{
if (!m_sizerParent)
{
- wxMessageBox("wxExpandSizer has no parent!", "Sizer error", wxOK);
+ wxMessageBox(_("wxExpandSizer has no parent!"), _("Sizer error"), wxOK);
return TRUE;
}
// Find the bounding box and set own size
int maxX = 0;
int maxY = 0;
- wxNode *node = GetChildren()->First();
+
+ wxNode *node = GetChildren().First();
while (node)
{
int x, y, width, height;
maxX = (x + width);
if ((y+height) > maxY)
maxY = (y + height);
+
node = node->Next();
}
SetSize(GetBorderX(), GetBorderY(), maxX, maxY);
-
+
// If this is the only sizer for the parent, size the parent to this sizer.
if ( m_sizerParent && (m_sizerParent->GetSizer() == this) )
m_sizerParent->SetClientSize(maxX + 2*GetBorderX(), maxY + 2*GetBorderY());
* wxRowColSizer
*/
-wxRowColSizer::wxRowColSizer(void)
+wxRowColSizer::wxRowColSizer()
{
rowOrCol = TRUE;
rowOrColSize = 20;
return TRUE;
}
-wxRowColSizer::~wxRowColSizer(void)
-{
-}
-
-void wxRowColSizer::SetSize(const int x, const int y, const int w, const int h, const int flags)
+wxRowColSizer::~wxRowColSizer()
{
- wxSizer::SetSize(x, y, w, h, flags);
}
bool wxRowColSizer::LayoutPhase1(int *noChanges)
int currentY = borderY;
int maxX = currentX;
int maxY = currentY;
-
- wxNode *node = GetChildren()->First();
+
+ wxNode *node = GetChildren().First();
while (node)
{
wxWindow *win = (wxWindow *)node->Data();
* wxSpacingSizer
*/
-wxSpacingSizer::wxSpacingSizer(void)
+wxSpacingSizer::wxSpacingSizer()
{
}
return TRUE;
}
-wxSpacingSizer::~wxSpacingSizer(void)
+wxSpacingSizer::~wxSpacingSizer()
{
}
-
-
-#endif