implemented wxPopupWindow for wxDFB; added wxNonOwnedWindow as base class for wxTopLevelWindow and wxPopupWindow
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@44289 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
118
include/wx/dfb/nonownedwnd.h
Normal file
118
include/wx/dfb/nonownedwnd.h
Normal file
@@ -0,0 +1,118 @@
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Name: wx/dfb/nonownedwnd.h
|
||||
// Purpose: declares wxNonTopLevelWindow class
|
||||
// Author: Vaclav Slavik
|
||||
// Modified by:
|
||||
// Created: 2006-12-24
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) 2006 TT-Solutions
|
||||
// Licence: wxWindows licence
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_DFB_NONOWNEDWND_H_
|
||||
#define _WX_DFB_NONOWNEDWND_H_
|
||||
|
||||
#include "wx/window.h"
|
||||
#include "wx/dfb/dfbptr.h"
|
||||
|
||||
wxDFB_DECLARE_INTERFACE(IDirectFBWindow);
|
||||
class wxDfbQueuedPaintRequests;
|
||||
struct wxDFBWindowEvent;
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// wxNonOwnedWindow
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
// This class represents "non-owned" window. A window is owned by another
|
||||
// window if it has a parent and is positioned within the parent. For example,
|
||||
// wxFrame is non-owned, because even though it can have a parent, it's
|
||||
// location is independent of it. This class is for internal use only, it's
|
||||
// the base class for wxTopLevelWindow and wxPopupWindow.
|
||||
class WXDLLIMPEXP_CORE wxNonOwnedWindow : public wxWindow
|
||||
{
|
||||
public:
|
||||
// construction
|
||||
wxNonOwnedWindow() { Init(); }
|
||||
wxNonOwnedWindow(wxWindow *parent,
|
||||
wxWindowID id,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
long style = 0,
|
||||
const wxString& name = wxPanelNameStr)
|
||||
{
|
||||
Init();
|
||||
|
||||
Create(parent, id, pos, size, style, name);
|
||||
}
|
||||
|
||||
bool Create(wxWindow *parent,
|
||||
wxWindowID id,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
long style = 0,
|
||||
const wxString& name = wxPanelNameStr);
|
||||
|
||||
virtual ~wxNonOwnedWindow();
|
||||
|
||||
// implement base class pure virtuals
|
||||
virtual bool Show(bool show = true);
|
||||
|
||||
virtual void Update();
|
||||
|
||||
// implementation from now on
|
||||
// --------------------------
|
||||
|
||||
void OnInternalIdle();
|
||||
|
||||
wxIDirectFBWindowPtr GetDirectFBWindow() const { return m_dfbwin; }
|
||||
|
||||
// Returns true if some invalidated area of the TLW is currently being
|
||||
// painted
|
||||
bool IsPainting() const { return m_isPainting; }
|
||||
|
||||
protected:
|
||||
// common part of all ctors
|
||||
void Init();
|
||||
|
||||
virtual wxIDirectFBSurfacePtr ObtainDfbSurface() const;
|
||||
|
||||
// overriden wxWindow methods
|
||||
virtual void DoGetPosition(int *x, int *y) const;
|
||||
virtual void DoGetSize(int *width, int *height) const;
|
||||
virtual void DoMoveWindow(int x, int y, int width, int height);
|
||||
|
||||
virtual void DoRefreshRect(const wxRect& rect);
|
||||
|
||||
// sets DirectFB keyboard focus to this toplevel window (note that DFB
|
||||
// focus is different from wx: only shown TLWs can have it and not any
|
||||
// wxWindows as in wx
|
||||
void SetDfbFocus();
|
||||
|
||||
private:
|
||||
// do queued painting in idle time
|
||||
void HandleQueuedPaintRequests();
|
||||
|
||||
// DirectFB events handling
|
||||
static void HandleDFBWindowEvent(const wxDFBWindowEvent& event_);
|
||||
|
||||
protected:
|
||||
// did we sent wxSizeEvent at least once?
|
||||
bool m_sizeSet:1;
|
||||
|
||||
// window's opacity (0: transparent, 255: opaque)
|
||||
wxByte m_opacity;
|
||||
|
||||
// interface to the underlying DirectFB window
|
||||
wxIDirectFBWindowPtr m_dfbwin;
|
||||
|
||||
private:
|
||||
// invalidated areas of the TLW that need repainting
|
||||
wxDfbQueuedPaintRequests *m_toPaint;
|
||||
// are we currently painting some area of this TLW?
|
||||
bool m_isPainting;
|
||||
|
||||
friend class wxEventLoop; // for HandleDFBWindowEvent
|
||||
friend class wxWindowDFB; // for SetDfbFocus
|
||||
};
|
||||
|
||||
#endif // _WX_DFB_NONOWNEDWND_H_
|
45
include/wx/dfb/popupwin.h
Normal file
45
include/wx/dfb/popupwin.h
Normal file
@@ -0,0 +1,45 @@
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Name: wx/dfb/popupwin.h
|
||||
// Purpose: wxPopupWindow class for wxDFB
|
||||
// Author: Vaclav Slavik
|
||||
// Created: 2006-12-24
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) 2006 TT-Solutions
|
||||
// Licence: wxWindows licence
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_DFB_POPUPWIN_H_
|
||||
#define _WX_DFB_POPUPWIN_H_
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxPopupWindow
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
class WXDLLIMPEXP_CORE wxPopupWindow : public wxPopupWindowBase
|
||||
{
|
||||
public:
|
||||
wxPopupWindow() {}
|
||||
|
||||
wxPopupWindow(wxWindow *parent, int flags = wxBORDER_NONE)
|
||||
{ Create(parent, flags); }
|
||||
|
||||
bool Create(wxWindow *parent, int flags = wxBORDER_NONE)
|
||||
{
|
||||
if ( !wxPopupWindowBase::Create(parent) )
|
||||
return false;
|
||||
|
||||
return wxNonOwnedWindow::Create
|
||||
(
|
||||
parent,
|
||||
-1,
|
||||
// DFB windows must have valid pos & size:
|
||||
wxPoint(0, 0), wxSize(1, 1),
|
||||
(flags & wxBORDER_MASK) | wxPOPUP_WINDOW
|
||||
);
|
||||
}
|
||||
|
||||
DECLARE_DYNAMIC_CLASS(wxPopupWindow)
|
||||
};
|
||||
|
||||
#endif // _WX_DFB_POPUPWIN_H_
|
||||
|
@@ -11,13 +11,6 @@
|
||||
#ifndef _WX_DFB_TOPLEVEL_H_
|
||||
#define _WX_DFB_TOPLEVEL_H_
|
||||
|
||||
#include "wx/dfb/dfbptr.h"
|
||||
|
||||
wxDFB_DECLARE_INTERFACE(IDirectFBWindow);
|
||||
|
||||
class wxDfbQueuedPaintRequests;
|
||||
struct wxDFBWindowEvent;
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// wxTopLevelWindowDFB
|
||||
//-----------------------------------------------------------------------------
|
||||
@@ -48,8 +41,6 @@ public:
|
||||
long style = wxDEFAULT_FRAME_STYLE,
|
||||
const wxString& name = wxFrameNameStr);
|
||||
|
||||
virtual ~wxTopLevelWindowDFB();
|
||||
|
||||
// implement base class pure virtuals
|
||||
virtual void Maximize(bool maximize = true);
|
||||
virtual bool IsMaximized() const;
|
||||
@@ -60,52 +51,16 @@ public:
|
||||
virtual bool ShowFullScreen(bool show, long style = wxFULLSCREEN_ALL);
|
||||
virtual bool IsFullScreen() const { return m_fsIsShowing; }
|
||||
|
||||
virtual bool Show(bool show = true);
|
||||
|
||||
virtual bool CanSetTransparent() { return true; }
|
||||
virtual bool SetTransparent(wxByte alpha);
|
||||
|
||||
virtual void SetTitle(const wxString &title) { m_title = title; }
|
||||
virtual wxString GetTitle() const { return m_title; }
|
||||
|
||||
virtual void Update();
|
||||
|
||||
// implementation from now on
|
||||
// --------------------------
|
||||
|
||||
void OnInternalIdle();
|
||||
|
||||
wxIDirectFBWindowPtr GetDirectFBWindow() const { return m_dfbwin; }
|
||||
|
||||
// Returns true if some invalidated area of the TLW is currently being
|
||||
// painted
|
||||
bool IsPainting() const { return m_isPainting; }
|
||||
|
||||
protected:
|
||||
// common part of all ctors
|
||||
void Init();
|
||||
|
||||
virtual wxIDirectFBSurfacePtr ObtainDfbSurface() const;
|
||||
|
||||
// overriden wxWindow methods
|
||||
virtual void DoGetPosition(int *x, int *y) const;
|
||||
virtual void DoGetSize(int *width, int *height) const;
|
||||
virtual void DoMoveWindow(int x, int y, int width, int height);
|
||||
|
||||
virtual void DoRefreshRect(const wxRect& rect);
|
||||
|
||||
// sets DirectFB keyboard focus to this toplevel window (note that DFB
|
||||
// focus is different from wx: only shown TLWs can have it and not any
|
||||
// wxWindows as in wx
|
||||
void SetDfbFocus();
|
||||
|
||||
private:
|
||||
// do queued painting in idle time
|
||||
void HandleQueuedPaintRequests();
|
||||
|
||||
// DirectFB events handling
|
||||
static void HandleDFBWindowEvent(const wxDFBWindowEvent& event_);
|
||||
|
||||
protected:
|
||||
wxString m_title;
|
||||
|
||||
@@ -117,24 +72,6 @@ protected:
|
||||
// is the frame currently maximized?
|
||||
bool m_isMaximized:1;
|
||||
wxRect m_savedFrame;
|
||||
|
||||
// did we sent wxSizeEvent at least once?
|
||||
bool m_sizeSet:1;
|
||||
|
||||
// window's opacity (0: transparent, 255: opaque)
|
||||
wxByte m_opacity;
|
||||
|
||||
// interface to the underlying DirectFB window
|
||||
wxIDirectFBWindowPtr m_dfbwin;
|
||||
|
||||
private:
|
||||
// invalidated areas of the TLW that need repainting
|
||||
wxDfbQueuedPaintRequests *m_toPaint;
|
||||
// are we currently painting some area of this TLW?
|
||||
bool m_isPainting;
|
||||
|
||||
friend class wxEventLoop; // for HandleDFBWindowEvent
|
||||
friend class wxWindowDFB; // for SetDfbFocus
|
||||
};
|
||||
|
||||
#endif // _WX_DFB_TOPLEVEL_H_
|
||||
|
@@ -21,7 +21,7 @@ wxDFB_DECLARE_INTERFACE(IDirectFBSurface);
|
||||
struct wxDFBWindowEvent;
|
||||
|
||||
class WXDLLIMPEXP_CORE wxFont;
|
||||
class WXDLLIMPEXP_CORE wxTopLevelWindowDFB;
|
||||
class WXDLLIMPEXP_CORE wxNonOwnedWindow;
|
||||
|
||||
class wxOverlayImpl;
|
||||
class wxDfbOverlaysList;
|
||||
@@ -108,7 +108,7 @@ public:
|
||||
wxIDirectFBSurfacePtr GetDfbSurface();
|
||||
|
||||
// returns toplevel window the window belongs to
|
||||
wxTopLevelWindowDFB *GetTLW() const { return m_tlw; }
|
||||
wxNonOwnedWindow *GetTLW() const { return m_tlw; }
|
||||
|
||||
void OnInternalIdle();
|
||||
|
||||
@@ -174,7 +174,7 @@ private:
|
||||
|
||||
protected:
|
||||
// toplevel window (i.e. DirectFB window) this window belongs to
|
||||
wxTopLevelWindowDFB *m_tlw;
|
||||
wxNonOwnedWindow *m_tlw;
|
||||
|
||||
private:
|
||||
// subsurface of TLW's surface covered by this window
|
||||
@@ -190,7 +190,7 @@ private:
|
||||
// overlays for this window (or NULL if it doesn't have any)
|
||||
wxDfbOverlaysList *m_overlays;
|
||||
|
||||
friend class wxTopLevelWindowDFB; // for HandleXXXEvent
|
||||
friend class wxNonOwnedWindow; // for HandleXXXEvent
|
||||
friend class wxOverlayImpl; // for Add/RemoveOverlay
|
||||
friend class wxWindowDC; // for PaintOverlays
|
||||
|
||||
|
Reference in New Issue
Block a user