diff options
author | Ruslan Kabatsayev <b7.10110111@gmail.com> | 2012-05-31 23:47:19 +0400 |
---|---|---|
committer | Michael Meeks <michael.meeks@suse.com> | 2012-06-01 12:35:04 +0100 |
commit | 71daa69351f6903d6a94b7af15fce53361f79c6d (patch) | |
tree | a79a0f185be30e4ed1df30cf44aa6775b1724640 | |
parent | 35a30cbc04cee9b8cdffc334f631ce5580a89e03 (diff) |
GTK theming plugin: convert big if statement to switch structure
Change-Id: I1220d80bdba4835db3674271f8a060af50af998f
-rw-r--r-- | vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx | 161 |
1 files changed, 87 insertions, 74 deletions
diff --git a/vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx b/vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx index 9d9dee67b29b..b86e91f49d4f 100644 --- a/vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx +++ b/vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx @@ -544,81 +544,94 @@ void GtkSalGraphics::copyBits( const SalTwoRect* pPosAry, */ sal_Bool GtkSalGraphics::IsNativeControlSupported( ControlType nType, ControlPart nPart ) { - if ( - ((nType==CTRL_PUSHBUTTON) && (nPart==PART_ENTIRE_CONTROL)) || - ((nType==CTRL_RADIOBUTTON) && (nPart==PART_ENTIRE_CONTROL)) || - ((nType==CTRL_CHECKBOX) && (nPart==PART_ENTIRE_CONTROL)) || - ((nType==CTRL_SCROLLBAR) && - ( (nPart==PART_DRAW_BACKGROUND_HORZ) - || (nPart==PART_DRAW_BACKGROUND_VERT) - || (nPart==PART_ENTIRE_CONTROL) - || (nPart==HAS_THREE_BUTTONS) ) ) || - ((nType==CTRL_EDITBOX) && - ( (nPart==PART_ENTIRE_CONTROL) - || (nPart==HAS_BACKGROUND_TEXTURE) ) ) || - ((nType==CTRL_MULTILINE_EDITBOX) && - ( (nPart==PART_ENTIRE_CONTROL) - || (nPart==HAS_BACKGROUND_TEXTURE) ) ) || - ((nType==CTRL_SPINBOX) && - ( (nPart==PART_ENTIRE_CONTROL) - || (nPart==PART_ALL_BUTTONS) - || (nPart==HAS_BACKGROUND_TEXTURE) ) ) || - ((nType==CTRL_SPINBUTTONS) && - ( (nPart==PART_ENTIRE_CONTROL) - || (nPart==PART_ALL_BUTTONS) ) ) || - ((nType==CTRL_COMBOBOX) && - ( (nPart==PART_ENTIRE_CONTROL) - || (nPart==HAS_BACKGROUND_TEXTURE) ) ) || - (((nType==CTRL_TAB_ITEM) || (nType==CTRL_TAB_PANE) || - (nType==CTRL_TAB_BODY) || (nType==CTRL_FIXEDBORDER)) && - ( (nPart==PART_ENTIRE_CONTROL) - || (nPart==PART_TABS_DRAW_RTL) ) ) || - ((nType==CTRL_LISTBOX) && - ( (nPart==PART_ENTIRE_CONTROL) - || (nPart==PART_WINDOW) - || (nPart==HAS_BACKGROUND_TEXTURE) ) ) || - ((nType == CTRL_TOOLBAR) && - ( (nPart==PART_ENTIRE_CONTROL) - || (nPart==PART_DRAW_BACKGROUND_HORZ) - || (nPart==PART_DRAW_BACKGROUND_VERT) - || (nPart==PART_THUMB_HORZ) - || (nPart==PART_THUMB_VERT) - || (nPart==PART_BUTTON) - || (nPart==PART_SEPARATOR_HORZ) - || (nPart==PART_SEPARATOR_VERT) - ) - ) || - ((nType == CTRL_MENUBAR) && - ( (nPart==PART_ENTIRE_CONTROL) - || (nPart==PART_MENU_ITEM) - ) - ) || - ((nType == CTRL_TOOLTIP) && - ( (nPart==PART_ENTIRE_CONTROL) ) ) || - ((nType == CTRL_MENU_POPUP) && - ( (nPart==PART_ENTIRE_CONTROL) - || (nPart==PART_MENU_ITEM) - || (nPart==PART_MENU_ITEM_CHECK_MARK) - || (nPart==PART_MENU_ITEM_RADIO_MARK) - || (nPart==PART_MENU_SEPARATOR) - || (nPart==PART_MENU_SUBMENU_ARROW) - ) - ) || - ((nType == CTRL_PROGRESS) && - ( (nPart == PART_ENTIRE_CONTROL) ) - ) || - ((nType == CTRL_LISTNODE || nType == CTRL_LISTNET) && - ( (nPart == PART_ENTIRE_CONTROL) ) - ) || - ((nType == CTRL_SLIDER) && - ( (nPart == PART_TRACK_HORZ_AREA) - || (nPart == PART_TRACK_VERT_AREA) + switch(nType) + { + case CTRL_PUSHBUTTON: + case CTRL_RADIOBUTTON: + case CTRL_CHECKBOX: + case CTRL_TOOLTIP: + case CTRL_PROGRESS: + case CTRL_LISTNODE: + case CTRL_LISTNET: + if(nPart==PART_ENTIRE_CONTROL) + return true; + break; + + case CTRL_SCROLLBAR: + if(nPart==PART_DRAW_BACKGROUND_HORZ || nPart==PART_DRAW_BACKGROUND_VERT || + nPart==PART_ENTIRE_CONTROL || nPart==HAS_THREE_BUTTONS) + return true; + break; + + case CTRL_EDITBOX: + case CTRL_MULTILINE_EDITBOX: + case CTRL_COMBOBOX: + if(nPart==PART_ENTIRE_CONTROL || nPart==HAS_BACKGROUND_TEXTURE) + return true; + break; + + case CTRL_SPINBOX: + if(nPart==PART_ENTIRE_CONTROL || nPart==PART_ALL_BUTTONS || nPart==HAS_BACKGROUND_TEXTURE) + return true; + break; + + case CTRL_SPINBUTTONS: + if(nPart==PART_ENTIRE_CONTROL || nPart==PART_ALL_BUTTONS) + return true; + break; + + case CTRL_WINDOW_BACKGROUND: + return true; + + case CTRL_TAB_ITEM: + case CTRL_TAB_PANE: + case CTRL_TAB_BODY: + case CTRL_FIXEDBORDER: + if(nPart==PART_ENTIRE_CONTROL || nPart==PART_TABS_DRAW_RTL) + return true; + break; + + case CTRL_LISTBOX: + if(nPart==PART_ENTIRE_CONTROL || nPart==PART_WINDOW || nPart==HAS_BACKGROUND_TEXTURE) + return true; + break; + + case CTRL_TOOLBAR: + if( nPart==PART_ENTIRE_CONTROL + || nPart==PART_DRAW_BACKGROUND_HORZ + || nPart==PART_DRAW_BACKGROUND_VERT + || nPart==PART_THUMB_HORZ + || nPart==PART_THUMB_VERT + || nPart==PART_BUTTON + || nPart==PART_SEPARATOR_HORZ + || nPart==PART_SEPARATOR_VERT ) - ) || - (nType == CTRL_WINDOW_BACKGROUND) - ) - return( sal_True ); - return( sal_False ); + return true; + break; + + case CTRL_MENUBAR: + if(nPart==PART_ENTIRE_CONTROL || nPart==PART_MENU_ITEM) + return true; + break; + + case CTRL_MENU_POPUP: + if (nPart==PART_ENTIRE_CONTROL + || nPart==PART_MENU_ITEM + || nPart==PART_MENU_ITEM_CHECK_MARK + || nPart==PART_MENU_ITEM_RADIO_MARK + || nPart==PART_MENU_SEPARATOR + || nPart==PART_MENU_SUBMENU_ARROW + ) + return true; + break; + + case CTRL_SLIDER: + if(nPart == PART_TRACK_HORZ_AREA || nPart == PART_TRACK_VERT_AREA) + return true; + break; + } + + return false; } |