summaryrefslogtreecommitdiff
path: root/include/vcl/event.hxx
diff options
context:
space:
mode:
authorJan Holesovsky <kendy@collabora.com>2015-06-19 17:52:26 +0200
committerJan Holesovsky <kendy@collabora.com>2015-06-19 17:59:07 +0200
commit7f19a7f1f15159321964d6a8873c66c8b68f3df9 (patch)
treecb121000ee1d8be5b4541e34ec553188d7e5522a /include/vcl/event.hxx
parentb7faad20cebe2b92e51fa2279f9c49d9fbd5a2d3 (diff)
rendercontext: Fix crash with double-buffering in the Styles combo box.
Decouple the actual window from rendercontext in UserDrawEvent. Change-Id: Ic440c4e7f59fcffb7800c578146e8eb528cbb7b4
Diffstat (limited to 'include/vcl/event.hxx')
-rw-r--r--include/vcl/event.hxx47
1 files changed, 25 insertions, 22 deletions
diff --git a/include/vcl/event.hxx b/include/vcl/event.hxx
index 973203356ac1..085182a41d0c 100644
--- a/include/vcl/event.hxx
+++ b/include/vcl/event.hxx
@@ -296,45 +296,48 @@ inline HelpEvent::HelpEvent( HelpEventMode nHelpMode )
mbKeyboardActivated = true;
}
-
-// - UserDrawEvent -
-
-
+/// Event to pass information for UserDraw() handling eg. in comboboxes.
class VCL_DLLPUBLIC UserDrawEvent
{
private:
- VclPtr<OutputDevice> mpOutDev;
+ /// Window that owns the user draw.
+ VclPtr<vcl::Window> mpWindow;
+
+ /// RenderContext to which we should draw - can be a VirtualDevice or anything.
+ VclPtr<vcl::RenderContext> mpRenderContext;
+
Rectangle maOutRect;
sal_uInt16 mnItemId;
sal_uInt16 mnStyle;
public:
- UserDrawEvent();
- UserDrawEvent( OutputDevice* pOut,
- const Rectangle& rOutRect,
- sal_uInt16 nId, sal_uInt16 nStyle = 0 );
+ UserDrawEvent();
+ UserDrawEvent(vcl::Window* pWindow, vcl::RenderContext* pRenderContext,
+ const Rectangle& rOutRect, sal_uInt16 nId, sal_uInt16 nStyle = 0);
- OutputDevice* GetDevice() const { return mpOutDev; }
+ vcl::Window* GetWindow() const { return mpWindow; }
+ vcl::RenderContext* GetRenderContext() const { return mpRenderContext; }
const Rectangle& GetRect() const { return maOutRect; }
- sal_uInt16 GetItemId() const { return mnItemId; }
- sal_uInt16 GetStyle() const { return mnStyle; }
+ sal_uInt16 GetItemId() const { return mnItemId; }
+ sal_uInt16 GetStyle() const { return mnStyle; }
};
inline UserDrawEvent::UserDrawEvent()
+ : mpWindow(nullptr)
+ , mpRenderContext(nullptr)
+ , mnItemId(0)
+ , mnStyle(0)
{
- mpOutDev = NULL;
- mnItemId = 0;
- mnStyle = 0;
}
-inline UserDrawEvent::UserDrawEvent( OutputDevice* pOut,
- const Rectangle& rOutRect,
- sal_uInt16 nId, sal_uInt16 nStyle ) :
- maOutRect( rOutRect )
+inline UserDrawEvent::UserDrawEvent(vcl::Window* pWindow, vcl::RenderContext* pRenderContext,
+ const Rectangle& rOutRect, sal_uInt16 nId, sal_uInt16 nStyle)
+ : mpWindow(pWindow)
+ , mpRenderContext(pRenderContext)
+ , maOutRect( rOutRect )
+ , mnItemId(nId)
+ , mnStyle(nStyle)
{
- mpOutDev = pOut;
- mnItemId = nId;
- mnStyle = nStyle;
}