Cleanup: move widget enum into source file
authorCampbell Barton <ideasman42@gmail.com>
Fri, 22 Mar 2019 06:56:58 +0000 (17:56 +1100)
committerCampbell Barton <ideasman42@gmail.com>
Fri, 22 Mar 2019 06:56:58 +0000 (17:56 +1100)
source/blender/editors/interface/interface_intern.h
source/blender/editors/interface/interface_region_search.c
source/blender/editors/interface/interface_widgets.c

index 1ca83b9..84608e8 100644 (file)
@@ -50,53 +50,6 @@ struct wmTimer;
 #define RNA_NO_INDEX    -1
 #define RNA_ENUM_VALUE  -2
 
-/* visual types for drawing */
-/* for time being separated from functional types */
-typedef enum {
-       /* default */
-       UI_WTYPE_REGULAR,
-
-       /* standard set */
-       UI_WTYPE_LABEL,
-       UI_WTYPE_TOGGLE,
-       UI_WTYPE_CHECKBOX,
-       UI_WTYPE_RADIO,
-       UI_WTYPE_NUMBER,
-       UI_WTYPE_SLIDER,
-       UI_WTYPE_EXEC,
-       UI_WTYPE_TOOLBAR_ITEM,
-       UI_WTYPE_TAB,
-       UI_WTYPE_TOOLTIP,
-
-       /* strings */
-       UI_WTYPE_NAME,
-       UI_WTYPE_NAME_LINK,
-       UI_WTYPE_POINTER_LINK,
-       UI_WTYPE_FILENAME,
-
-       /* menus */
-       UI_WTYPE_MENU_RADIO,
-       UI_WTYPE_MENU_ICON_RADIO,
-       UI_WTYPE_MENU_POINTER_LINK,
-       UI_WTYPE_MENU_NODE_LINK,
-
-       UI_WTYPE_PULLDOWN,
-       UI_WTYPE_MENU_ITEM,
-       UI_WTYPE_MENU_ITEM_RADIAL,
-       UI_WTYPE_MENU_BACK,
-
-       /* specials */
-       UI_WTYPE_ICON,
-       UI_WTYPE_ICON_LABEL,
-       UI_WTYPE_SWATCH,
-       UI_WTYPE_RGB_PICKER,
-       UI_WTYPE_UNITVEC,
-       UI_WTYPE_BOX,
-       UI_WTYPE_SCROLL,
-       UI_WTYPE_LISTITEM,
-       UI_WTYPE_PROGRESSBAR,
-} uiWidgetTypeEnum;
-
 #define UI_MENU_PADDING (int)(0.2f * UI_UNIT_Y)
 
 #define UI_MENU_WIDTH_MIN       (UI_UNIT_Y * 9)
