]> de.git.xonotic.org Git - xonotic/netradiant.git/blobdiff - libs/gtkutil/idledraw.h
reformat code! now the code is only ugly on the *inside*
[xonotic/netradiant.git] / libs / gtkutil / idledraw.h
index 97791023c2ba181cdc4269cbf4dae444f1e3b9f5..6c29836605c5040e5cf530934943350c6d7e43cd 100644 (file)
 
 #include "generic/callback.h"
 
-class IdleDraw
-{
-Callback<void()> m_draw;
-unsigned int m_handler;
-static gboolean draw( gpointer data ){
-       reinterpret_cast<IdleDraw*>( data )->m_draw();
-       reinterpret_cast<IdleDraw*>( data )->m_handler = 0;
-       return FALSE;
-}
+class IdleDraw {
+    Callback<void()> m_draw;
+    unsigned int m_handler;
+
+    static gboolean draw(gpointer data)
+    {
+        reinterpret_cast<IdleDraw *>( data )->m_draw();
+        reinterpret_cast<IdleDraw *>( data )->m_handler = 0;
+        return FALSE;
+    }
+
 public:
-IdleDraw( const Callback<void()>& draw ) : m_draw( draw ), m_handler( 0 ){
-}
-~IdleDraw(){
-       if ( m_handler != 0 ) {
-               g_source_remove( m_handler );
-       }
-}
-void queueDraw(){
-       if ( m_handler == 0 ) {
-               m_handler = g_idle_add( &draw, this );
-       }
-}
-typedef MemberCaller<IdleDraw, void(), &IdleDraw::queueDraw> QueueDrawCaller;
-
-void flush(){
-       if ( m_handler != 0 ) {
-               draw( this );
-       }
-}
+    IdleDraw(const Callback<void()> &draw) : m_draw(draw), m_handler(0)
+    {
+    }
+
+    ~IdleDraw()
+    {
+        if (m_handler != 0) {
+            g_source_remove(m_handler);
+        }
+    }
+
+    void queueDraw()
+    {
+        if (m_handler == 0) {
+            m_handler = g_idle_add(&draw, this);
+        }
+    }
+
+    typedef MemberCaller<IdleDraw, void(), &IdleDraw::queueDraw> QueueDrawCaller;
+
+    void flush()
+    {
+        if (m_handler != 0) {
+            draw(this);
+        }
+    }
 };