Re: How to change cursor in Gtk::Drawable



Alexander wrote:
How to change cursor in Gtk::Drawable
when I select different tools (from ToolBar)?
I assume you mean a Gtk::DrawingArea. What would make the most sense would be to set the cursor for the entire Gtk::Window:

class MyDrawingApp: public Gtk::Window {
public:

   enum Tool {
      MOVE,
      SELECT,
      ...
      N_TOOLS
   };

   MyDrawingApp() {
      for (int i = 0; i < N_TOOLS; ++i)
         toolCursors[i] = Gdk::Cursor(...);
      ...
   }

private:

   Gdk::Cursor toolCursors[N_TOOLS];

   void setToolCursor(Tool t) {
      // Actually have to set cursor on Gdk::Window inside Gtk::Window
      get_window()->set_cursor(toolCursors[t]);
   }
   void setNormalCursor() {
      get_window()->set_cursor(); // goes back to the default
   }
};




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