Moved wxWindow::SetSizeHints implementation to wxTopLevelWindow,
where it belongs, verified that it works for wxDialog, too. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@19886 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -56,6 +56,10 @@ public:
|
|||||||
virtual wxString GetTitle() const { return m_title; }
|
virtual wxString GetTitle() const { return m_title; }
|
||||||
virtual void SetTitle( const wxString& title ) { m_title = title; }
|
virtual void SetTitle( const wxString& title ) { m_title = title; }
|
||||||
|
|
||||||
|
virtual void SetSizeHints( int minW, int minH,
|
||||||
|
int maxW = -1, int maxH = -1,
|
||||||
|
int incW = -1, int incH = -1 );
|
||||||
|
|
||||||
WXWidget GetShellWidget() const;
|
WXWidget GetShellWidget() const;
|
||||||
protected:
|
protected:
|
||||||
// common part of all constructors
|
// common part of all constructors
|
||||||
|
@@ -92,9 +92,6 @@ public:
|
|||||||
virtual void ScrollWindow( int dx, int dy,
|
virtual void ScrollWindow( int dx, int dy,
|
||||||
const wxRect* rect = (wxRect *) NULL );
|
const wxRect* rect = (wxRect *) NULL );
|
||||||
|
|
||||||
virtual void SetSizeHints(int minW, int minH,
|
|
||||||
int maxW = -1, int maxH = -1,
|
|
||||||
int incW = -1, int incH = -1);
|
|
||||||
#if wxUSE_DRAG_AND_DROP
|
#if wxUSE_DRAG_AND_DROP
|
||||||
virtual void SetDropTarget( wxDropTarget *dropTarget );
|
virtual void SetDropTarget( wxDropTarget *dropTarget );
|
||||||
#endif // wxUSE_DRAG_AND_DROP
|
#endif // wxUSE_DRAG_AND_DROP
|
||||||
|
@@ -317,6 +317,25 @@ bool wxTopLevelWindowMotif::IsMaximized() const
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void wxTopLevelWindowMotif::SetSizeHints( int minW, int minH,
|
||||||
|
int maxW, int maxH,
|
||||||
|
int incW, int incH )
|
||||||
|
{
|
||||||
|
wxTopLevelWindowBase::SetSizeHints( minW, minH, maxW, maxH, incW, incH );
|
||||||
|
|
||||||
|
int count = 0;
|
||||||
|
Arg args[6];
|
||||||
|
|
||||||
|
if( minW > -1 ) { XtSetArg( args[count], XmNminWidth, minW ); ++count; }
|
||||||
|
if( minH > -1 ) { XtSetArg( args[count], XmNminHeight, minH ); ++count; }
|
||||||
|
if( maxW > -1 ) { XtSetArg( args[count], XmNmaxWidth, maxW ); ++count; }
|
||||||
|
if( maxH > -1 ) { XtSetArg( args[count], XmNmaxHeight, maxH ); ++count; }
|
||||||
|
if( incW > -1 ) { XtSetArg( args[count], XmNwidthInc, incW ); ++count; }
|
||||||
|
if( incH > -1 ) { XtSetArg( args[count], XmNheightInc, incH ); ++count; }
|
||||||
|
|
||||||
|
XtSetValues( (Widget)GetShellWidget(), args, count );
|
||||||
|
}
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
// Callback definition
|
// Callback definition
|
||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
|
@@ -1334,7 +1334,7 @@ void wxWindow::DoSetSizeIntr(int x, int y, int width, int height,
|
|||||||
wxSize size(-1, -1);
|
wxSize size(-1, -1);
|
||||||
if ( width <= 0 )
|
if ( width <= 0 )
|
||||||
{
|
{
|
||||||
if ( sizeFlags & wxSIZE_AUTO_WIDTH && !fromCtor )
|
if ( ( sizeFlags & wxSIZE_AUTO_WIDTH ) && !fromCtor )
|
||||||
{
|
{
|
||||||
size = DoGetBestSize();
|
size = DoGetBestSize();
|
||||||
width = size.x;
|
width = size.x;
|
||||||
@@ -1347,7 +1347,7 @@ void wxWindow::DoSetSizeIntr(int x, int y, int width, int height,
|
|||||||
|
|
||||||
if ( height == -1 )
|
if ( height == -1 )
|
||||||
{
|
{
|
||||||
if( sizeFlags & wxSIZE_AUTO_HEIGHT && !fromCtor )
|
if( ( sizeFlags & wxSIZE_AUTO_HEIGHT ) && !fromCtor )
|
||||||
{
|
{
|
||||||
if( size.x == -1 ) size = DoGetBestSize();
|
if( size.x == -1 ) size = DoGetBestSize();
|
||||||
height = size.y;
|
height = size.y;
|
||||||
@@ -1438,36 +1438,6 @@ wxPoint wxWindow::GetClientAreaOrigin() const
|
|||||||
return wxPoint(0, 0);
|
return wxPoint(0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxWindow::SetSizeHints(int minW, int minH, int maxW, int maxH, int incW, int incH)
|
|
||||||
{
|
|
||||||
m_minWidth = minW;
|
|
||||||
m_minHeight = minH;
|
|
||||||
m_maxWidth = maxW;
|
|
||||||
m_maxHeight = maxH;
|
|
||||||
|
|
||||||
wxFrame *frame = wxDynamicCast(this, wxFrame);
|
|
||||||
if ( !frame )
|
|
||||||
{
|
|
||||||
// TODO what about dialogs?
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
Widget widget = (Widget) frame->GetShellWidget();
|
|
||||||
|
|
||||||
if (minW > -1)
|
|
||||||
XtVaSetValues(widget, XmNminWidth, minW, NULL);
|
|
||||||
if (minH > -1)
|
|
||||||
XtVaSetValues(widget, XmNminHeight, minH, NULL);
|
|
||||||
if (maxW > -1)
|
|
||||||
XtVaSetValues(widget, XmNmaxWidth, maxW, NULL);
|
|
||||||
if (maxH > -1)
|
|
||||||
XtVaSetValues(widget, XmNmaxHeight, maxH, NULL);
|
|
||||||
if (incW > -1)
|
|
||||||
XtVaSetValues(widget, XmNwidthInc, incW, NULL);
|
|
||||||
if (incH > -1)
|
|
||||||
XtVaSetValues(widget, XmNheightInc, incH, NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
void wxWindow::DoMoveWindowIntr(int xx, int yy, int w, int h,
|
void wxWindow::DoMoveWindowIntr(int xx, int yy, int w, int h,
|
||||||
int flags)
|
int flags)
|
||||||
{
|
{
|
||||||
@@ -1479,7 +1449,6 @@ void wxWindow::DoMoveWindowIntr(int xx, int yy, int w, int h,
|
|||||||
(Widget) m_scrolledWindow;
|
(Widget) m_scrolledWindow;
|
||||||
|
|
||||||
bool managed = XtIsManaged(borderOrScrolled);
|
bool managed = XtIsManaged(borderOrScrolled);
|
||||||
|
|
||||||
if (managed)
|
if (managed)
|
||||||
XtUnmanageChild (borderOrScrolled);
|
XtUnmanageChild (borderOrScrolled);
|
||||||
XtVaSetValues(drawingArea, XmNresizePolicy, XmRESIZE_ANY, NULL);
|
XtVaSetValues(drawingArea, XmNresizePolicy, XmRESIZE_ANY, NULL);
|
||||||
@@ -2025,7 +1994,8 @@ WXWidget wxWindow::GetLabelWidget() const
|
|||||||
|
|
||||||
// All widgets should have this as their resize proc.
|
// All widgets should have this as their resize proc.
|
||||||
// OnSize sent to wxWindow via client data.
|
// OnSize sent to wxWindow via client data.
|
||||||
void wxWidgetResizeProc(Widget w, XConfigureEvent *WXUNUSED(event), String WXUNUSED(args)[], int *WXUNUSED(num_args))
|
void wxWidgetResizeProc(Widget w, XConfigureEvent *WXUNUSED(event),
|
||||||
|
String WXUNUSED(args)[], int *WXUNUSED(num_args))
|
||||||
{
|
{
|
||||||
wxWindow *win = wxGetWindowFromTable(w);
|
wxWindow *win = wxGetWindowFromTable(w);
|
||||||
if (!win)
|
if (!win)
|
||||||
@@ -2290,8 +2260,8 @@ static void wxCanvasInputEvent(Widget drawingArea,
|
|||||||
if (wxTranslateKeyEvent (event, canvas, (Widget) 0, &local_event))
|
if (wxTranslateKeyEvent (event, canvas, (Widget) 0, &local_event))
|
||||||
{
|
{
|
||||||
// Implement wxFrame::OnCharHook by checking ancestor.
|
// Implement wxFrame::OnCharHook by checking ancestor.
|
||||||
wxWindow *parent = canvas->GetParent();
|
wxWindow *parent = canvas;
|
||||||
while (parent && !parent->IsKindOf(CLASSINFO(wxFrame)))
|
while (parent && !parent->IsTopLevel())
|
||||||
parent = parent->GetParent();
|
parent = parent->GetParent();
|
||||||
|
|
||||||
if (parent)
|
if (parent)
|
||||||
|
Reference in New Issue
Block a user