Re: Some questions from a newbie



Erik Greenwald wrote:
> 
>   have a "last cursor" variable. when you change it, set the last cursor variable to the old one, then switch it. to change back, call up the last cursor one :)
> 
i know, but you should initialize "last cursor" anyway.. (at least the
first time you change the default cursor.)
- My idea its different, i would make something like this:

class WaitCursor
{
        GdkCursor *oldcursor;
        GtkWidget* wid
 public:
        WaitCursor(GtkWidget* wid):wid(wid)
        {
        oldcursor =
something_to_know_the_present_window_cursor(wid->window);
        cursor = gdk_cursor_new (GDK_WATCH);
        gdk_window_set_cursor (wid->window, cursor);
        gdk_cursor_destroy (cursor);
         }
        ~WaitCursor() 
        {
        cursor = gdk_cursor_new (oldcursor);
        gdk_window_set_cursor (wid->window, cursor);
        gdk_cursor_destroy (cursor);
        }               
};

in order to make possible write:

void foo()
{
WaitCursor waitcursor;
// make time consuming operations
// ....
// leaving foo() automatic destructor restablishes the cursor.
}

hope this will be more clear.
bye.
-- 
Mario Motta
mmotta@guest.net
http://www.guest.net/homepages/mmotta/index.htm



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]