summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
authorJan-Marek Glogowski <glogow@fbihome.de>2015-07-08 07:51:57 +0000
committerAndras Timar <andras.timar@collabora.com>2015-08-06 12:55:56 +0200
commit95bc327bb17d6e89956c22e11fd5129ceb0026f9 (patch)
tree34ec2c723a0ee14e1259b708edf08fbb1818e52a /vcl
parentebbee8498c92308cca4147bd6c236190c3f83b68 (diff)
tdf#92110 KDE4: cleanup IsNativeControlSupported
Be (more) correct about the widgets and parts, we actually can draw natively in KDE4. Also add an assert, so drawNativeControl won't be called with values not supported by IsNativeControlSupported. Change-Id: Iac6c78194191a9cd059ace560c285263ce7c1045 (cherry picked from commit 88e16529fc7b0e312b68e38295348c93b437aad8) Reviewed-on: https://gerrit.libreoffice.org/16899 Reviewed-by: Katarina Behrens <Katarina.Behrens@cib.de> Tested-by: Katarina Behrens <Katarina.Behrens@cib.de>
Diffstat (limited to 'vcl')
-rw-r--r--vcl/unx/kde4/KDESalGraphics.cxx77
1 files changed, 34 insertions, 43 deletions
diff --git a/vcl/unx/kde4/KDESalGraphics.cxx b/vcl/unx/kde4/KDESalGraphics.cxx
index b77aa0c48747..25ffb0c29e4e 100644
--- a/vcl/unx/kde4/KDESalGraphics.cxx
+++ b/vcl/unx/kde4/KDESalGraphics.cxx
@@ -86,47 +86,38 @@ KDESalGraphics::~KDESalGraphics()
bool KDESalGraphics::IsNativeControlSupported( ControlType type, ControlPart part )
{
- if (type == CTRL_PUSHBUTTON) return true;
-
- if (type == CTRL_MENUBAR) return true;
-
- if (type == CTRL_MENU_POPUP) return true;
-
- if (type == CTRL_EDITBOX) return true;
-
- if (type == CTRL_COMBOBOX) return true;
-
- if (type == CTRL_TOOLBAR) return true;
-
- if (type == CTRL_CHECKBOX) return true;
-
- if (type == CTRL_LISTBOX) return true;
-
- if (type == CTRL_LISTNODE) return true;
-
- if (type == CTRL_FRAME) return true;
-
- if (type == CTRL_SCROLLBAR) return true;
-
- if (type == CTRL_WINDOW_BACKGROUND) return true;
-
- if (type == CTRL_SPINBOX && (part == PART_ENTIRE_CONTROL || part == HAS_BACKGROUND_TEXTURE) ) return true;
-
- // no spinbuttons for KDE, paint spinbox complete
- //if (type == CTRL_SPINBUTTONS) return true;
-
- if (type == CTRL_GROUPBOX) return true;
-
- if (type == CTRL_FIXEDLINE) return true;
+ switch (type)
+ {
+ case CTRL_PUSHBUTTON:
+ case CTRL_RADIOBUTTON:
+ case CTRL_CHECKBOX:
+ case CTRL_TOOLTIP:
+ case CTRL_PROGRESS:
+ case CTRL_LISTNODE:
+ return (part == PART_ENTIRE_CONTROL);
- if (type == CTRL_TOOLTIP) return true;
+ case CTRL_MENUBAR:
+ case CTRL_MENU_POPUP:
+ case CTRL_EDITBOX:
+ case CTRL_COMBOBOX:
+ case CTRL_TOOLBAR:
+ case CTRL_LISTBOX:
+ case CTRL_FRAME:
+ case CTRL_SCROLLBAR:
+ case CTRL_WINDOW_BACKGROUND:
+ case CTRL_GROUPBOX:
+ case CTRL_FIXEDLINE:
+ return true;
- if (type == CTRL_RADIOBUTTON) return true;
+ case CTRL_SPINBOX:
+ return (part == PART_ENTIRE_CONTROL || part == HAS_BACKGROUND_TEXTURE);
- if (type == CTRL_SLIDER && (part == PART_TRACK_HORZ_AREA || part == PART_TRACK_VERT_AREA) )
- return true;
+ case CTRL_SLIDER:
+ return (part == PART_TRACK_HORZ_AREA || part == PART_TRACK_VERT_AREA);
- if ( (type == CTRL_PROGRESS) && (part == PART_ENTIRE_CONTROL) ) return true;
+ default:
+ break;
+ }
return false;
}
@@ -222,15 +213,15 @@ bool KDESalGraphics::drawNativeControl( ControlType type, ControlPart part,
const ImplControlValue& value,
const OUString& )
{
- if( lastPopupRect.isValid() && ( type != CTRL_MENU_POPUP || part != PART_MENU_ITEM ))
- lastPopupRect = QRect();
-
- // put not implemented types here
- if (type == CTRL_SPINBUTTONS)
- {
+ bool nativeSupport = IsNativeControlSupported( type, part );
+ if( ! nativeSupport ) {
+ assert( ! nativeSupport && "drawNativeControl called without native support!" );
return false;
}
+ if( lastPopupRect.isValid() && ( type != CTRL_MENU_POPUP || part != PART_MENU_ITEM ))
+ lastPopupRect = QRect();
+
bool returnVal = true;
QRect widgetRect = region2QRect(rControlRegion);