src/widget.cpp
branchnoai
changeset 9601 b499fdd106d5
parent 9574 698395509d12
child 8320 6ffad7a5d242
child 9722 ebf0ece7d8f6
equal deleted inserted replaced
9600:59cc173953ae 9601:b499fdd106d5
    34 	pt.x = top;
    34 	pt.x = top;
    35 	pt.y = bottom - 1;
    35 	pt.y = bottom - 1;
    36 	return pt;
    36 	return pt;
    37 }
    37 }
    38 
    38 
    39 /*****************************************************
    39 /** Special handling for the scrollbar widget type.
    40  * Special handling for the scrollbar widget type.
       
    41  * Handles the special scrolling buttons and other
    40  * Handles the special scrolling buttons and other
    42  * scrolling.
    41  * scrolling.
    43  * Parameters:
    42  * @param w Window on which a scroll was performed.
    44  *   w   - Window.
    43  * @param wi Pointer to the scrollbar widget.
    45  *   wi  - Pointer to the scrollbar widget.
    44  * @param x The X coordinate of the mouse click.
    46  *   x   - The X coordinate of the mouse click.
    45  * @param y The Y coordinate of the mouse click. */
    47  *   y   - The Y coordinate of the mouse click.
       
    48  */
       
    49 
       
    50 void ScrollbarClickHandler(Window *w, const Widget *wi, int x, int y)
    46 void ScrollbarClickHandler(Window *w, const Widget *wi, int x, int y)
    51 {
    47 {
    52 	int mi, ma, pos;
    48 	int mi, ma, pos;
    53 	Scrollbar *sb;
    49 	Scrollbar *sb;
    54 
    50 
   126 }
   122 }
   127 
   123 
   128 /** Returns the index for the widget located at the given position
   124 /** Returns the index for the widget located at the given position
   129  * relative to the window. It includes all widget-corner pixels as well.
   125  * relative to the window. It includes all widget-corner pixels as well.
   130  * @param *w Window to look inside
   126  * @param *w Window to look inside
   131  * @param  x
   127  * @param  x The Window client X coordinate
   132  * @param  y Window client coordinates
   128  * @param  y The Window client y coordinate
   133  * @return A widget index, or -1 if no widget was found.
   129  * @return A widget index, or -1 if no widget was found.
   134  */
   130  */
   135 int GetWidgetFromPos(const Window *w, int x, int y)
   131 int GetWidgetFromPos(const Window *w, int x, int y)
   136 {
   132 {
   137 	uint index;
   133 	uint index;
   735 	w->widget[c].left  = w->widget[b].right + 1;
   731 	w->widget[c].left  = w->widget[b].right + 1;
   736 }
   732 }
   737 
   733 
   738 /** Evenly distribute some widgets when resizing horizontally (often a button row)
   734 /** Evenly distribute some widgets when resizing horizontally (often a button row)
   739  *  When only two arguments are given, the widgets are presumed to be on a line and only the ends are given
   735  *  When only two arguments are given, the widgets are presumed to be on a line and only the ends are given
   740  * @param w widow to modify
   736  * @param w Window to modify
   741  * @param left The leftmost widget to resize
   737  * @param left The leftmost widget to resize
   742  * @param right The rightmost widget to resize. Since right side of it is used, remember to set it to RESIZE_RIGHT
   738  * @param right The rightmost widget to resize. Since right side of it is used, remember to set it to RESIZE_RIGHT
   743  */
   739  */
   744 void ResizeButtons(Window *w, byte left, byte right)
   740 void ResizeButtons(Window *w, byte left, byte right)
   745 {
   741 {