#ifndef RALEIGH_WIDGET_H #define RALEIGH_WIDGET_H namespace raleigh { class widget; } #include #include #include namespace raleigh { class widget { public: coord size; //set by window class (or parent widget) window *w; coord window_offset; //fewest steps up that a widget can be redrawn without needing its parents //if a widget is opaque, it will set this to a pointer to itself, and then call // notify_has_opaque_parent on any children, passing itself as an argument. //in notify_has_opaque_parent's handler, it should set this if it isn't already set, // and then call notify_has_opaque_parent on any children (with the opaque parent). widget *closest_opaque; //called by window class (or parent widget) virtual void notify_window_change() = 0; virtual void paint(_pixel_t *pixbuf, uint32_t pitch) = 0; virtual bool try_handle_click(coord window_coords, enum mouse_packet::mouse_button click_type, bool up) = 0; virtual void notify_has_opaque_parent(widget *parent) = 0; }; } #endif