[PATCH] dw::fltk::ui::FltkOptionMenuResource::isSelected()
This patch provides a correct implementation of dw::fltk::ui::FltkOptionMenuResource::isSelected(), replacing the current stub. It is necessary for dillo2 to support SELECT controls in forms. Notes: * We implement Johannes' suggestion of modifying createNewMenu, using a single callback for each menu and calling item() to get the selected item. This gives a very clean implementation that doesn't add any new data members or virtual methods to the base classes. * We use FLTK widgets' user_data() to attach dw objects to FLTK widgets so that the FLTK callback can retrieve those dw objects from its arguments. This works very nicely and saves code since we don't have to add new data members to existing classes. * To avoid making identical changes everywhere an Item is created we refactored and created a new Item::createNewWidget() method. * For consistency of style we also refactored and created Item::createNewGroupWidget() and FltkSelectionResource::createNewItem(). (Despite their simplicity these refactorings actually account for most of the patch.) I should finish polishing the dillo2 SELECT patch soon. Then I'll be able to set comment thresholds on Slashdot! (These days that's the thing that most often forces me to quit dillo2 and start another browser, so this is a big itch to scratch.) Regards, Jeremy Henty
On Thu, Dec 27, 2007 at 05:28:52PM +0000, Jeremy Henty wrote:
This patch provides a correct implementation of dw::fltk::ui::FltkOptionMenuResource::isSelected(), replacing the current stub. It is necessary for dillo2 to support SELECT controls in forms.
Notes:
* We implement Johannes' suggestion of modifying createNewMenu, using a single callback for each menu and calling item() to get the selected item. This gives a very clean implementation that doesn't add any new data members or virtual methods to the base classes.
Good.
* We use FLTK widgets' user_data() to attach dw objects to FLTK widgets so that the FLTK callback can retrieve those dw objects from its arguments. This works very nicely and saves code since we don't have to add new data members to existing classes.
Good2. ;)
* To avoid making identical changes everywhere an Item is created we refactored and created a new Item::createNewWidget() method.
* For consistency of style we also refactored and created Item::createNewGroupWidget() and FltkSelectionResource::createNewItem(). (Despite their simplicity these refactorings actually account for most of the patch.)
Committed!
I should finish polishing the dillo2 SELECT patch soon. Then I'll be able to set comment thresholds on Slashdot! (These days that's the thing that most often forces me to quit dillo2 and start another browser, so this is a big itch to scratch.)
I look forward to have SELECT working. -- Cheers Jorge.-
participants (2)
-
jcid@dillo.org
-
onepoint@starurchin.org