@@ -795,11 +748,8 @@ void ui_draw_popover_back(ARegion *ar, struct uiStyle *style, uiBlock *block, rc
 void ui_draw_pie_center(uiBlock *block);
 const struct uiWidgetColors *ui_tooltip_get_theme(void);
 
-void ui_draw_widget_back_color(
-        uiWidgetTypeEnum type, bool use_shadow, const rcti *rect,
-        const float color[4]);
-void ui_draw_widget_back(
-        uiWidgetTypeEnum type, bool use_shadow, const rcti *rect);
+void ui_draw_widget_menu_back_color(const rcti *rect, bool use_shadow, const float color[4]);
+void ui_draw_widget_menu_back(const rcti *rect, bool use_shadow);
 void ui_draw_tooltip_background(struct uiStyle *UNUSED(style), uiBlock *block, rcti *rect);
 
 extern void ui_draw_but(const struct bContext *C, ARegion *ar, struct uiStyle *style, uiBut *but, rcti *rect);
index 65d5fda..a4852ff 100644 (file)
@@ -404,7 +404,7 @@ static void ui_searchbox_region_draw_cb(const bContext *C, ARegion *ar)
        wmOrtho2_region_pixelspace(ar);
 
        if (data->noback == false) {
-               ui_draw_widget_back(UI_WTYPE_MENU_BACK, true, &data->bbox);
+               ui_draw_widget_menu_back(&data->bbox, true);
        }
 
        /* draw text */
@@ -685,7 +685,7 @@ static void ui_searchbox_region_draw_cb__operator(const bContext *UNUSED(C), ARe
        wmOrtho2_region_pixelspace(ar);
 
        if (data->noback == false) {
-               ui_draw_widget_back(UI_WTYPE_MENU_BACK, true, &data->bbox);
+               ui_draw_widget_menu_back(&data->bbox, true);
        }
 
        /* draw text */
index 2036fe3..e0b896f 100644 (file)
 /* icons are 80% of height of button (16 pixels inside 20 height) */
 #define ICON_SIZE_FROM_BUTRECT(rect) (0.8f * BLI_rcti_size_y(rect))
 
+/* visual types for drawing */
+/* for time being separated from functional types */
+typedef enum {
+       /* default */
+       UI_WTYPE_REGULAR,
+
+       /* standard set */
+       UI_WTYPE_LABEL,
+       UI_WTYPE_TOGGLE,
+       UI_WTYPE_CHECKBOX,
+       UI_WTYPE_RADIO,
+       UI_WTYPE_NUMBER,
+       UI_WTYPE_SLIDER,
+       UI_WTYPE_EXEC,
+       UI_WTYPE_TOOLBAR_ITEM,
+       UI_WTYPE_TAB,
+       UI_WTYPE_TOOLTIP,
+
+       /* strings */
+       UI_WTYPE_NAME,
+       UI_WTYPE_NAME_LINK,
+       UI_WTYPE_POINTER_LINK,
+       UI_WTYPE_FILENAME,
+
+       /* menus */
+       UI_WTYPE_MENU_RADIO,
+       UI_WTYPE_MENU_ICON_RADIO,
+       UI_WTYPE_MENU_POINTER_LINK,
+       UI_WTYPE_MENU_NODE_LINK,
+
+       UI_WTYPE_PULLDOWN,
+       UI_WTYPE_MENU_ITEM,
+       UI_WTYPE_MENU_ITEM_RADIAL,
+       UI_WTYPE_MENU_BACK,
+
+       /* specials */
+       UI_WTYPE_ICON,
+       UI_WTYPE_ICON_LABEL,
+       UI_WTYPE_SWATCH,
+       UI_WTYPE_RGB_PICKER,
+       UI_WTYPE_UNITVEC,
+       UI_WTYPE_BOX,
+       UI_WTYPE_SCROLL,
+       UI_WTYPE_LISTITEM,
+       UI_WTYPE_PROGRESSBAR,
+} uiWidgetTypeEnum;
+
+
 /* Button state argument shares bits with 'uiBut.flag'.
  * reuse flags that aren't needed for drawing to avoid collision. */
 enum {
@@ -4679,7 +4727,7 @@ const uiWidgetColors *ui_tooltip_get_theme(void)
 /**
  * Generic drawing for background.
  */
-void ui_draw_widget_back_color(
+static void ui_draw_widget_back_color(
         uiWidgetTypeEnum type, bool use_shadow, const rcti *rect,
         const float color[4])
 {
@@ -4699,9 +4747,14 @@ void ui_draw_widget_back_color(
        }
        wt->draw(&wt->wcol, &rect_copy, 0, UI_CNR_ALL);
 }
-void ui_draw_widget_back(uiWidgetTypeEnum type, bool use_shadow, const rcti *rect)
+void ui_draw_widget_menu_back_color(const rcti *rect, bool use_shadow, const float color[4])
+{
+       ui_draw_widget_back_color(UI_WTYPE_MENU_BACK, use_shadow, rect, color);
+}
+
+void ui_draw_widget_menu_back(const rcti *rect, bool use_shadow)
 {
-       ui_draw_widget_back_color(type, use_shadow, rect, NULL);
+       ui_draw_widget_back_color(UI_WTYPE_MENU_BACK, use_shadow, rect, NULL);
 }
 
 void ui_draw_tooltip_background(uiStyle *UNUSED(style), uiBlock *UNUSED(block), rcti *rect)