Re: need some design advice



>Here's my situation.  I have a Gtk::Table holding a number of 
>Gtk::EventBox's defined at runtime.  I want to catch a 
>click/button_press event on each of the eventboxes.  Inside this handler 
>I also want to be able to check the status of the surrounding 
>eventboxes.  But I can't send a call back to the table b/c that makes a 
>circular dependency between the 2 classes.
>
>The only half-sane solution I could come up with is to give each 
>eventbox class 4 member variables which are pointers to the 4 eventboxes 
>around it.  But I'm thinking there's a better way to do this.  Help me 
>out here.

gint
SomeObject::button_release_handler (GdkButtonEvent* ev, 
				    EventBox& target, 
				    EventBox& north, 
				    EventBox& south, 
				    EventBox& east, 
				    EventBox& west)
{
	.... do stuff ...
	return (TRUE|FALSE);
}

....

  evbox.signal_button_release.connect (bind (mem_fun (someobjectinstance,
  				       &SomeObject::button_release_handler),
				       evbox, neighbour_up,
				       neighbour_down,
				       neighbour_right,
				       neighbour_left)


--p



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