From 07880314d4176c6205c83efbf0ad0ea9ad56d789 Mon Sep 17 00:00:00 2001 From: Robin Dunn Date: Mon, 17 Jul 2006 21:30:08 +0000 Subject: [PATCH] Translucency --> Transparent git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@40169 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- docs/changes.txt | 2 +- docs/latex/wx/tlw.tex | 17 +++++++++-------- include/wx/mac/carbon/toplevel.h | 4 ++-- include/wx/msw/toplevel.h | 4 ++-- include/wx/toplevel.h | 4 ++-- src/aui/framemanager.cpp | 18 +++++++++--------- src/mac/carbon/toplevel.cpp | 4 ++-- src/msw/toplevel.cpp | 7 ++----- wxPython/src/_toplvl.i | 4 ++-- 9 files changed, 31 insertions(+), 33 deletions(-) diff --git a/docs/changes.txt b/docs/changes.txt index 13f25fa595..a63f0a833d 100644 --- a/docs/changes.txt +++ b/docs/changes.txt @@ -161,7 +161,7 @@ All (GUI): - Fixed problem with zoom setting in print preview. - Moved wxRichTextCtrl from the advanced library to its own. - wxNB_HITTEST_* flags renamed to wxBK_HITTEST_* to serve all book controls. -- Added wxTopLevelWindow::SetTranslucency and CanSetTranslucency, with +- Added wxTopLevelWindow::SetTransparent and CanSetTransparent, with implementations (so far) for wxMSW and wxMac. wxMSW: diff --git a/docs/latex/wx/tlw.tex b/docs/latex/wx/tlw.tex index ee1ba586ba..2b7d1f647b 100644 --- a/docs/latex/wx/tlw.tex +++ b/docs/latex/wx/tlw.tex @@ -29,15 +29,15 @@ applicable for the two classes above. \latexignore{\rtfignore{\wxheading{Members}}} -\membersection{wxTopLevelWindow::CanSetTranslucency}\label{wxtoplevelwindowcansettranslucency} +\membersection{wxTopLevelWindow::CanSetTransparent}\label{wxtoplevelwindowcansettransparent} -\func{virtual bool}{CanSetTranslucency}{\void} +\func{virtual bool}{CanSetTransparent}{\void} Returns \true if the platform supports making the window translucent. \wxheading{See also} -\helpref{wxTopLevelWindow::SetTranslucency}{wxtoplevelwindowsettranslucency} +\helpref{wxTopLevelWindow::SetTransparent}{wxtoplevelwindowsettransparent} \membersection{wxTopLevelWindow::GetIcon}\label{wxtoplevelwindowgeticon} @@ -281,19 +281,20 @@ Sets the window title. \helpref{wxTopLevelWindow::GetTitle}{wxtoplevelwindowgettitle} -\membersection{wxTopLevelWindow::SetTranslucency}\label{wxtoplevelwindowsettranslucency} +\membersection{wxTopLevelWindow::SetTransparent}\label{wxtoplevelwindowsettransparent} -\func{virtual bool}{SetTranslucency}{\param{int }{ alpha}} +\func{virtual bool}{SetTransparent}{\param{int }{ alpha}} If the platform supports it will set the window to be translucent \wxheading{Parameters} \docparam{alpha}{Determines how opaque or transparent the window will - be. A value of 0 sets the window to be fully transparent, and a - value of 255 sets the window to be fully opaque.} + be, if the platform supports the opreration. A value of 0 sets the + window to be fully transparent, and a value of 255 sets the window + to be fully opaque.} -Returns \true if the translucency was successfully changed. +Returns \true if the transparency was successfully changed. diff --git a/include/wx/mac/carbon/toplevel.h b/include/wx/mac/carbon/toplevel.h index cdffba933f..90c340076b 100644 --- a/include/wx/mac/carbon/toplevel.h +++ b/include/wx/mac/carbon/toplevel.h @@ -69,8 +69,8 @@ public: virtual bool ShowFullScreen(bool show, long style = wxFULLSCREEN_ALL) ; virtual bool IsFullScreen() const ; - virtual bool SetTranslucency(int alpha); - virtual bool CanSetTranslucency(); + virtual bool SetTransparent(wxByte alpha); + virtual bool CanSetTransparent(); // implementation from now on diff --git a/include/wx/msw/toplevel.h b/include/wx/msw/toplevel.h index f8d064c24b..64359f658d 100644 --- a/include/wx/msw/toplevel.h +++ b/include/wx/msw/toplevel.h @@ -71,8 +71,8 @@ public: bool EnableCloseButton(bool enable = true); // Set window transparency if the platform supports it - virtual bool SetTranslucency(int alpha); - virtual bool CanSetTranslucency(); + virtual bool SetTransparent(wxByte alpha); + virtual bool CanSetTransparent(); // implementation from now on diff --git a/include/wx/toplevel.h b/include/wx/toplevel.h index 50409bb5ce..8881631c5c 100644 --- a/include/wx/toplevel.h +++ b/include/wx/toplevel.h @@ -197,8 +197,8 @@ public: void CenterOnScreen(int dir = wxBOTH) { CentreOnScreen(dir); } // Set window transparency if the platform supports it - virtual bool SetTranslucency(int WXUNUSED(alpha)) { return false; } - virtual bool CanSetTranslucency() { return false; } + virtual bool SetTransparent(wxByte WXUNUSED(alpha)) { return false; } + virtual bool CanSetTransparent() { return false; } // implementation only from now on diff --git a/src/aui/framemanager.cpp b/src/aui/framemanager.cpp index 0fdb1d9fd4..945d2d8c35 100644 --- a/src/aui/framemanager.cpp +++ b/src/aui/framemanager.cpp @@ -495,7 +495,7 @@ void wxFrameManager::SetManagedWindow(wxWindow* frame) } #endif - // Make a window to use for a translucent hint + // Make a window to use for a transparent hint #if defined(__WXMSW__) m_hint_wnd = new wxFrame(m_frame, -1, wxEmptyString, wxDefaultPosition, wxSize(1,1), wxFRAME_TOOL_WINDOW | @@ -523,7 +523,7 @@ void wxFrameManager::SetManagedWindow(wxWindow* frame) p->SetBackgroundColour(*wxBLUE); #endif - if (m_hint_wnd && !m_hint_wnd->CanSetTranslucency()) + if (m_hint_wnd && !m_hint_wnd->CanSetTransparent()) { m_hint_wnd->Close(); m_hint_wnd = NULL; @@ -1840,7 +1840,7 @@ void wxFrameManager::Update() // window should have this style by default if (m_action == actionDragFloatingPane && (m_flags & wxAUI_MGR_TRANSPARENT_DRAG)) - frame->SetTranslucency(150); + frame->SetTransparent(150); frame->SetPaneWindow(p); p.frame = frame; @@ -2468,7 +2468,7 @@ void wxFrameManager::OnHintFadeTimer(wxTimerEvent& WXUNUSED(event)) } m_hint_fadeamt += 5; - m_hint_wnd->SetTranslucency(m_hint_fadeamt); + m_hint_wnd->SetTransparent(m_hint_fadeamt); } void wxFrameManager::ShowHint(const wxRect& rect) @@ -2491,7 +2491,7 @@ void wxFrameManager::ShowHint(const wxRect& rect) if (m_action == actionDragFloatingPane && m_action_window) m_action_window->SetFocus(); - m_hint_wnd->SetTranslucency(initial_fade); + m_hint_wnd->SetTransparent(initial_fade); m_hint_wnd->SetSize(rect); m_hint_wnd->Raise(); @@ -2505,7 +2505,7 @@ void wxFrameManager::ShowHint(const wxRect& rect) } } - else // Not using a translucent hint window... + else // Not using a transparent hint window... { if (m_last_hint != rect) @@ -2559,7 +2559,7 @@ void wxFrameManager::HideHint() // hides a transparent window hint, if there is one if (m_hint_wnd) { - m_hint_wnd->SetTranslucency(0); + m_hint_wnd->SetTransparent(0); m_hint_fadetimer.Stop(); m_last_hint = wxRect(); return; @@ -2666,7 +2666,7 @@ void wxFrameManager::OnFloatingPaneMoveStart(wxWindow* wnd) wxASSERT_MSG(pane.IsOk(), wxT("Pane window not found")); if (m_flags & wxAUI_MGR_TRANSPARENT_DRAG) - pane.frame->SetTranslucency(150); + pane.frame->SetTransparent(150); } void wxFrameManager::OnFloatingPaneMoving(wxWindow* wnd) @@ -2765,7 +2765,7 @@ void wxFrameManager::OnFloatingPaneMoved(wxWindow* wnd) pane.floating_pos = pane.frame->GetPosition(); if (m_flags & wxAUI_MGR_TRANSPARENT_DRAG) - pane.frame->SetTranslucency(255); + pane.frame->SetTransparent(255); } Update(); diff --git a/src/mac/carbon/toplevel.cpp b/src/mac/carbon/toplevel.cpp index 5d77fdc673..2e4cd6eb3e 100644 --- a/src/mac/carbon/toplevel.cpp +++ b/src/mac/carbon/toplevel.cpp @@ -1432,7 +1432,7 @@ bool wxTopLevelWindowMac::IsFullScreen() const } -bool wxTopLevelWindowMac::SetTranslucency(int alpha) +bool wxTopLevelWindowMac::SetTransparent(wxByte alpha) { WindowRef handle = GetControlOwner((OpaqueControlRef*)GetHandle()); OSStatus result = SetWindowAlpha(handle, float(alpha)/255.0); @@ -1440,7 +1440,7 @@ bool wxTopLevelWindowMac::SetTranslucency(int alpha) } -bool wxTopLevelWindowMac::CanSetTranslucency() +bool wxTopLevelWindowMac::CanSetTransparent() { return true; } diff --git a/src/msw/toplevel.cpp b/src/msw/toplevel.cpp index e0a489a759..bdd1e301c4 100644 --- a/src/msw/toplevel.cpp +++ b/src/msw/toplevel.cpp @@ -1045,14 +1045,11 @@ void wxTopLevelWindowMSW::RequestUserAttention(int flags) // --------------------------------------------------------------------------- -bool wxTopLevelWindowMSW::SetTranslucency(int alpha) +bool wxTopLevelWindowMSW::SetTransparent(wxByte alpha) { typedef DWORD (WINAPI *PSETLAYEREDWINDOWATTR)(HWND, DWORD, BYTE, DWORD); static PSETLAYEREDWINDOWATTR pSetLayeredWindowAttributes = NULL; - if (alpha < 0) alpha = 0; - if (alpha > 255) alpha = 255; - if ( pSetLayeredWindowAttributes == NULL ) { wxDynamicLibrary dllUser32(_T("user32.dll")); @@ -1079,7 +1076,7 @@ bool wxTopLevelWindowMSW::SetTranslucency(int alpha) return pSetLayeredWindowAttributes(GetHwnd(), 0, (BYTE)alpha, LWA_ALPHA) != 0; } -bool wxTopLevelWindowMSW::CanSetTranslucency() +bool wxTopLevelWindowMSW::CanSetTransparent() { // The API is available on win2k and above diff --git a/wxPython/src/_toplvl.i b/wxPython/src/_toplvl.i index c9aa280142..a99ce0c362 100644 --- a/wxPython/src/_toplvl.i +++ b/wxPython/src/_toplvl.i @@ -171,8 +171,8 @@ public: } #endif - virtual bool SetTranslucency(int alpha); - virtual bool CanSetTranslucency(); + virtual bool SetTransparent(byte alpha); + virtual bool CanSetTransparent(); }; -- 2.45.2