]> rtime.felk.cvut.cz Git - l4.git/blobdiff - l4/pkg/mag/server/src/mouse_cursor.h
Inital import
[l4.git] / l4 / pkg / mag / server / src / mouse_cursor.h
diff --git a/l4/pkg/mag/server/src/mouse_cursor.h b/l4/pkg/mag/server/src/mouse_cursor.h
new file mode 100644 (file)
index 0000000..5bcdb57
--- /dev/null
@@ -0,0 +1,41 @@
+/*
+ * (c) 2010 Technische Universität Dresden
+ * This file is part of TUD:OS and distributed under the terms of the
+ * GNU General Public License 2.
+ * Please see the COPYING-GPL-2 file for details.
+ */
+#pragma once
+
+#include <l4/mag-gfx/clip_guard>
+#include <l4/mag-gfx/mem_texture>
+
+#include "view_stack"
+#include "view"
+
+namespace Mag_server {
+
+using namespace Mag_gfx;
+
+template< typename PT >
+class Mouse_cursor : public View
+{
+private:
+  Mem::Texture<PT> const *_t;
+
+public:
+  Mouse_cursor(Texture const *t)
+  : View(Rect(Point(0,0), t->size()), F_transparent),
+    _t(static_cast<Mem::Texture<PT> const *>(t))
+  {}
+
+  void draw(Canvas *canvas, View_stack const *s, Mode, bool) const
+  {
+    Clip_guard g(canvas, *this);
+
+    s->draw_recursive(View::next(), 0, *this);
+    canvas->draw_texture(_t, Rgb32::Black, p1(), Canvas::Masked);
+  }
+
+};
+
+}