diff --git a/TODO b/TODO index fe4afe7..09c14d4 100644 --- a/TODO +++ b/TODO @@ -1,4 +1,4 @@ -* Continue rebasing from bf3ece4152614d0e2686ccb17c168bf58d7d9548 +* Continue rebasing from 5e37d507e8345c425131c2ade8e6823cacb74035 * Add a focus listener interface. * Make focus apply synchronously. * Graphics and input objects for DirectX. diff --git a/include/guisan.hpp b/include/guisan.hpp index a5e068f..cbe9d9c 100644 --- a/include/guisan.hpp +++ b/include/guisan.hpp @@ -61,6 +61,8 @@ #include #include #include +#include +#include #include #include #include diff --git a/include/guisan/widgets/dropdown.hpp b/include/guisan/widgets/dropdown.hpp index 0fcd0ed..f6565d5 100644 --- a/include/guisan/widgets/dropdown.hpp +++ b/include/guisan/widgets/dropdown.hpp @@ -73,20 +73,20 @@ namespace gcn { /** - * An implementation of a drop downable list from which an item can be selected. - * The drop down consists of an internal ScrollArea and an internal ListBox. - * The drop down also uses an internal FocusHandler to handle the focus of the - * internal ScollArea and the internal ListBox. The scroll area and the list box - * can be passed to the drop down if a custom scroll area and or a custom list box - * is preferable. + * An implementation of a drop downable list from which an item can be + * selected. The drop down consists of an internal ScrollArea and an + * internal ListBox. The drop down also uses an internal FocusHandler to + * handle the focus of the internal ScollArea and the internal ListBox. + * The scroll area and the list box can be passed to the drop down + * if a custom scroll area and/or a custom list box is preferable. * - * To be able display a list the drop down uses a user provided list model. - * A list model can be any class that implements the ListModel interface. + * To be able display a list the drop down uses a user provided list model. + * A list model can be any class that implements the ListModel interface. * - * If an item is selected in the drop down a select event will be sent to all selection - * listeners of the drop down. If an item is selected by using a mouse click or by using - * the enter or space key an action event will be sent to all action listeners of the - * drop down. + * If an item is selected in the drop down a select event will be sent to + * all selection listeners of the drop down. If an item is selected by + * using a mouse click or by using the enter or space key an action event + * will be sent to all action listeners of the drop down. */ class GCN_CORE_DECLSPEC DropDown : public ActionListener, @@ -159,6 +159,9 @@ namespace gcn * changes an event will be sent to all selection listeners of the * drop down. * + * If you delete your selection listener, be sure to also remove it + * using removeSelectionListener(). + * * @param selectionListener the selection listener to add. * @since 0.8.0 */ @@ -259,40 +262,58 @@ namespace gcn */ void distributeValueChangedEvent(); + /** + * True if the drop down has been pushed with the mouse, false + * otherwise. + */ bool mPushed; /** - * Holds what the height is if the drop down is folded up. Used when - * checking if the list of the drop down was clicked or if the upper part - * of the drop down was clicked on a mouse click + * Holds what the height is if the drop down is folded up. + * Used when checking if the list of the drop down was clicked + * or if the upper part of the drop down was clicked on a mouse click. */ int mFoldedUpHeight; - + /** * The scroll area used. */ ScrollArea* mScrollArea; ListBox* mListBox; + + /** + * The internal focus handler used to keep track of focus for the + * internal list box. + */ FocusHandler mInternalFocusHandler; + + /** + * True if an internal scroll area is used, false if a scroll area + * has been passed to the drop down which the drop down should not + * deleted in it's destructor. + */ bool mInternalScrollArea; + + /** + * True if an internal list box is used, false if a list box + * has been passed to the drop down which the drop down should not + * deleted in it's destructor. + */ bool mInternalListBox; - bool mIsDragged; /** - * Typedef. + * True if the drop down is dragged. */ + bool mIsDragged; + typedef std::list SelectionListenerList; - + /** * The selection listener's of the drop down. */ SelectionListenerList mSelectionListeners; - - /** - * Typedef. - */ - typedef SelectionListenerList::iterator SelectionListenerIterator; + typedef SelectionListenerList::iterator SelectionListenerIterator; }; } diff --git a/include/guisan/widgets/listbox.hpp b/include/guisan/widgets/listbox.hpp index 8d93d85..f6f9061 100644 --- a/include/guisan/widgets/listbox.hpp +++ b/include/guisan/widgets/listbox.hpp @@ -72,13 +72,13 @@ namespace gcn /** * An implementation of a list box where an item can be selected. * - * To be able display a list the list box uses a user provided list model. + * To be able to display a list the list box uses a user provided list model. * A list model can be any class that implements the ListModel interface. - * - * If an item is selected in the list box a select event will be sent to all selection - * listeners of the list box. If an item is selected by using a mouse click or by using - * the enter or space key an action event will be sent to all action listeners of the - * list box. + * + * If an item is selected in the list box a select event will be sent to + * all selection listeners of the list box. If an item is selected by using + * a mouse click or by using the enter or space key an action event will be + * sent to all action listeners of the list box. */ class GCN_CORE_DECLSPEC ListBox : public Widget, @@ -142,26 +142,28 @@ namespace gcn void adjustSize(); /** - * Checks whether the list box wraps when selecting items with a keyboard. + * Checks whether the list box wraps when selecting items + * with a keyboard. * - * Wrapping means that the selection of items will be wrapped. That is, if - * the first item is selected and up is pressed, the last item will get - * selected. If the last item is selected and down is pressed, the first item - * will get selected. + * Wrapping means that the selection of items will be wrapped. + * That is, if the first item is selected and up is pressed, + * the last item will get selected. If the last item is selected + * and down is pressed, the first item will get selected. * - * @return true if wrapping is enabled, fasle otherwise. + * @return true if wrapping is enabled, false otherwise. * @see setWrappingEnabled */ bool isWrappingEnabled() const; /** - * Sets the list box to wrap or not when selecting items with a keyboard. + * Sets the list box to wrap or not when selecting items + * with a keyboard. + * + * Wrapping means that the selection of items will be wrapped. + * That is, if the first item is selected and up is pressed, + * the last item will get selected. If the last item is selected + * and down is pressed, the first item will get selected. * - * Wrapping means that the selection of items will be wrapped. That is, if - * the first item is selected and up is pressed, the last item will get - * selected. If the last item is selected and down is pressed, the first item - * will get selected. - * * @see isWrappingEnabled */ void setWrappingEnabled(bool wrappingEnabled); @@ -171,6 +173,9 @@ namespace gcn * changes an event will be sent to all selection listeners of the * list box. * + * If you delete your selection listener, be sure to also remove it + * using removeSelectionListener(). + * * @param selectionListener The selection listener to add. * @since 0.8.0 */ @@ -212,15 +217,14 @@ namespace gcn virtual void mouseWheelMovedUp(MouseEvent& mouseEvent); virtual void mouseWheelMovedDown(MouseEvent& mouseEvent); - + virtual void mouseDragged(MouseEvent& mouseEvent); - protected: /** * Distributes a value changed event to all selection listeners * of the list box. - * + * * @since 0.8.0 */ void distributeValueChangedEvent(); @@ -240,19 +244,13 @@ namespace gcn */ bool mWrappingEnabled; - /** - * Typdef. - */ typedef std::list SelectionListenerList; - + /** * The selection listeners of the list box. */ SelectionListenerList mSelectionListeners; - /** - * Typedef. - */ typedef SelectionListenerList::iterator SelectionListenerIterator; }; }