Translucency --> Transparent
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@40169 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
parent
e5fb6f92f1
commit
07880314d4
@ -161,7 +161,7 @@ All (GUI):
|
|||||||
- Fixed problem with zoom setting in print preview.
|
- Fixed problem with zoom setting in print preview.
|
||||||
- Moved wxRichTextCtrl from the advanced library to its own.
|
- Moved wxRichTextCtrl from the advanced library to its own.
|
||||||
- wxNB_HITTEST_* flags renamed to wxBK_HITTEST_* to serve all book controls.
|
- 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.
|
implementations (so far) for wxMSW and wxMac.
|
||||||
|
|
||||||
wxMSW:
|
wxMSW:
|
||||||
|
@ -29,15 +29,15 @@ applicable for the two classes above.
|
|||||||
|
|
||||||
\latexignore{\rtfignore{\wxheading{Members}}}
|
\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.
|
Returns \true if the platform supports making the window translucent.
|
||||||
|
|
||||||
\wxheading{See also}
|
\wxheading{See also}
|
||||||
|
|
||||||
\helpref{wxTopLevelWindow::SetTranslucency}{wxtoplevelwindowsettranslucency}
|
\helpref{wxTopLevelWindow::SetTransparent}{wxtoplevelwindowsettransparent}
|
||||||
|
|
||||||
|
|
||||||
\membersection{wxTopLevelWindow::GetIcon}\label{wxtoplevelwindowgeticon}
|
\membersection{wxTopLevelWindow::GetIcon}\label{wxtoplevelwindowgeticon}
|
||||||
@ -281,19 +281,20 @@ Sets the window title.
|
|||||||
\helpref{wxTopLevelWindow::GetTitle}{wxtoplevelwindowgettitle}
|
\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
|
If the platform supports it will set the window to be translucent
|
||||||
|
|
||||||
\wxheading{Parameters}
|
\wxheading{Parameters}
|
||||||
|
|
||||||
\docparam{alpha}{Determines how opaque or transparent the window will
|
\docparam{alpha}{Determines how opaque or transparent the window will
|
||||||
be. A value of 0 sets the window to be fully transparent, and a
|
be, if the platform supports the opreration. A value of 0 sets the
|
||||||
value of 255 sets the window to be fully opaque.}
|
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.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -69,8 +69,8 @@ public:
|
|||||||
virtual bool ShowFullScreen(bool show, long style = wxFULLSCREEN_ALL) ;
|
virtual bool ShowFullScreen(bool show, long style = wxFULLSCREEN_ALL) ;
|
||||||
virtual bool IsFullScreen() const ;
|
virtual bool IsFullScreen() const ;
|
||||||
|
|
||||||
virtual bool SetTranslucency(int alpha);
|
virtual bool SetTransparent(wxByte alpha);
|
||||||
virtual bool CanSetTranslucency();
|
virtual bool CanSetTransparent();
|
||||||
|
|
||||||
|
|
||||||
// implementation from now on
|
// implementation from now on
|
||||||
|
@ -71,8 +71,8 @@ public:
|
|||||||
bool EnableCloseButton(bool enable = true);
|
bool EnableCloseButton(bool enable = true);
|
||||||
|
|
||||||
// Set window transparency if the platform supports it
|
// Set window transparency if the platform supports it
|
||||||
virtual bool SetTranslucency(int alpha);
|
virtual bool SetTransparent(wxByte alpha);
|
||||||
virtual bool CanSetTranslucency();
|
virtual bool CanSetTransparent();
|
||||||
|
|
||||||
|
|
||||||
// implementation from now on
|
// implementation from now on
|
||||||
|
@ -197,8 +197,8 @@ public:
|
|||||||
void CenterOnScreen(int dir = wxBOTH) { CentreOnScreen(dir); }
|
void CenterOnScreen(int dir = wxBOTH) { CentreOnScreen(dir); }
|
||||||
|
|
||||||
// Set window transparency if the platform supports it
|
// Set window transparency if the platform supports it
|
||||||
virtual bool SetTranslucency(int WXUNUSED(alpha)) { return false; }
|
virtual bool SetTransparent(wxByte WXUNUSED(alpha)) { return false; }
|
||||||
virtual bool CanSetTranslucency() { return false; }
|
virtual bool CanSetTransparent() { return false; }
|
||||||
|
|
||||||
|
|
||||||
// implementation only from now on
|
// implementation only from now on
|
||||||
|
@ -495,7 +495,7 @@ void wxFrameManager::SetManagedWindow(wxWindow* frame)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Make a window to use for a translucent hint
|
// Make a window to use for a transparent hint
|
||||||
#if defined(__WXMSW__)
|
#if defined(__WXMSW__)
|
||||||
m_hint_wnd = new wxFrame(m_frame, -1, wxEmptyString, wxDefaultPosition, wxSize(1,1),
|
m_hint_wnd = new wxFrame(m_frame, -1, wxEmptyString, wxDefaultPosition, wxSize(1,1),
|
||||||
wxFRAME_TOOL_WINDOW |
|
wxFRAME_TOOL_WINDOW |
|
||||||
@ -523,7 +523,7 @@ void wxFrameManager::SetManagedWindow(wxWindow* frame)
|
|||||||
p->SetBackgroundColour(*wxBLUE);
|
p->SetBackgroundColour(*wxBLUE);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (m_hint_wnd && !m_hint_wnd->CanSetTranslucency())
|
if (m_hint_wnd && !m_hint_wnd->CanSetTransparent())
|
||||||
{
|
{
|
||||||
m_hint_wnd->Close();
|
m_hint_wnd->Close();
|
||||||
m_hint_wnd = NULL;
|
m_hint_wnd = NULL;
|
||||||
@ -1840,7 +1840,7 @@ void wxFrameManager::Update()
|
|||||||
// window should have this style by default
|
// window should have this style by default
|
||||||
if (m_action == actionDragFloatingPane &&
|
if (m_action == actionDragFloatingPane &&
|
||||||
(m_flags & wxAUI_MGR_TRANSPARENT_DRAG))
|
(m_flags & wxAUI_MGR_TRANSPARENT_DRAG))
|
||||||
frame->SetTranslucency(150);
|
frame->SetTransparent(150);
|
||||||
|
|
||||||
frame->SetPaneWindow(p);
|
frame->SetPaneWindow(p);
|
||||||
p.frame = frame;
|
p.frame = frame;
|
||||||
@ -2468,7 +2468,7 @@ void wxFrameManager::OnHintFadeTimer(wxTimerEvent& WXUNUSED(event))
|
|||||||
}
|
}
|
||||||
|
|
||||||
m_hint_fadeamt += 5;
|
m_hint_fadeamt += 5;
|
||||||
m_hint_wnd->SetTranslucency(m_hint_fadeamt);
|
m_hint_wnd->SetTransparent(m_hint_fadeamt);
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxFrameManager::ShowHint(const wxRect& rect)
|
void wxFrameManager::ShowHint(const wxRect& rect)
|
||||||
@ -2491,7 +2491,7 @@ void wxFrameManager::ShowHint(const wxRect& rect)
|
|||||||
if (m_action == actionDragFloatingPane && m_action_window)
|
if (m_action == actionDragFloatingPane && m_action_window)
|
||||||
m_action_window->SetFocus();
|
m_action_window->SetFocus();
|
||||||
|
|
||||||
m_hint_wnd->SetTranslucency(initial_fade);
|
m_hint_wnd->SetTransparent(initial_fade);
|
||||||
m_hint_wnd->SetSize(rect);
|
m_hint_wnd->SetSize(rect);
|
||||||
m_hint_wnd->Raise();
|
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)
|
if (m_last_hint != rect)
|
||||||
@ -2559,7 +2559,7 @@ void wxFrameManager::HideHint()
|
|||||||
// hides a transparent window hint, if there is one
|
// hides a transparent window hint, if there is one
|
||||||
if (m_hint_wnd)
|
if (m_hint_wnd)
|
||||||
{
|
{
|
||||||
m_hint_wnd->SetTranslucency(0);
|
m_hint_wnd->SetTransparent(0);
|
||||||
m_hint_fadetimer.Stop();
|
m_hint_fadetimer.Stop();
|
||||||
m_last_hint = wxRect();
|
m_last_hint = wxRect();
|
||||||
return;
|
return;
|
||||||
@ -2666,7 +2666,7 @@ void wxFrameManager::OnFloatingPaneMoveStart(wxWindow* wnd)
|
|||||||
wxASSERT_MSG(pane.IsOk(), wxT("Pane window not found"));
|
wxASSERT_MSG(pane.IsOk(), wxT("Pane window not found"));
|
||||||
|
|
||||||
if (m_flags & wxAUI_MGR_TRANSPARENT_DRAG)
|
if (m_flags & wxAUI_MGR_TRANSPARENT_DRAG)
|
||||||
pane.frame->SetTranslucency(150);
|
pane.frame->SetTransparent(150);
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxFrameManager::OnFloatingPaneMoving(wxWindow* wnd)
|
void wxFrameManager::OnFloatingPaneMoving(wxWindow* wnd)
|
||||||
@ -2765,7 +2765,7 @@ void wxFrameManager::OnFloatingPaneMoved(wxWindow* wnd)
|
|||||||
pane.floating_pos = pane.frame->GetPosition();
|
pane.floating_pos = pane.frame->GetPosition();
|
||||||
|
|
||||||
if (m_flags & wxAUI_MGR_TRANSPARENT_DRAG)
|
if (m_flags & wxAUI_MGR_TRANSPARENT_DRAG)
|
||||||
pane.frame->SetTranslucency(255);
|
pane.frame->SetTransparent(255);
|
||||||
}
|
}
|
||||||
|
|
||||||
Update();
|
Update();
|
||||||
|
@ -1432,7 +1432,7 @@ bool wxTopLevelWindowMac::IsFullScreen() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool wxTopLevelWindowMac::SetTranslucency(int alpha)
|
bool wxTopLevelWindowMac::SetTransparent(wxByte alpha)
|
||||||
{
|
{
|
||||||
WindowRef handle = GetControlOwner((OpaqueControlRef*)GetHandle());
|
WindowRef handle = GetControlOwner((OpaqueControlRef*)GetHandle());
|
||||||
OSStatus result = SetWindowAlpha(handle, float(alpha)/255.0);
|
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;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -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);
|
typedef DWORD (WINAPI *PSETLAYEREDWINDOWATTR)(HWND, DWORD, BYTE, DWORD);
|
||||||
static PSETLAYEREDWINDOWATTR pSetLayeredWindowAttributes = NULL;
|
static PSETLAYEREDWINDOWATTR pSetLayeredWindowAttributes = NULL;
|
||||||
|
|
||||||
if (alpha < 0) alpha = 0;
|
|
||||||
if (alpha > 255) alpha = 255;
|
|
||||||
|
|
||||||
if ( pSetLayeredWindowAttributes == NULL )
|
if ( pSetLayeredWindowAttributes == NULL )
|
||||||
{
|
{
|
||||||
wxDynamicLibrary dllUser32(_T("user32.dll"));
|
wxDynamicLibrary dllUser32(_T("user32.dll"));
|
||||||
@ -1079,7 +1076,7 @@ bool wxTopLevelWindowMSW::SetTranslucency(int alpha)
|
|||||||
return pSetLayeredWindowAttributes(GetHwnd(), 0, (BYTE)alpha, LWA_ALPHA) != 0;
|
return pSetLayeredWindowAttributes(GetHwnd(), 0, (BYTE)alpha, LWA_ALPHA) != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxTopLevelWindowMSW::CanSetTranslucency()
|
bool wxTopLevelWindowMSW::CanSetTransparent()
|
||||||
{
|
{
|
||||||
// The API is available on win2k and above
|
// The API is available on win2k and above
|
||||||
|
|
||||||
|
@ -171,8 +171,8 @@ public:
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
virtual bool SetTranslucency(int alpha);
|
virtual bool SetTransparent(byte alpha);
|
||||||
virtual bool CanSetTranslucency();
|
virtual bool CanSetTransparent();
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user