Get/SetTitle only for wxTopLevelWindow (wxMSW part).

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@36075 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Włodzimierz Skiba
2005-11-03 16:47:29 +00:00
parent 60fef9643d
commit faa49bfd39
9 changed files with 69 additions and 49 deletions

View File

@@ -656,14 +656,18 @@ void wxView::OnUpdate(wxView *WXUNUSED(sender), wxObject *WXUNUSED(hint))
void wxView::OnChangeFilename()
{
if (GetFrame() && GetDocument())
{
wxString title;
// GetFrame can return wxWindow rather than wxTopLevelWindow due to
// generic MDI implementation so use SetLabel rather than SetTitle.
// It should cause SetTitle() for top level windows.
wxWindow *win = GetFrame();
if (!win) return;
GetDocument()->GetPrintableName(title);
wxDocument *doc = GetDocument();
if (!doc) return;
GetFrame()->SetTitle(title);
}
wxString name;
doc->GetPrintableName(name);
win->SetLabel(name);
}
void wxView::SetDocument(wxDocument *doc)
@@ -2441,4 +2445,3 @@ bool wxTransferStreamToFile(wxInputStream& stream, const wxString& filename)
#endif // wxUSE_STD_IOSTREAM/!wxUSE_STD_IOSTREAM
#endif // wxUSE_DOC_VIEW_ARCHITECTURE

View File

@@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////////
// Name: msw/radiobox.cpp
// Name: src/msw/radiobox.cpp
// Purpose: wxRadioBox implementation
// Author: Julian Smart
// Modified by:
@@ -484,7 +484,7 @@ wxSize wxRadioBox::GetTotalButtonSize(const wxSize& sizeBtn) const
// and also wide enough for its label
int widthLabel;
GetTextExtent(GetTitle(), &widthLabel, NULL);
GetTextExtent(GetLabel(), &widthLabel, NULL);
widthLabel += RADIO_SIZE; // FIXME this is bogus too
if ( widthLabel > width )
width = widthLabel;
@@ -862,4 +862,3 @@ LRESULT APIENTRY _EXPORT wxRadioBtnWndProc(HWND hwnd,
}
#endif // wxUSE_RADIOBOX

View File

@@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////////
// Name: msw/toplevel.cpp
// Name: src/msw/toplevel.cpp
// Purpose: implements wxTopLevelWindow for MSW
// Author: Vadim Zeitlin
// Modified by:
@@ -205,7 +205,7 @@ WXDWORD wxTopLevelWindowMSW::MSWGetStyle(long style, WXDWORD *exflags) const
if ( style & wxMAXIMIZE_BOX )
msflags |= WS_MAXIMIZEBOX;
#ifndef __WXWINCE__
#ifndef __WXWINCE__
if ( style & wxSYSTEM_MENU )
msflags |= WS_SYSMENU;
#endif
@@ -414,11 +414,11 @@ bool wxTopLevelWindowMSW::CreateDialog(const void *dlgTemplate,
}
SubclassWin(m_hWnd);
#ifdef __SMARTPHONE__
// Work around title non-display glitch
Show(false);
#endif
#endif
return true;
#endif // __WXMICROWIN__/!__WXMICROWIN__
@@ -813,6 +813,16 @@ bool wxTopLevelWindowMSW::ShowFullScreen(bool show, long style)
// wxTopLevelWindowMSW misc
// ----------------------------------------------------------------------------
void wxTopLevelWindowMSW::SetTitle( const wxString& title)
{
SetLabel(title);
}
wxString wxTopLevelWindowMSW::GetTitle() const
{
return GetLabel();
}
void wxTopLevelWindowMSW::SetIcon(const wxIcon& icon)
{
SetIcons( wxIconBundle( icon ) );
@@ -1140,5 +1150,3 @@ HWND wxTLWHiddenParentModule::GetHWND()
return ms_hwnd;
}

View File

@@ -1,6 +1,6 @@
/////////////////////////////////////////////////////////////////////////////
// Name: src/msw/windows.cpp
// Purpose: wxWindow
// Name: src/msw/window.cpp
// Purpose: wxWindowMSW
// Author: Julian Smart
// Modified by: VZ on 13.05.99: no more Default(), MSWOnXXX() reorganisation
// Created: 04/01/98
@@ -739,16 +739,6 @@ void wxWindowMSW::Lower()
SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE);
}
void wxWindowMSW::SetTitle( const wxString& title)
{
SetWindowText(GetHwnd(), title.c_str());
}
wxString wxWindowMSW::GetTitle() const
{
return wxGetWindowText(GetHWND());
}
void wxWindowMSW::DoCaptureMouse()
{
HWND hWnd = GetHwnd();
@@ -3552,6 +3542,20 @@ bool wxWindowMSW::HandleKillFocus(WXHWND hwnd)
return GetEventHandler()->ProcessEvent(event);
}
// ---------------------------------------------------------------------------
// labels
// ---------------------------------------------------------------------------
void wxWindowMSW::SetLabel( const wxString& label)
{
SetWindowText(GetHwnd(), label.c_str());
}
wxString wxWindowMSW::GetLabel() const
{
return wxGetWindowText(GetHWND());
}
// ---------------------------------------------------------------------------
// miscellaneous
// ---------------------------------------------------------------------------