moved wxOverlay into overlay.* files and out of dc.h/dcbase.cpp; implemented wxOverlay for wxDirectFB port

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@42340 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Václav Slavík
2006-10-24 12:29:14 +00:00
parent f8bf59a9f2
commit 30c841c84d
28 changed files with 1091 additions and 502 deletions

View File

@@ -216,6 +216,8 @@ protected:
double m_mm_to_pix_x, m_mm_to_pix_y;
friend class WXDLLIMPEXP_CORE wxOverlayImpl; // for Init
DECLARE_DYNAMIC_CLASS(wxDC)
};

View File

@@ -26,14 +26,21 @@ public:
wxWindowDC(wxWindow *win);
virtual ~wxWindowDC();
virtual wxWindow *GetWindow() const { return m_win; }
protected:
// initializes the DC for painting on given window; if rect!=NULL, then
// for painting only on the given region of the window
void InitForWin(wxWindow *win, const wxRect *rect);
private:
wxWindow *m_win;
wxRect m_winRect; // rectangle of the window being painted
bool m_shouldFlip; // flip the surface when done?
friend class wxOverlayImpl; // for m_shouldFlip;
DECLARE_DYNAMIC_CLASS(wxWindowDC)
DECLARE_NO_COPY_CLASS(wxWindowDC)
};

View File

@@ -0,0 +1,51 @@
/////////////////////////////////////////////////////////////////////////////
// Name: wx/dfb/private/overlay.h
// Purpose: wxOverlayImpl declaration
// Author: Vaclav Slavik
// Created: 2006-10-20
// RCS-ID: $Id$
// Copyright: (c) wxWidgets team
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_DFB_PRIVATE_OVERLAY_H_
#define _WX_DFB_PRIVATE_OVERLAY_H_
#include "wx/dfb/dfbptr.h"
wxDFB_DECLARE_INTERFACE(IDirectFBSurface);
class WXDLLEXPORT wxWindow;
class wxOverlayImpl
{
public:
wxOverlayImpl();
~wxOverlayImpl();
void Reset();
bool IsOk();
void Init(wxWindowDC* dc, int x , int y , int width , int height);
void BeginDrawing(wxWindowDC* dc);
void EndDrawing(wxWindowDC* dc);
void Clear(wxWindowDC* dc);
// wxDFB specific methods:
bool IsEmpty() const { return m_isEmpty; }
wxRect GetRect() const { return m_rect; }
wxIDirectFBSurfacePtr GetDirectFBSurface() const { return m_surface; }
public:
// window the overlay is associated with
wxWindow *m_window;
// rectangle covered by the overlay, in m_window's window coordinates
wxRect m_rect;
// surface of the overlay, same size as m_rect
wxIDirectFBSurfacePtr m_surface;
// this flag is set to true if nothing was drawn on the overlay (either
// initially or Clear() was called)
bool m_isEmpty;
};
#endif // _WX_DFB_PRIVATE_OVERLAY_H_

View File

@@ -23,6 +23,9 @@ struct wxDFBWindowEvent;
class WXDLLIMPEXP_CORE wxFont;
class WXDLLIMPEXP_CORE wxTopLevelWindowDFB;
class wxOverlayImpl;
class wxDfbOverlaysList;
// ---------------------------------------------------------------------------
// wxWindow
// ---------------------------------------------------------------------------
@@ -144,10 +147,21 @@ protected:
// called by parent to render (part of) the window
void PaintWindow(const wxRect& rect);
// paint window's overlays (if any) on top of window's surface
void PaintOverlays(const wxRect& rect);
// refreshes the entire window (including non-client areas)
void DoRefreshWindow();
// refreshes given rectangle of the window (in window, _not_ client coords)
virtual void DoRefreshRect(const wxRect& rect);
// refreshes given rectangle; unlike RefreshRect(), the argument is in
// window, not client, coords and unlike DoRefreshRect() and like Refresh(),
// does nothing if the window is hidden or frozen
void RefreshWindowRect(const wxRect& rect);
// add/remove overlay for this window
void AddOverlay(wxOverlayImpl *overlay);
void RemoveOverlay(wxOverlayImpl *overlay);
// DirectFB events handling
void HandleKeyEvent(const wxDFBWindowEvent& event_);
@@ -173,7 +187,12 @@ private:
// number of calls to Freeze() minus number of calls to Thaw()
unsigned m_frozenness;
// overlays for this window (or NULL if it doesn't have any)
wxDfbOverlaysList *m_overlays;
friend class wxTopLevelWindowDFB; // for HandleXXXEvent
friend class wxOverlayImpl; // for Add/RemoveOverlay
friend class wxWindowDC; // for PaintOverlays
DECLARE_DYNAMIC_CLASS(wxWindowDFB)
DECLARE_NO_COPY_CLASS(wxWindowDFB)