Get/SetTitle only for wxTopLevelWindow (wxOS2 part).

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@36088 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Włodzimierz Skiba
2005-11-04 21:13:03 +00:00
parent c032d94e60
commit 743e24aa72
11 changed files with 221 additions and 251 deletions

View File

@@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
// Name: control.h // Name: wx/os2/control.h
// Purpose: wxControl class // Purpose: wxControl class
// Author: David Webster // Author: David Webster
// Modified by: // Modified by:
@@ -30,14 +30,7 @@ public:
,const wxString& rsName = wxControlNameStr ,const wxString& rsName = wxControlNameStr
) )
{ {
Create( pParent Create( pParent, vId, rPos, rSize, lStyle, rValidator, rsName );
,vId
,rPos
,rSize
,lStyle
,rValidator
,rsName
);
} }
virtual ~wxControl(); virtual ~wxControl();
@@ -51,6 +44,7 @@ public:
); );
virtual void SetLabel(const wxString& rsLabel); virtual void SetLabel(const wxString& rsLabel);
virtual wxString GetLabel() const { return m_label; }
// //
// Simulates an event // Simulates an event
@@ -70,7 +64,7 @@ public:
// //
// For ownerdraw items // For ownerdraw items
// //
virtual bool OS2OnDraw(WXDRAWITEMSTRUCT* WXUNUSED(pItem)) { return FALSE; }; virtual bool OS2OnDraw(WXDRAWITEMSTRUCT* WXUNUSED(pItem)) { return false; };
virtual long OS2OnMeasure(WXMEASUREITEMSTRUCT* WXUNUSED(pItem)) { return 0L; }; virtual long OS2OnMeasure(WXMEASUREITEMSTRUCT* WXUNUSED(pItem)) { return 0L; };
wxArrayLong& GetSubcontrols() { return m_aSubControls; } wxArrayLong& GetSubcontrols() { return m_aSubControls; }
@@ -101,7 +95,7 @@ public:
,long lStyle ,long lStyle
); );
// //
// Create the control of the given class with the given style, returns FALSE // Create the control of the given class with the given style, returns false
// if creation failed. // if creation failed.
// //
bool OS2CreateControl( const wxChar* zClassname bool OS2CreateControl( const wxChar* zClassname
@@ -127,8 +121,10 @@ public:
private: private:
int m_nXComp; int m_nXComp;
int m_nYComp; int m_nYComp;
wxString m_label;
DECLARE_EVENT_TABLE() DECLARE_EVENT_TABLE()
}; // end of wxControl }; // end of wxControl
#endif // _WX_CONTROL_H_ #endif // _WX_CONTROL_H_

View File

@@ -160,14 +160,14 @@ public:
); );
virtual bool SetStringSelection(const wxString& rsStr); virtual bool SetStringSelection(const wxString& rsStr);
void SetLabel( int nItem virtual void SetLabel(const wxString& rsLabel)
,const wxString& rsLabel { wxControl::SetLabel(rsLabel); }
); virtual wxString GetLabel() const
void SetLabel( int item { return wxControl::GetLabel(); }
,wxBitmap* pBitmap
);
wxString GetLabel(int nItem) const;
void SetLabel( int nItem, const wxString& rsLabel );
void SetLabel( int item, wxBitmap* pBitmap );
wxString GetLabel(int nItem) const;
protected: protected:
virtual wxSize DoGetBestSize(void) const; virtual wxSize DoGetBestSize(void) const;
@@ -192,13 +192,8 @@ protected:
int m_nSizeFlags; int m_nSizeFlags;
private: private:
inline wxString GetLabel() const
{ return wxWindowBase::GetLabel(); }
inline void SetLabel(const wxString& rsLabel)
{ wxWindowBase::SetLabel(rsLabel); }
DECLARE_DYNAMIC_CLASS(wxRadioBox) DECLARE_DYNAMIC_CLASS(wxRadioBox)
}; // end of wxRadioBox }; // end of wxRadioBox
#endif #endif // _WX_RADIOBOX_H_
// _WX_RADIOBOX_H_

View File

