pit Posted October 27, 2010 Share Posted October 27, 2010 Is there realy necessity in two different classes for horizontal and vertical sliders? For example, there is single orientation parameter Qt slider class. This Unigine code design solution causes following problem in client code: it is really difficult to write generic code when slider orientation doesn't matter. One need to write absolutely identical code for WidgetHSlider and WidgetVSlider. Link to comment
michael.zhang Posted October 27, 2010 Share Posted October 27, 2010 Hello, I agree! But in the meantime, I noticed that the only difference is their getButton__ and setButton__ functions. You could write your own function something like: namespace WidgetSlider{ int getButtonSize(Widget a slider){ if(is_base_class("Unigine::WidgetHSlider", slider)){ return slider.getButtonWidth(); } if(is_base_class("unigine::WidgetVSlider", slider)){ return slider.getButtonHeight(); } } } And something analgous for the set method. Link to comment
Guest extaliones Posted October 28, 2010 Share Posted October 28, 2010 Unfortunately we do not plan to create one slider type instead two (WidgetHSlider and WidgetVSlider). Link to comment
Recommended Posts