@@ -1,6 +1,6 @@
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
// Name: wx/msw/toplevel.h // Name: wx/os2/toplevel.h
// Purpose: wxTopLevelWindowMSW is the MSW implementation of wxTLW // Purpose: wxTopLevelWindowOS2 is the OS2 implementation of wxTLW
// Author: Vadim Zeitlin // Author: Vadim Zeitlin
// Modified by: // Modified by:
// Created: 20.09.01 // Created: 20.09.01
@@ -12,9 +12,11 @@
#ifndef _WX_MSW_TOPLEVEL_H_ #ifndef _WX_MSW_TOPLEVEL_H_
#define _WX_MSW_TOPLEVEL_H_ #define _WX_MSW_TOPLEVEL_H_
enum ETemplateID { kResizeableDialog = 130 enum ETemplateID
,kCaptionDialog {
,kNoCaptionDialog kResizeableDialog = 130,
kCaptionDialog,
kNoCaptionDialog
}; };
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
@@ -55,26 +57,28 @@ public:
// //
// Implement base class pure virtuals // Implement base class pure virtuals
// //
virtual void Iconize(bool bIconize = TRUE); virtual void SetTitle( const wxString& title);
inline virtual bool IsFullScreen(void) const { return m_bFsIsShowing; } virtual wxString GetTitle() const;
virtual void Iconize(bool bIconize = true);
virtual bool IsFullScreen(void) const { return m_bFsIsShowing; }
virtual bool IsIconized(void) const; virtual bool IsIconized(void) const;
virtual bool IsMaximized(void) const; virtual bool IsMaximized(void) const;
virtual void Maximize(bool bMaximize = TRUE); virtual void Maximize(bool bMaximize = true);
virtual void Restore(void); virtual void Restore(void);
virtual void SendSizeEvent(void); virtual void SendSizeEvent(void);
virtual void SetIcon(const wxIcon& rIcon); virtual void SetIcon(const wxIcon& rIcon);
virtual void SetIcons(const wxIconBundle& rIcons); virtual void SetIcons(const wxIconBundle& rIcons);
virtual bool Show(bool bShow = TRUE); virtual bool Show(bool bShow = true);
virtual bool ShowFullScreen( bool bShow virtual bool ShowFullScreen( bool bShow,
,long lStyle = wxFULLSCREEN_ALL long lStyle = wxFULLSCREEN_ALL );
);
// //
// EnableCloseButton(FALSE) may be used to remove the "Close" // EnableCloseButton(false) may be used to remove the "Close"
// button from the title bar // button from the title bar
// //
bool EnableCloseButton(bool bEnable = TRUE); bool EnableCloseButton(bool bEnable = true);
HWND GetFrame(void) const { return m_hFrame; } HWND GetFrame(void) const { return m_hFrame; }
// //
@@ -87,14 +91,16 @@ public:
void SetLastFocus(wxWindow *pWin) { m_pWinLastFocused = pWin; } void SetLastFocus(wxWindow *pWin) { m_pWinLastFocused = pWin; }
wxWindow* GetLastFocus(void) const { return m_pWinLastFocused; } wxWindow* GetLastFocus(void) const { return m_pWinLastFocused; }
protected: protected:
// //
// Common part of all ctors // Common part of all ctors
// //
void Init(void); void Init(void);
// //
// Create a new frame, return FALSE if it couldn't be created // Create a new frame, return false if it couldn't be created
// //
bool CreateFrame( const wxString& rsTitle bool CreateFrame( const wxString& rsTitle
,const wxPoint& rPos ,const wxPoint& rPos
@@ -103,7 +109,7 @@ protected:
// //
// Create a new dialog using the given dialog template from resources, // Create a new dialog using the given dialog template from resources,
// return FALSE if it couldn't be created // return false if it couldn't be created
// //
bool CreateDialog( ULONG ulDlgTemplate bool CreateDialog( ULONG ulDlgTemplate
,const wxString& rsTitle ,const wxString& rsTitle
@@ -170,4 +176,3 @@ protected:
}; // end of CLASS wxTopLevelWindowOS2 }; // end of CLASS wxTopLevelWindowOS2
#endif // _WX_MSW_TOPLEVEL_H_ #endif // _WX_MSW_TOPLEVEL_H_

View File

@@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
// Name: window.h // Name: wx/os2/window.h
// Purpose: wxWindow class // Purpose: wxWindow class
// Author: David Webster // Author: David Webster
// Modified by: // Modified by:
@@ -90,8 +90,8 @@ public:
); );
// implement base class pure virtuals // implement base class pure virtuals
virtual void SetTitle(const wxString& rTitle); virtual void SetLabel(const wxString& label);
virtual wxString GetTitle(void) const; virtual wxString GetLabel(void) const;
virtual void Raise(void); virtual void Raise(void);
virtual void Lower(void); virtual void Lower(void);
virtual bool Show(bool bShow = true); virtual bool Show(bool bShow = true);
@@ -587,5 +587,4 @@ WX_DECLARE_HASH(wxWindowOS2, wxWindowList, wxWinHashTable);
extern wxWinHashTable *wxWinHandleHash; extern wxWinHashTable *wxWinHandleHash;
#endif #endif // _WX_WINDOW_H_
// _WX_WINDOW_H_

View File

@@ -157,6 +157,7 @@ public:
#if defined(__WXMSW__) || \ #if defined(__WXMSW__) || \
defined(__WXMGL__) || \ defined(__WXMGL__) || \
defined(__WXMOTIF__) || \ defined(__WXMOTIF__) || \
defined(__WXPM__) || \
defined(__WXGTK__) defined(__WXGTK__)
// FIXME: This is work in progress about moving SetTitle/GetTitle from wxWindow // FIXME: This is work in progress about moving SetTitle/GetTitle from wxWindow

View File

@@ -171,6 +171,7 @@ public:
#if !defined(__WXMSW__) && \ #if !defined(__WXMSW__) && \
!defined(__WXMGL__) && \ !defined(__WXMGL__) && \
!defined(__WXMOTIF__) && \ !defined(__WXMOTIF__) && \
!defined(__WXPM__) && \
!defined(__WXGTK__) !defined(__WXGTK__)
// FIXME: This is work in progress about moving SetTitle/GetTitle from wxWindow // FIXME: This is work in progress about moving SetTitle/GetTitle from wxWindow

View File

@@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
// Name: control.cpp // Name: src/os2/control.cpp
// Purpose: wxControl class // Purpose: wxControl class
// Author: David Webster // Author: David Webster
// Modified by: // Modified by:
@@ -64,18 +64,14 @@ wxControl::~wxControl()
m_isBeingDeleted = true; m_isBeingDeleted = true;
} }
bool wxControl::OS2CreateControl( bool wxControl::OS2CreateControl( const wxChar* zClassname,
const wxChar* zClassname const wxString& rsLabel,
, const wxString& rsLabel const wxPoint& rPos,
, const wxPoint& rPos const wxSize& rSize,
, const wxSize& rSize long lStyle )
, long lStyle
)
{ {
WXDWORD dwExstyle; WXDWORD dwExstyle;
WXDWORD dwStyle = OS2GetStyle( lStyle WXDWORD dwStyle = OS2GetStyle( lStyle, &dwExstyle );
,&dwExstyle
);
return OS2CreateControl( zClassname return OS2CreateControl( zClassname
,dwStyle ,dwStyle
@@ -112,7 +108,7 @@ bool wxControl::OS2CreateControl( const wxChar* zClassname,
PSZ zClass = ""; PSZ zClass = "";
if (!pParent) if (!pParent)
return FALSE; return false;
if ((wxStrcmp(zClassname, _T("COMBOBOX"))) == 0) if ((wxStrcmp(zClassname, _T("COMBOBOX"))) == 0)
zClass = WC_COMBOBOX; zClass = WC_COMBOBOX;
@@ -126,11 +122,12 @@ bool wxControl::OS2CreateControl( const wxChar* zClassname,
zClass = WC_CONTAINER; zClass = WC_CONTAINER;
dwStyle |= WS_VISIBLE; dwStyle |= WS_VISIBLE;
wxString sLabel = ::wxPMTextToLabel(rsLabel); m_label = rsLabel;
wxString label = ::wxPMTextToLabel(m_label);
m_hWnd = (WXHWND)::WinCreateWindow( (HWND)GetHwndOf(pParent) // Parent window handle m_hWnd = (WXHWND)::WinCreateWindow( (HWND)GetHwndOf(pParent) // Parent window handle
,(PSZ)zClass // Window class ,(PSZ)zClass // Window class
,(PSZ)sLabel.c_str() // Initial Text ,(PSZ)label.c_str() // Initial Text
,(ULONG)dwStyle // Style flags ,(ULONG)dwStyle // Style flags
,(LONG)0 // X pos of origin ,(LONG)0 // X pos of origin
,(LONG)0 // Y pos of origin ,(LONG)0 // Y pos of origin
@@ -149,7 +146,7 @@ bool wxControl::OS2CreateControl( const wxChar* zClassname,
wxLogError(wxT("Failed to create a control of class '%s'"), zClassname); wxLogError(wxT("Failed to create a control of class '%s'"), zClassname);
#endif // DEBUG #endif // DEBUG
return FALSE; return false;
} }
// //
// Subclass again for purposes of dialog editing mode // Subclass again for purposes of dialog editing mode
@@ -167,11 +164,7 @@ bool wxControl::OS2CreateControl( const wxChar* zClassname,
SetXComp(0); SetXComp(0);
SetYComp(0); SetYComp(0);
SetSize( rPos.x SetSize( rPos.x, rPos.y, rSize.x, rSize.y );
,rPos.y
,rSize.x
,rSize.y
);
return true; return true;
} // end of wxControl::OS2CreateControl } // end of wxControl::OS2CreateControl
@@ -210,9 +203,7 @@ WXHBRUSH wxControl::OnCtlColor(WXHDC hWxDC,
return (WXHBRUSH)pBrush->GetResourceHandle(); return (WXHBRUSH)pBrush->GetResourceHandle();
} // end of wxControl::OnCtlColor } // end of wxControl::OnCtlColor
void wxControl::OnEraseBackground( void wxControl::OnEraseBackground( wxEraseEvent& rEvent )
wxEraseEvent& rEvent
)
{ {
RECTL vRect; RECTL vRect;
HPS hPS = rEvent.GetDC()->GetHPS(); HPS hPS = rEvent.GetDC()->GetHPS();
@@ -223,14 +214,9 @@ void wxControl::OnEraseBackground(
::WinFillRect(hPS, &vRect, GetBackgroundColour().GetPixel()); ::WinFillRect(hPS, &vRect, GetBackgroundColour().GetPixel());
} // end of wxControl::OnEraseBackground } // end of wxControl::OnEraseBackground
WXDWORD wxControl::OS2GetStyle( WXDWORD wxControl::OS2GetStyle( long lStyle, WXDWORD* pdwExstyle ) const
long lStyle
, WXDWORD* pdwExstyle
) const
{ {
long dwStyle = wxWindow::OS2GetStyle( lStyle long dwStyle = wxWindow::OS2GetStyle( lStyle, pdwExstyle );
,pdwExstyle
);
if (AcceptsFocus()) if (AcceptsFocus())
{ {
@@ -239,13 +225,14 @@ WXDWORD wxControl::OS2GetStyle(
return dwStyle; return dwStyle;
} // end of wxControl::OS2GetStyle } // end of wxControl::OS2GetStyle
void wxControl::SetLabel( void wxControl::SetLabel( const wxString& rsLabel )
const wxString& rsLabel
)
{ {
wxString sLabel = ::wxPMTextToLabel(rsLabel); if(rsLabel != m_label)
{
::WinSetWindowText(GetHwnd(), (PSZ)sLabel.c_str()); m_label = rsLabel;
wxString label = ::wxPMTextToLabel(rsLabel);
::WinSetWindowText(GetHwnd(), (PSZ)label.c_str());
}
} // end of wxControl::SetLabel } // end of wxControl::SetLabel
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------

View File

@@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
// Name: dialog.cpp // Name: src/os2/dialog.cpp
// Purpose: wxDialog class // Purpose: wxDialog class
// Author: David Webster // Author: David Webster
// Modified by: // Modified by:
@@ -83,7 +83,7 @@ wxDEFINE_TIED_SCOPED_PTR_TYPE(wxDialogModalData);
void wxDialog::Init() void wxDialog::Init()
{ {
m_pOldFocus = (wxWindow *)NULL; m_pOldFocus = (wxWindow *)NULL;
m_isShown = FALSE; m_isShown = false;
m_pWindowDisabler = (wxWindowDisabler *)NULL; m_pWindowDisabler = (wxWindowDisabler *)NULL;
m_modalData = NULL; m_modalData = NULL;
SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_3DFACE)); SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_3DFACE));
@@ -227,9 +227,7 @@ wxWindow *wxDialog::FindSuitableParent() const
return parent; return parent;
} }
bool wxDialog::Show( bool wxDialog::Show( bool bShow )
bool bShow
)
{ {
if ( bShow == IsShown() ) if ( bShow == IsShown() )
return false; return false;
@@ -261,8 +259,9 @@ bool wxDialog::Show(
wxDialogBase::Show(bShow); wxDialogBase::Show(bShow);
if (GetTitle().c_str()) wxString title = GetTitle();
::WinSetWindowText((HWND)GetHwnd(), (PSZ)GetTitle().c_str()); if (!title.empty())
::WinSetWindowText((HWND)GetHwnd(), (PSZ)title.c_str());
if ( bShow ) if ( bShow )
{ {
@@ -322,7 +321,7 @@ int wxDialog::ShowModal()
extern bool gbInOnIdle; extern bool gbInOnIdle;
bool bWasInOnIdle = gbInOnIdle; bool bWasInOnIdle = gbInOnIdle;
gbInOnIdle = FALSE; gbInOnIdle = false;
// enter and run the modal loop // enter and run the modal loop
{ {
@@ -432,14 +431,10 @@ void wxDialog::OnSysColourChanged( wxSysColourChangedEvent& WXUNUSED(rEvent) )
Refresh(); Refresh();
} // end of wxDialog::OnSysColourChanged } // end of wxDialog::OnSysColourChanged
MRESULT wxDialog::OS2WindowProc( MRESULT wxDialog::OS2WindowProc( WXUINT uMessage, WXWPARAM wParam, WXLPARAM lParam )
WXUINT uMessage
, WXWPARAM wParam
, WXLPARAM lParam
)
{ {
MRESULT rc = 0; MRESULT rc = 0;
bool bProcessed = FALSE; bool bProcessed = false;
switch (uMessage) switch (uMessage)
{ {

View File

@@ -376,16 +376,16 @@ bool wxRadioBox::Create(
// //
// Create a dummy radio control to end the group. // Create a dummy radio control to end the group.
// //
(void)::WinCreateWindow ( GetHwndOf(pParent) (void)::WinCreateWindow ( GetHwndOf(pParent),
,WC_BUTTON WC_BUTTON,
,"" "",
,WS_GROUP | BS_AUTORADIOBUTTON WS_GROUP | BS_AUTORADIOBUTTON,
,0, 0, 0, 0 0, 0, 0, 0,
,GetWinHwnd(pParent) GetWinHwnd(pParent),
,HWND_TOP HWND_TOP,
,(HMENU)NewControlId() (HMENU)NewControlId(),
,NULL NULL,
,NULL NULL
); );
SetFont(*wxSMALL_FONT); SetFont(*wxSMALL_FONT);
fnWndProcRadioBox = (WXFARPROC)::WinSubclassWindow( GetHwnd() fnWndProcRadioBox = (WXFARPROC)::WinSubclassWindow( GetHwnd()
@@ -824,10 +824,7 @@ int wxRadioBox::GetSelection() const
return m_nSelectedButton; return m_nSelectedButton;
} // end of wxRadioBox::GetSelection } // end of wxRadioBox::GetSelection
void wxRadioBox::GetSize( void wxRadioBox::GetSize( int* pnWidth, int* pnHeight ) const
int* pnWidth
, int* pnHeight
) const
{ {
RECT vRect; RECT vRect;
int i; int i;
@@ -891,10 +888,7 @@ wxSize wxRadioBox::GetTotalButtonSize( const wxSize& rSizeBtn ) const
// //
// And also wide enough for its label // And also wide enough for its label
// //
GetTextExtent( GetTitle() GetTextExtent( GetLabel(), &nWidthLabel, NULL );
,&nWidthLabel
,NULL
);
nWidthLabel += RADIO_SIZE; nWidthLabel += RADIO_SIZE;
if (nWidthLabel > nWidth) if (nWidthLabel > nWidth)
nWidth = nWidthLabel; nWidth = nWidthLabel;
@@ -1184,17 +1178,14 @@ MRESULT wxRadioBtnWndProc(
); );
} // end of wxRadioBtnWndProc } // end of wxRadioBtnWndProc
MRESULT EXPENTRY wxRadioBoxWndProc( MRESULT EXPENTRY wxRadioBoxWndProc( HWND hWnd,
HWND hWnd UINT uMessage,
, UINT uMessage MPARAM wParam,
, MPARAM wParam MPARAM lParam )
, MPARAM lParam
)
{ {
return (fnWndProcRadioBox( hWnd return (fnWndProcRadioBox( hWnd,
,(ULONG)uMessage (ULONG)uMessage,
,(MPARAM)wParam (MPARAM)wParam,
,(MPARAM)lParam (MPARAM)lParam )
)
); );
} // end of wxRadioBoxWndProc } // end of wxRadioBoxWndProc

View File

@@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
// Name: os2/toplevel.cpp // Name: src/os2/toplevel.cpp
// Purpose: implements wxTopLevelWindow for OS/2 // Purpose: implements wxTopLevelWindow for OS/2
// Author: Vadim Zeitlin // Author: Vadim Zeitlin
// Modified by: // Modified by:
@@ -49,10 +49,9 @@
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
// the name of the default wxWidgets class // the name of the default wxWidgets class
extern void wxAssociateWinWithHandle( HWND hWnd extern void wxAssociateWinWithHandle( HWND hWnd, wxWindowOS2* pWin );
,wxWindowOS2* pWin
); bool wxTopLevelWindowOS2::m_sbInitialized = false;
bool wxTopLevelWindowOS2::m_sbInitialized = FALSE;
wxWindow* wxTopLevelWindowOS2::m_spHiddenParent = NULL; wxWindow* wxTopLevelWindowOS2::m_spHiddenParent = NULL;
// ============================================================================ // ============================================================================
@@ -132,19 +131,19 @@ IMPLEMENT_DYNAMIC_CLASS(wxTLWHiddenParentModule, wxModule)
void wxTopLevelWindowOS2::Init() void wxTopLevelWindowOS2::Init()
{ {
m_bIconized = m_bMaximizeOnShow = FALSE; m_bIconized = m_bMaximizeOnShow = false;
// //
// Unlike (almost?) all other windows, frames are created hidden // Unlike (almost?) all other windows, frames are created hidden
// //
m_isShown = FALSE; m_isShown = false;
// //
// Data to save/restore when calling ShowFullScreen // Data to save/restore when calling ShowFullScreen
m_lFsStyle = 0; m_lFsStyle = 0;
m_lFsOldWindowStyle = 0; m_lFsOldWindowStyle = 0;
m_bFsIsMaximized = FALSE; m_bFsIsMaximized = false;
m_bFsIsShowing = FALSE; m_bFsIsShowing = false;
m_hFrame = NULLHANDLE; m_hFrame = NULLHANDLE;
memset(&m_vSwp, 0, sizeof(SWP)); memset(&m_vSwp, 0, sizeof(SWP));
@@ -360,7 +359,7 @@ bool wxTopLevelWindowOS2::CreateDialog( ULONG ulDlgTemplate,
wxLogSysError(wxT("Can't create dialog using template '%ld'"), ulDlgTemplate); wxLogSysError(wxT("Can't create dialog using template '%ld'"), ulDlgTemplate);
return FALSE; return false;
} }
// //
@@ -418,7 +417,7 @@ bool wxTopLevelWindowOS2::CreateDialog( ULONG ulDlgTemplate,
,(PVOID)&lColor ,(PVOID)&lColor
)) ))
{ {
return FALSE; return false;
} }
::WinSetWindowPos( GetHwnd() ::WinSetWindowPos( GetHwnd()
@@ -432,14 +431,12 @@ bool wxTopLevelWindowOS2::CreateDialog( ULONG ulDlgTemplate,
::WinQueryWindowPos(GetHwnd(), GetSwp()); ::WinQueryWindowPos(GetHwnd(), GetSwp());
m_hFrame = m_hWnd; m_hFrame = m_hWnd;
SubclassWin(m_hWnd); SubclassWin(m_hWnd);
return TRUE; return true;
} // end of wxTopLevelWindowOS2::CreateDialog } // end of wxTopLevelWindowOS2::CreateDialog
bool wxTopLevelWindowOS2::CreateFrame( bool wxTopLevelWindowOS2::CreateFrame( const wxString& rsTitle,
const wxString& rsTitle const wxPoint& rPos,
, const wxPoint& rPos const wxSize& rSize )
, const wxSize& rSize
)
{ {
WXDWORD lExflags; WXDWORD lExflags;
WXDWORD lFlags = OS2GetCreateWindowFlags(&lExflags); WXDWORD lFlags = OS2GetCreateWindowFlags(&lExflags);
@@ -470,7 +467,7 @@ bool wxTopLevelWindowOS2::CreateFrame(
// Clear the visible flag, we always call show // Clear the visible flag, we always call show
// //
ulStyleFlags &= (unsigned long)~WS_VISIBLE; ulStyleFlags &= (unsigned long)~WS_VISIBLE;
m_bIconized = FALSE; m_bIconized = false;
// //
// Create the frame window: We break ranks with other ports now // Create the frame window: We break ranks with other ports now
@@ -494,7 +491,7 @@ bool wxTopLevelWindowOS2::CreateFrame(
vError = ::WinGetLastError(vHabmain); vError = ::WinGetLastError(vHabmain);
sError = wxPMErrorToStr(vError); sError = wxPMErrorToStr(vError);
wxLogError(_T("Error creating frame. Error: %s\n"), sError.c_str()); wxLogError(_T("Error creating frame. Error: %s\n"), sError.c_str());
return FALSE; return false;
} }
// //
@@ -518,7 +515,7 @@ bool wxTopLevelWindowOS2::CreateFrame(
vError = ::WinGetLastError(vHabmain); vError = ::WinGetLastError(vHabmain);
sError = wxPMErrorToStr(vError); sError = wxPMErrorToStr(vError);
wxLogError(_T("Error creating frame. Error: %s\n"), sError.c_str()); wxLogError(_T("Error creating frame. Error: %s\n"), sError.c_str());
return FALSE; return false;
} }
// //
@@ -555,7 +552,7 @@ bool wxTopLevelWindowOS2::CreateFrame(
vError = ::WinGetLastError(vHabmain); vError = ::WinGetLastError(vHabmain);
sError = wxPMErrorToStr(vError); sError = wxPMErrorToStr(vError);
wxLogError(_T("Error sizing frame. Error: %s\n"), sError.c_str()); wxLogError(_T("Error sizing frame. Error: %s\n"), sError.c_str());
return FALSE; return false;
} }
lStyle = ::WinQueryWindowULong( m_hWnd lStyle = ::WinQueryWindowULong( m_hWnd
,QWL_STYLE ,QWL_STYLE
@@ -565,7 +562,7 @@ bool wxTopLevelWindowOS2::CreateFrame(
,QWL_STYLE ,QWL_STYLE
,lStyle ,lStyle
); );
return TRUE; return true;
} // end of wxTopLevelWindowOS2::CreateFrame } // end of wxTopLevelWindowOS2::CreateFrame
bool wxTopLevelWindowOS2::Create( bool wxTopLevelWindowOS2::Create(
@@ -713,9 +710,7 @@ void wxTopLevelWindowOS2::DoShowWindow(
m_bIconized = nShowCmd == SWP_MINIMIZE; m_bIconized = nShowCmd == SWP_MINIMIZE;
} // end of wxTopLevelWindowOS2::DoShowWindow } // end of wxTopLevelWindowOS2::DoShowWindow
bool wxTopLevelWindowOS2::Show( bool wxTopLevelWindowOS2::Show( bool bShow )
bool bShow
)
{ {
int nShowCmd; int nShowCmd;
SWP vSwp; SWP vSwp;
@@ -726,14 +721,14 @@ bool wxTopLevelWindowOS2::Show(
} }
else else
{ {
return FALSE; return false;
} }
if (bShow) if (bShow)
{ {
if (m_bMaximizeOnShow) if (m_bMaximizeOnShow)
{ {
nShowCmd = SWP_MAXIMIZE; nShowCmd = SWP_MAXIMIZE;
m_bMaximizeOnShow = FALSE; m_bMaximizeOnShow = false;
} }
else else
{ {
@@ -748,7 +743,7 @@ bool wxTopLevelWindowOS2::Show(
if (bShow) if (bShow)
{ {
wxActivateEvent vEvent(wxEVT_ACTIVATE, TRUE, m_windowId); wxActivateEvent vEvent(wxEVT_ACTIVATE, true, m_windowId);
::WinQueryWindowPos(m_hFrame, &vSwp); ::WinQueryWindowPos(m_hFrame, &vSwp);
m_bIconized = ( vSwp.fl & SWP_MINIMIZE ) == SWP_MINIMIZE ; m_bIconized = ( vSwp.fl & SWP_MINIMIZE ) == SWP_MINIMIZE ;
@@ -778,7 +773,7 @@ bool wxTopLevelWindowOS2::Show(
::WinEnableWindow(hWndParent, TRUE); ::WinEnableWindow(hWndParent, TRUE);
} }
} }
return TRUE; return true;
} // end of wxTopLevelWindowOS2::Show } // end of wxTopLevelWindowOS2::Show
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
@@ -812,9 +807,17 @@ bool wxTopLevelWindowOS2::IsMaximized() const
return (m_vSwp.fl & SWP_MAXIMIZE) == SWP_MAXIMIZE; return (m_vSwp.fl & SWP_MAXIMIZE) == SWP_MAXIMIZE;
} // end of wxTopLevelWindowOS2::IsMaximized } // end of wxTopLevelWindowOS2::IsMaximized
void wxTopLevelWindowOS2::Iconize( void wxTopLevelWindowOS2::SetTitle( const wxString& title)
bool bIconize {
) SetLabel(title);
}
wxString wxTopLevelWindowOS2::GetTitle() const
{
return GetLabel();
}
void wxTopLevelWindowOS2::Iconize( bool bIconize )
{ {
DoShowWindow(bIconize ? SWP_MINIMIZE : SWP_RESTORE); DoShowWindow(bIconize ? SWP_MINIMIZE : SWP_RESTORE);
} // end of wxTopLevelWindowOS2::Iconize } // end of wxTopLevelWindowOS2::Iconize
@@ -824,9 +827,9 @@ bool wxTopLevelWindowOS2::IsIconized() const
// also update the current state // also update the current state
::WinQueryWindowPos(m_hFrame, (PSWP)&m_vSwp); ::WinQueryWindowPos(m_hFrame, (PSWP)&m_vSwp);
if (m_vSwp.fl & SWP_MINIMIZE) if (m_vSwp.fl & SWP_MINIMIZE)
((wxTopLevelWindow*)this)->m_bIconized = TRUE; ((wxTopLevelWindow*)this)->m_bIconized = true;
else else
((wxTopLevelWindow*)this)->m_bIconized = FALSE; ((wxTopLevelWindow*)this)->m_bIconized = false;
return m_bIconized; return m_bIconized;
} // end of wxTopLevelWindowOS2::IsIconized } // end of wxTopLevelWindowOS2::IsIconized
@@ -992,9 +995,7 @@ void wxTopLevelWindowOS2::SetIcons(
} }
} // end of wxTopLevelWindowOS2::SetIcon } // end of wxTopLevelWindowOS2::SetIcon
bool wxTopLevelWindowOS2::EnableCloseButton( bool wxTopLevelWindowOS2::EnableCloseButton( bool bEnable )
bool bEnable
)
{ {
// //
// Get system (a.k.a. window) menu // Get system (a.k.a. window) menu
@@ -1004,7 +1005,7 @@ bool wxTopLevelWindowOS2::EnableCloseButton(
if (!hMenu) if (!hMenu)
{ {
wxLogLastError(_T("GetSystemMenu")); wxLogLastError(_T("GetSystemMenu"));
return FALSE; return false;
} }
// //
@@ -1032,7 +1033,7 @@ bool wxTopLevelWindowOS2::EnableCloseButton(
,(MPARAM)FCF_MENU ,(MPARAM)FCF_MENU
,(MPARAM)0 ,(MPARAM)0
); );
return TRUE; return true;
} // end of wxTopLevelWindowOS2::EnableCloseButton } // end of wxTopLevelWindowOS2::EnableCloseButton
// ============================================================================ // ============================================================================
@@ -1046,7 +1047,7 @@ bool wxTLWHiddenParentModule::OnInit()
{ {
m_shWnd = NULL; m_shWnd = NULL;
m_szClassName = NULL; m_szClassName = NULL;
return TRUE; return true;
} // end of wxTLWHiddenParentModule::OnInit } // end of wxTLWHiddenParentModule::OnInit
void wxTLWHiddenParentModule::OnExit() void wxTLWHiddenParentModule::OnExit()
@@ -1086,20 +1087,19 @@ HWND wxTLWHiddenParentModule::GetHWND()
m_szClassName = zHIDDEN_PARENT_CLASS; m_szClassName = zHIDDEN_PARENT_CLASS;
} }
} }
m_shWnd = ::WinCreateWindow( HWND_DESKTOP m_shWnd = ::WinCreateWindow( HWND_DESKTOP,
,(PSZ)m_szClassName (PSZ)m_szClassName,
,"" "",
,0L 0L,
,(LONG)0L (LONG)0L,
,(LONG)0L (LONG)0L,
,(LONG)0L (LONG)0L,
,(LONG)0L (LONG)0L,
,NULLHANDLE NULLHANDLE,
,HWND_TOP HWND_TOP,
,0L 0L,
,NULL NULL,
,NULL NULL );
);
if (!m_shWnd) if (!m_shWnd)
{ {
wxLogLastError(_T("CreateWindow(hidden TLW parent)")); wxLogLastError(_T("CreateWindow(hidden TLW parent)"));

View File

@@ -574,15 +574,15 @@ void wxWindowOS2::Lower()
::WinSetWindowPos(GetHwnd(), HWND_BOTTOM, 0, 0, 0, 0, SWP_ZORDER | SWP_DEACTIVATE); ::WinSetWindowPos(GetHwnd(), HWND_BOTTOM, 0, 0, 0, 0, SWP_ZORDER | SWP_DEACTIVATE);
} // end of wxWindowOS2::Lower } // end of wxWindowOS2::Lower
void wxWindowOS2::SetTitle( const wxString& rTitle ) void wxWindowOS2::SetLabel( const wxString& label )
{ {
::WinSetWindowText(GetHwnd(), (PSZ)rTitle.c_str()); ::WinSetWindowText(GetHwnd(), (PSZ)label.c_str());
} // end of wxWindowOS2::SetTitle } // end of wxWindowOS2::SetLabel
wxString wxWindowOS2::GetTitle() const wxString wxWindowOS2::GetLabel() const
{ {
return wxGetWindowText(GetHWND()); return wxGetWindowText(GetHWND());
} // end of wxWindowOS2::GetTitle } // end of wxWindowOS2::GetLabel
void wxWindowOS2::DoCaptureMouse() void wxWindowOS2::DoCaptureMouse()
{ {
@@ -593,7 +593,7 @@ void wxWindowOS2::DoCaptureMouse()
::WinSetCapture(HWND_DESKTOP, hWnd); ::WinSetCapture(HWND_DESKTOP, hWnd);
m_bWinCaptured = true; m_bWinCaptured = true;
} }
} // end of wxWindowOS2::GetTitle } // end of wxWindowOS2::DoCaptureMouse
void wxWindowOS2::DoReleaseMouse() void wxWindowOS2::DoReleaseMouse()
{ {