summaryrefslogtreecommitdiffstats
path: root/src/gui/styles
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui/styles')
-rw-r--r--src/gui/styles/gtksymbols.cpp317
-rw-r--r--src/gui/styles/gtksymbols_p.h14
-rw-r--r--src/gui/styles/images/defaults60theme.blobbin0 -> 74127 bytes
-rw-r--r--src/gui/styles/qcdestyle.cpp8
-rw-r--r--src/gui/styles/qcdestyle.h8
-rw-r--r--src/gui/styles/qcleanlooksstyle.cpp1182
-rw-r--r--src/gui/styles/qcleanlooksstyle.h8
-rw-r--r--src/gui/styles/qcleanlooksstyle_p.h10
-rw-r--r--src/gui/styles/qcommonstyle.cpp1842
-rw-r--r--src/gui/styles/qcommonstyle.h8
-rw-r--r--src/gui/styles/qcommonstyle_p.h23
-rw-r--r--src/gui/styles/qcommonstylepixmaps_p.h8
-rw-r--r--src/gui/styles/qgtkpainter.cpp8
-rw-r--r--src/gui/styles/qgtkpainter_p.h8
-rw-r--r--src/gui/styles/qgtkstyle.cpp275
-rw-r--r--src/gui/styles/qgtkstyle.h12
-rw-r--r--src/gui/styles/qmacstyle.qdoc261
-rw-r--r--src/gui/styles/qmacstyle_mac.h8
-rw-r--r--src/gui/styles/qmacstyle_mac.mm1085
-rw-r--r--src/gui/styles/qmacstylepixmaps_mac_p.h1408
-rw-r--r--src/gui/styles/qmotifstyle.cpp171
-rw-r--r--src/gui/styles/qmotifstyle.h8
-rw-r--r--src/gui/styles/qmotifstyle_p.h8
-rw-r--r--src/gui/styles/qplastiquestyle.cpp228
-rw-r--r--src/gui/styles/qplastiquestyle.h8
-rw-r--r--src/gui/styles/qproxystyle.cpp420
-rw-r--r--src/gui/styles/qproxystyle.h114
-rw-r--r--src/gui/styles/qproxystyle_p.h79
-rw-r--r--src/gui/styles/qs60style.cpp2882
-rw-r--r--src/gui/styles/qs60style.h110
-rw-r--r--src/gui/styles/qs60style_p.h508
-rw-r--r--src/gui/styles/qs60style_s60.cpp1384
-rw-r--r--src/gui/styles/qs60style_simulated.cpp448
-rw-r--r--src/gui/styles/qstyle.cpp134
-rw-r--r--src/gui/styles/qstyle.h24
-rw-r--r--src/gui/styles/qstyle_p.h25
-rw-r--r--src/gui/styles/qstyle_s60_simulated.qrc6
-rw-r--r--src/gui/styles/qstylefactory.cpp22
-rw-r--r--src/gui/styles/qstylefactory.h8
-rw-r--r--src/gui/styles/qstylehelper.cpp376
-rw-r--r--src/gui/styles/qstylehelper_p.h84
-rw-r--r--src/gui/styles/qstyleoption.cpp104
-rw-r--r--src/gui/styles/qstyleoption.h9
-rw-r--r--src/gui/styles/qstyleplugin.cpp8
-rw-r--r--src/gui/styles/qstyleplugin.h8
-rw-r--r--src/gui/styles/qstylesheetstyle.cpp369
-rw-r--r--src/gui/styles/qstylesheetstyle_default.cpp15
-rw-r--r--src/gui/styles/qstylesheetstyle_p.h10
-rw-r--r--src/gui/styles/qwindowscestyle.cpp12
-rw-r--r--src/gui/styles/qwindowscestyle.h8
-rw-r--r--src/gui/styles/qwindowscestyle_p.h8
-rw-r--r--src/gui/styles/qwindowsmobilestyle.cpp4457
-rw-r--r--src/gui/styles/qwindowsmobilestyle.h8
-rw-r--r--src/gui/styles/qwindowsmobilestyle_p.h47
-rw-r--r--src/gui/styles/qwindowsstyle.cpp269
-rw-r--r--src/gui/styles/qwindowsstyle.h8
-rw-r--r--src/gui/styles/qwindowsstyle_p.h8
-rw-r--r--src/gui/styles/qwindowsvistastyle.cpp326
-rw-r--r--src/gui/styles/qwindowsvistastyle.h8
-rw-r--r--src/gui/styles/qwindowsvistastyle_p.h8
-rw-r--r--src/gui/styles/qwindowsxpstyle.cpp235
-rw-r--r--src/gui/styles/qwindowsxpstyle.h8
-rw-r--r--src/gui/styles/qwindowsxpstyle_p.h8
-rw-r--r--src/gui/styles/styles.pri23
64 files changed, 13802 insertions, 5702 deletions
diff --git a/src/gui/styles/gtksymbols.cpp b/src/gui/styles/gtksymbols.cpp
index 3b452ab..b61675b 100644
--- a/src/gui/styles/gtksymbols.cpp
+++ b/src/gui/styles/gtksymbols.cpp
@@ -1,7 +1,6 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the QtGui module of the Qt Toolkit.
@@ -21,9 +20,10 @@
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.1, included in the file LGPL_EXCEPTION.txt in this
+** package.
**
** If you have questions regarding the use of this file, please contact
** Nokia at qt-info@nokia.com.
@@ -60,6 +60,7 @@
#include <QtCore/QHash>
#include <private/qapplication_p.h>
+#include <private/qiconloader_p.h>
#include <QtGui/QMenu>
#include <QtGui/QStyle>
@@ -68,6 +69,7 @@
#include <QtGui/QStatusBar>
#include <QtGui/QMenuBar>
#include <QtGui/QToolBar>
+#include <QtGui/QToolButton>
#include <QtGui/QX11Info>
#include <X11/Xlib.h>
@@ -166,6 +168,7 @@ Ptr_gtk_file_filter_set_name QGtk::gtk_file_filter_set_name = 0;
Ptr_gtk_file_filter_add_pattern QGtk::gtk_file_filter_add_pattern = 0;
Ptr_gtk_file_chooser_add_filter QGtk::gtk_file_chooser_add_filter = 0;
Ptr_gtk_file_chooser_set_filter QGtk::gtk_file_chooser_set_filter = 0;
+Ptr_gtk_file_chooser_get_filter QGtk::gtk_file_chooser_get_filter = 0;
Ptr_gtk_file_chooser_dialog_new QGtk::gtk_file_chooser_dialog_new = 0;
Ptr_gtk_file_chooser_set_current_folder QGtk::gtk_file_chooser_set_current_folder = 0;
Ptr_gtk_file_chooser_get_filename QGtk::gtk_file_chooser_get_filename = 0;
@@ -191,6 +194,7 @@ Ptr_gdk_x11_drawable_get_xdisplay QGtk::gdk_x11_drawable_get_xdisplay = 0;
Ptr_gconf_client_get_default QGtk::gconf_client_get_default = 0;
Ptr_gconf_client_get_string QGtk::gconf_client_get_string = 0;
+Ptr_gconf_client_get_bool QGtk::gconf_client_get_bool = 0;
static QString classPath(GtkWidget *widget)
{
@@ -207,118 +211,119 @@ static QString classPath(GtkWidget *widget)
static void resolveGtk()
{
- const QString GTK_PATH(QLS("gtk-x11-2.0"));
- QGtk::gtk_init = (Ptr_gtk_init)QLibrary::resolve(GTK_PATH, 0, "gtk_init");
- QGtk::gtk_window_new = (Ptr_gtk_window_new)QLibrary::resolve(GTK_PATH, 0, "gtk_window_new");
- QGtk::gtk_style_attach = (Ptr_gtk_style_attach)QLibrary::resolve(GTK_PATH, 0, "gtk_style_attach");
- QGtk::gtk_widget_destroy = (Ptr_gtk_widget_destroy)QLibrary::resolve(GTK_PATH, 0, "gtk_widget_destroy");
- QGtk::gtk_widget_realize = (Ptr_gtk_widget_realize)QLibrary::resolve(GTK_PATH, 0, "gtk_widget_realize");
-
- QGtk::gtk_file_chooser_set_current_folder = (Ptr_gtk_file_chooser_set_current_folder)QLibrary::resolve(GTK_PATH, 0, "gtk_file_chooser_set_current_folder");
- QGtk::gtk_file_filter_new = (Ptr_gtk_file_filter_new)QLibrary::resolve(GTK_PATH, 0, "gtk_file_filter_new");
- QGtk::gtk_file_filter_set_name = (Ptr_gtk_file_filter_set_name)QLibrary::resolve(GTK_PATH, 0, "gtk_file_filter_set_name");
- QGtk::gtk_file_filter_add_pattern = (Ptr_gtk_file_filter_add_pattern)QLibrary::resolve(GTK_PATH, 0, "gtk_file_filter_add_pattern");
- QGtk::gtk_file_chooser_add_filter = (Ptr_gtk_file_chooser_add_filter)QLibrary::resolve(GTK_PATH, 0, "gtk_file_chooser_add_filter");
- QGtk::gtk_file_chooser_set_filter = (Ptr_gtk_file_chooser_set_filter)QLibrary::resolve(GTK_PATH, 0, "gtk_file_chooser_set_filter");
- QGtk::gtk_file_chooser_dialog_new = (Ptr_gtk_file_chooser_dialog_new)QLibrary::resolve(GTK_PATH, 0, "gtk_file_chooser_dialog_new");
- QGtk::gtk_file_chooser_set_current_folder = (Ptr_gtk_file_chooser_set_current_folder)QLibrary::resolve(GTK_PATH, 0, "gtk_file_chooser_set_current_folder");
- QGtk::gtk_file_chooser_get_filename = (Ptr_gtk_file_chooser_get_filename)QLibrary::resolve(GTK_PATH, 0, "gtk_file_chooser_get_filename");
- QGtk::gtk_file_chooser_get_filenames = (Ptr_gtk_file_chooser_get_filenames)QLibrary::resolve(GTK_PATH, 0, "gtk_file_chooser_get_filenames");
- QGtk::gtk_file_chooser_set_current_name = (Ptr_gtk_file_chooser_set_current_name)QLibrary::resolve(GTK_PATH, 0, "gtk_file_chooser_set_current_name");
- QGtk::gtk_dialog_run = (Ptr_gtk_dialog_run)QLibrary::resolve(GTK_PATH, 0, "gtk_dialog_run");
- QGtk::gtk_file_chooser_set_filename = (Ptr_gtk_file_chooser_set_filename)QLibrary::resolve(GTK_PATH, 0, "gtk_file_chooser_set_filename");
-
- QGtk::gdk_pixbuf_get_pixels = (Ptr_gdk_pixbuf_get_pixels)QLibrary::resolve(GTK_PATH, 0, "gdk_pixbuf_get_pixels");
- QGtk::gdk_pixbuf_get_width = (Ptr_gdk_pixbuf_get_width)QLibrary::resolve(GTK_PATH, 0, "gdk_pixbuf_get_width");
- QGtk::gdk_pixbuf_get_height = (Ptr_gdk_pixbuf_get_height)QLibrary::resolve(GTK_PATH, 0, "gdk_pixbuf_get_height");
- QGtk::gdk_pixmap_new = (Ptr_gdk_pixmap_new)QLibrary::resolve(GTK_PATH, 0, "gdk_pixmap_new");
- QGtk::gdk_pixbuf_new = (Ptr_gdk_pixbuf_new)QLibrary::resolve(GTK_PATH, 0, "gdk_pixbuf_new");
- QGtk::gdk_pixbuf_get_from_drawable = (Ptr_gdk_pixbuf_get_from_drawable)QLibrary::resolve(GTK_PATH, 0, "gdk_pixbuf_get_from_drawable");
- QGtk::gdk_draw_rectangle = (Ptr_gdk_draw_rectangle)QLibrary::resolve(GTK_PATH, 0, "gdk_draw_rectangle");
- QGtk::gdk_pixbuf_unref = (Ptr_gdk_pixbuf_unref)QLibrary::resolve(GTK_PATH, 0, "gdk_pixbuf_unref");
- QGtk::gdk_drawable_unref = (Ptr_gdk_drawable_unref)QLibrary::resolve(GTK_PATH, 0, "gdk_drawable_unref");
- QGtk::gdk_drawable_get_depth = (Ptr_gdk_drawable_get_depth)QLibrary::resolve(GTK_PATH, 0, "gdk_drawable_get_depth");
- QGtk::gdk_color_free = (Ptr_gdk_color_free)QLibrary::resolve(GTK_PATH, 0, "gdk_color_free");
- QGtk::gdk_x11_window_set_user_time = (Ptr_gdk_x11_window_set_user_time)QLibrary::resolve(GTK_PATH, 0, "gdk_x11_window_set_user_time");
- QGtk::gdk_x11_drawable_get_xid = (Ptr_gdk_x11_drawable_get_xid)QLibrary::resolve(GTK_PATH, 0, "gdk_x11_drawable_get_xid");
- QGtk::gdk_x11_drawable_get_xdisplay = (Ptr_gdk_x11_drawable_get_xdisplay)QLibrary::resolve(GTK_PATH, 0, "gdk_x11_drawable_get_xdisplay");
-
- QGtk::gtk_widget_set_default_direction = (Ptr_gtk_widget_set_default_direction)QLibrary::resolve(GTK_PATH, 0, "gtk_widget_set_default_direction");
- QGtk::gtk_widget_modify_fg = (Ptr_gtk_widget_modify_color)QLibrary::resolve(GTK_PATH, 0, "gtk_widget_modify_fg");
- QGtk::gtk_widget_modify_bg = (Ptr_gtk_widget_modify_color)QLibrary::resolve(GTK_PATH, 0, "gtk_widget_modify_bg");
- QGtk::gtk_arrow_new = (Ptr_gtk_arrow_new)QLibrary::resolve(GTK_PATH, 0, "gtk_arrow_new");
- QGtk::gtk_menu_item_new = (Ptr_gtk_menu_item_new)QLibrary::resolve(GTK_PATH, 0, "gtk_menu_item_new");
- QGtk::gtk_check_menu_item_new = (Ptr_gtk_check_menu_item_new)QLibrary::resolve(GTK_PATH, 0, "gtk_check_menu_item_new");
- QGtk::gtk_menu_bar_new = (Ptr_gtk_menu_bar_new)QLibrary::resolve(GTK_PATH, 0, "gtk_menu_bar_new");
- QGtk::gtk_menu_new = (Ptr_gtk_menu_new)QLibrary::resolve(GTK_PATH, 0, "gtk_menu_new");
- QGtk::gtk_toolbar_new = (Ptr_gtk_toolbar_new)QLibrary::resolve(GTK_PATH, 0, "gtk_toolbar_new");
- QGtk::gtk_separator_tool_item_new = (Ptr_gtk_separator_tool_item_new)QLibrary::resolve(GTK_PATH, 0, "gtk_separator_tool_item_new");
- QGtk::gtk_toolbar_insert = (Ptr_gtk_toolbar_insert)QLibrary::resolve(GTK_PATH, 0, "gtk_toolbar_insert");
- QGtk::gtk_button_new = (Ptr_gtk_button_new)QLibrary::resolve(GTK_PATH, 0, "gtk_button_new");
- QGtk::gtk_hbutton_box_new = (Ptr_gtk_hbutton_box_new)QLibrary::resolve(GTK_PATH, 0, "gtk_hbutton_box_new");
- QGtk::gtk_check_button_new = (Ptr_gtk_check_button_new)QLibrary::resolve(GTK_PATH, 0, "gtk_check_button_new");
- QGtk::gtk_radio_button_new = (Ptr_gtk_radio_button_new)QLibrary::resolve(GTK_PATH, 0, "gtk_radio_button_new");
- QGtk::gtk_notebook_new = (Ptr_gtk_notebook_new)QLibrary::resolve(GTK_PATH, 0, "gtk_notebook_new");
- QGtk::gtk_progress_bar_new = (Ptr_gtk_progress_bar_new)QLibrary::resolve(GTK_PATH, 0, "gtk_progress_bar_new");
- QGtk::gtk_spin_button_new = (Ptr_gtk_spin_button_new)QLibrary::resolve(GTK_PATH, 0, "gtk_spin_button_new");
- QGtk::gtk_hscale_new = (Ptr_gtk_hscale_new)QLibrary::resolve(GTK_PATH, 0, "gtk_hscale_new");
- QGtk::gtk_vscale_new = (Ptr_gtk_vscale_new)QLibrary::resolve(GTK_PATH, 0, "gtk_vscale_new");
- QGtk::gtk_hscrollbar_new = (Ptr_gtk_hscrollbar_new)QLibrary::resolve(GTK_PATH, 0, "gtk_hscrollbar_new");
- QGtk::gtk_vscrollbar_new = (Ptr_gtk_vscrollbar_new)QLibrary::resolve(GTK_PATH, 0, "gtk_vscrollbar_new");
- QGtk::gtk_scrolled_window_new = (Ptr_gtk_scrolled_window_new)QLibrary::resolve(GTK_PATH, 0, "gtk_scrolled_window_new");
- QGtk::gtk_menu_shell_append = (Ptr_gtk_menu_shell_append)QLibrary::resolve(GTK_PATH, 0, "gtk_menu_shell_append");
- QGtk::gtk_entry_new = (Ptr_gtk_entry_new)QLibrary::resolve(GTK_PATH, 0, "gtk_entry_new");
- QGtk::gtk_tree_view_new = (Ptr_gtk_tree_view_new)QLibrary::resolve(GTK_PATH, 0, "gtk_tree_view_new");
- QGtk::gtk_combo_box_new = (Ptr_gtk_combo_box_new)QLibrary::resolve(GTK_PATH, 0, "gtk_combo_box_new");
- QGtk::gtk_progress_set_adjustment = (Ptr_gtk_progress_set_adjustment)QLibrary::resolve(GTK_PATH, 0, "gtk_progress_set_adjustment");
- QGtk::gtk_range_set_adjustment = (Ptr_gtk_range_set_adjustment)QLibrary::resolve(GTK_PATH, 0, "gtk_range_set_adjustment");
- QGtk::gtk_range_set_inverted = (Ptr_gtk_range_set_inverted)QLibrary::resolve(GTK_PATH, 0, "gtk_range_set_inverted");
- QGtk::gtk_container_add = (Ptr_gtk_container_add)QLibrary::resolve(GTK_PATH, 0, "gtk_container_add");
- QGtk::gtk_icon_factory_lookup_default = (Ptr_gtk_icon_factory_lookup_default)QLibrary::resolve(GTK_PATH, 0, "gtk_icon_factory_lookup_default");
- QGtk::gtk_widget_style_get = (Ptr_gtk_widget_style_get)QLibrary::resolve(GTK_PATH, 0, "gtk_widget_style_get");
- QGtk::gtk_icon_set_render_icon = (Ptr_gtk_icon_set_render_icon)QLibrary::resolve(GTK_PATH, 0, "gtk_icon_set_render_icon");
- QGtk::gtk_fixed_new = (Ptr_gtk_fixed_new)QLibrary::resolve(GTK_PATH, 0, "gtk_fixed_new");
- QGtk::gtk_tree_view_column_new = (Ptr_gtk_tree_view_column_new)QLibrary::resolve(GTK_PATH, 0, "gtk_tree_view_column_new");
- QGtk::gtk_tree_view_append_column= (Ptr_gtk_tree_view_append_column )QLibrary::resolve(GTK_PATH, 0, "gtk_tree_view_append_column");
- QGtk::gtk_tree_view_get_column = (Ptr_gtk_tree_view_get_column )QLibrary::resolve(GTK_PATH, 0, "gtk_tree_view_get_column");
- QGtk::gtk_paint_check = (Ptr_gtk_paint_check)QLibrary::resolve(GTK_PATH, 0, "gtk_paint_check");
- QGtk::gtk_paint_box = (Ptr_gtk_paint_box)QLibrary::resolve(GTK_PATH, 0, "gtk_paint_box");
- QGtk::gtk_paint_flat_box = (Ptr_gtk_paint_flat_box)QLibrary::resolve(GTK_PATH, 0, "gtk_paint_flat_box");
- QGtk::gtk_paint_check = (Ptr_gtk_paint_check)QLibrary::resolve(GTK_PATH, 0, "gtk_paint_check");
- QGtk::gtk_paint_box = (Ptr_gtk_paint_box)QLibrary::resolve(GTK_PATH, 0, "gtk_paint_box");
- QGtk::gtk_paint_resize_grip = (Ptr_gtk_paint_resize_grip)QLibrary::resolve(GTK_PATH, 0, "gtk_paint_resize_grip");
- QGtk::gtk_paint_focus = (Ptr_gtk_paint_focus)QLibrary::resolve(GTK_PATH, 0, "gtk_paint_focus");
- QGtk::gtk_paint_shadow = (Ptr_gtk_paint_shadow)QLibrary::resolve(GTK_PATH, 0, "gtk_paint_shadow");
- QGtk::gtk_paint_slider = (Ptr_gtk_paint_slider)QLibrary::resolve(GTK_PATH, 0, "gtk_paint_slider");
- QGtk::gtk_paint_expander = (Ptr_gtk_paint_expander)QLibrary::resolve(GTK_PATH, 0, "gtk_paint_expander");
- QGtk::gtk_paint_handle = (Ptr_gtk_paint_handle)QLibrary::resolve(GTK_PATH, 0, "gtk_paint_handle");
- QGtk::gtk_paint_option = (Ptr_gtk_paint_option)QLibrary::resolve(GTK_PATH, 0, "gtk_paint_option");
- QGtk::gtk_paint_arrow = (Ptr_gtk_paint_arrow)QLibrary::resolve(GTK_PATH, 0, "gtk_paint_arrow");
- QGtk::gtk_paint_box_gap = (Ptr_gtk_paint_box_gap)QLibrary::resolve(GTK_PATH, 0, "gtk_paint_box_gap");
- QGtk::gtk_paint_extension = (Ptr_gtk_paint_extension)QLibrary::resolve(GTK_PATH, 0, "gtk_paint_extension");
- QGtk::gtk_paint_hline = (Ptr_gtk_paint_hline)QLibrary::resolve(GTK_PATH, 0, "gtk_paint_hline");
- QGtk::gtk_paint_vline = (Ptr_gtk_paint_vline)QLibrary::resolve(GTK_PATH, 0, "gtk_paint_vline");
- QGtk::gtk_adjustment_new = (Ptr_gtk_adjustment_new)QLibrary::resolve(GTK_PATH, 0, "gtk_adjustment_new");
- QGtk::gtk_menu_item_set_submenu = (Ptr_gtk_menu_item_set_submenu)QLibrary::resolve(GTK_PATH, 0, "gtk_menu_item_set_submenu");
- QGtk::gtk_settings_get_default = (Ptr_gtk_settings_get_default)QLibrary::resolve(GTK_PATH, 0, "gtk_settings_get_default");
- QGtk::gtk_separator_menu_item_new = (Ptr_gtk_separator_menu_item_new)QLibrary::resolve(GTK_PATH, 0, "gtk_separator_menu_item_new");
- QGtk::gtk_frame_new = (Ptr_gtk_frame_new)QLibrary::resolve(GTK_PATH, 0, "gtk_frame_new");
- QGtk::gtk_expander_new = (Ptr_gtk_expander_new)QLibrary::resolve(GTK_PATH, 0, "gtk_expander_new");
- QGtk::gtk_statusbar_new = (Ptr_gtk_statusbar_new)QLibrary::resolve(GTK_PATH, 0, "gtk_statusbar_new");
- QGtk::gtk_combo_box_entry_new = (Ptr_gtk_combo_box_entry_new)QLibrary::resolve(GTK_PATH, 0, "gtk_combo_box_entry_new");
- QGtk::gtk_container_forall = (Ptr_gtk_container_forall)QLibrary::resolve(GTK_PATH, 0, "gtk_container_forall");
- QGtk::gtk_widget_size_allocate =(Ptr_gtk_widget_size_allocate)QLibrary::resolve(GTK_PATH, 0, "gtk_widget_size_allocate");
- QGtk::gtk_widget_set_direction =(Ptr_gtk_widget_set_direction)QLibrary::resolve(GTK_PATH, 0, "gtk_widget_set_direction");
- QGtk::gtk_widget_path =(Ptr_gtk_widget_path)QLibrary::resolve(GTK_PATH, 0, "gtk_widget_path");
- QGtk::gtk_container_get_type =(Ptr_gtk_container_get_type)QLibrary::resolve(GTK_PATH, 0, "gtk_container_get_type");
- QGtk::gtk_window_get_type =(Ptr_gtk_window_get_type)QLibrary::resolve(GTK_PATH, 0, "gtk_window_get_type");
- QGtk::gtk_widget_get_type =(Ptr_gtk_widget_get_type)QLibrary::resolve(GTK_PATH, 0, "gtk_widget_get_type");
- QGtk::gtk_rc_get_style_by_paths =(Ptr_gtk_rc_get_style_by_paths)QLibrary::resolve(GTK_PATH, 0, "gtk_rc_get_style_by_paths");
- QGtk::gtk_check_version =(Ptr_gtk_check_version)QLibrary::resolve(GTK_PATH, 0, "gtk_check_version");
- QGtk::pango_font_description_get_size = (Ptr_pango_font_description_get_size)QLibrary::resolve(GTK_PATH, 0, "pango_font_description_get_size");
- QGtk::pango_font_description_get_weight = (Ptr_pango_font_description_get_weight)QLibrary::resolve(GTK_PATH, 0, "pango_font_description_get_weight");
- QGtk::pango_font_description_get_family = (Ptr_pango_font_description_get_family)QLibrary::resolve(GTK_PATH, 0, "pango_font_description_get_family");
- QGtk::pango_font_description_get_style = (Ptr_pango_font_description_get_style)QLibrary::resolve(GTK_PATH, 0, "pango_font_description_get_style");
+ QLibrary libgtk(QLS("gtk-x11-2.0"));
+ QGtk::gtk_init = (Ptr_gtk_init)libgtk.resolve("gtk_init");
+ QGtk::gtk_window_new = (Ptr_gtk_window_new)libgtk.resolve("gtk_window_new");
+ QGtk::gtk_style_attach = (Ptr_gtk_style_attach)libgtk.resolve("gtk_style_attach");
+ QGtk::gtk_widget_destroy = (Ptr_gtk_widget_destroy)libgtk.resolve("gtk_widget_destroy");
+ QGtk::gtk_widget_realize = (Ptr_gtk_widget_realize)libgtk.resolve("gtk_widget_realize");
+
+ QGtk::gtk_file_chooser_set_current_folder = (Ptr_gtk_file_chooser_set_current_folder)libgtk.resolve("gtk_file_chooser_set_current_folder");
+ QGtk::gtk_file_filter_new = (Ptr_gtk_file_filter_new)libgtk.resolve("gtk_file_filter_new");
+ QGtk::gtk_file_filter_set_name = (Ptr_gtk_file_filter_set_name)libgtk.resolve("gtk_file_filter_set_name");
+ QGtk::gtk_file_filter_add_pattern = (Ptr_gtk_file_filter_add_pattern)libgtk.resolve("gtk_file_filter_add_pattern");
+ QGtk::gtk_file_chooser_add_filter = (Ptr_gtk_file_chooser_add_filter)libgtk.resolve("gtk_file_chooser_add_filter");
+ QGtk::gtk_file_chooser_set_filter = (Ptr_gtk_file_chooser_set_filter)libgtk.resolve("gtk_file_chooser_set_filter");
+ QGtk::gtk_file_chooser_get_filter = (Ptr_gtk_file_chooser_get_filter)libgtk.resolve("gtk_file_chooser_get_filter");
+ QGtk::gtk_file_chooser_dialog_new = (Ptr_gtk_file_chooser_dialog_new)libgtk.resolve("gtk_file_chooser_dialog_new");
+ QGtk::gtk_file_chooser_set_current_folder = (Ptr_gtk_file_chooser_set_current_folder)libgtk.resolve("gtk_file_chooser_set_current_folder");
+ QGtk::gtk_file_chooser_get_filename = (Ptr_gtk_file_chooser_get_filename)libgtk.resolve("gtk_file_chooser_get_filename");
+ QGtk::gtk_file_chooser_get_filenames = (Ptr_gtk_file_chooser_get_filenames)libgtk.resolve("gtk_file_chooser_get_filenames");
+ QGtk::gtk_file_chooser_set_current_name = (Ptr_gtk_file_chooser_set_current_name)libgtk.resolve("gtk_file_chooser_set_current_name");
+ QGtk::gtk_dialog_run = (Ptr_gtk_dialog_run)libgtk.resolve("gtk_dialog_run");
+ QGtk::gtk_file_chooser_set_filename = (Ptr_gtk_file_chooser_set_filename)libgtk.resolve("gtk_file_chooser_set_filename");
+
+ QGtk::gdk_pixbuf_get_pixels = (Ptr_gdk_pixbuf_get_pixels)libgtk.resolve("gdk_pixbuf_get_pixels");
+ QGtk::gdk_pixbuf_get_width = (Ptr_gdk_pixbuf_get_width)libgtk.resolve("gdk_pixbuf_get_width");
+ QGtk::gdk_pixbuf_get_height = (Ptr_gdk_pixbuf_get_height)libgtk.resolve("gdk_pixbuf_get_height");
+ QGtk::gdk_pixmap_new = (Ptr_gdk_pixmap_new)libgtk.resolve("gdk_pixmap_new");
+ QGtk::gdk_pixbuf_new = (Ptr_gdk_pixbuf_new)libgtk.resolve("gdk_pixbuf_new");
+ QGtk::gdk_pixbuf_get_from_drawable = (Ptr_gdk_pixbuf_get_from_drawable)libgtk.resolve("gdk_pixbuf_get_from_drawable");
+ QGtk::gdk_draw_rectangle = (Ptr_gdk_draw_rectangle)libgtk.resolve("gdk_draw_rectangle");
+ QGtk::gdk_pixbuf_unref = (Ptr_gdk_pixbuf_unref)libgtk.resolve("gdk_pixbuf_unref");
+ QGtk::gdk_drawable_unref = (Ptr_gdk_drawable_unref)libgtk.resolve("gdk_drawable_unref");
+ QGtk::gdk_drawable_get_depth = (Ptr_gdk_drawable_get_depth)libgtk.resolve("gdk_drawable_get_depth");
+ QGtk::gdk_color_free = (Ptr_gdk_color_free)libgtk.resolve("gdk_color_free");
+ QGtk::gdk_x11_window_set_user_time = (Ptr_gdk_x11_window_set_user_time)libgtk.resolve("gdk_x11_window_set_user_time");
+ QGtk::gdk_x11_drawable_get_xid = (Ptr_gdk_x11_drawable_get_xid)libgtk.resolve("gdk_x11_drawable_get_xid");
+ QGtk::gdk_x11_drawable_get_xdisplay = (Ptr_gdk_x11_drawable_get_xdisplay)libgtk.resolve("gdk_x11_drawable_get_xdisplay");
+
+ QGtk::gtk_widget_set_default_direction = (Ptr_gtk_widget_set_default_direction)libgtk.resolve("gtk_widget_set_default_direction");
+ QGtk::gtk_widget_modify_fg = (Ptr_gtk_widget_modify_color)libgtk.resolve("gtk_widget_modify_fg");
+ QGtk::gtk_widget_modify_bg = (Ptr_gtk_widget_modify_color)libgtk.resolve("gtk_widget_modify_bg");
+ QGtk::gtk_arrow_new = (Ptr_gtk_arrow_new)libgtk.resolve("gtk_arrow_new");
+ QGtk::gtk_menu_item_new = (Ptr_gtk_menu_item_new)libgtk.resolve("gtk_menu_item_new");
+ QGtk::gtk_check_menu_item_new = (Ptr_gtk_check_menu_item_new)libgtk.resolve("gtk_check_menu_item_new");
+ QGtk::gtk_menu_bar_new = (Ptr_gtk_menu_bar_new)libgtk.resolve("gtk_menu_bar_new");
+ QGtk::gtk_menu_new = (Ptr_gtk_menu_new)libgtk.resolve("gtk_menu_new");
+ QGtk::gtk_toolbar_new = (Ptr_gtk_toolbar_new)libgtk.resolve("gtk_toolbar_new");
+ QGtk::gtk_separator_tool_item_new = (Ptr_gtk_separator_tool_item_new)libgtk.resolve("gtk_separator_tool_item_new");
+ QGtk::gtk_toolbar_insert = (Ptr_gtk_toolbar_insert)libgtk.resolve("gtk_toolbar_insert");
+ QGtk::gtk_button_new = (Ptr_gtk_button_new)libgtk.resolve("gtk_button_new");
+ QGtk::gtk_hbutton_box_new = (Ptr_gtk_hbutton_box_new)libgtk.resolve("gtk_hbutton_box_new");
+ QGtk::gtk_check_button_new = (Ptr_gtk_check_button_new)libgtk.resolve("gtk_check_button_new");
+ QGtk::gtk_radio_button_new = (Ptr_gtk_radio_button_new)libgtk.resolve("gtk_radio_button_new");
+ QGtk::gtk_notebook_new = (Ptr_gtk_notebook_new)libgtk.resolve("gtk_notebook_new");
+ QGtk::gtk_progress_bar_new = (Ptr_gtk_progress_bar_new)libgtk.resolve("gtk_progress_bar_new");
+ QGtk::gtk_spin_button_new = (Ptr_gtk_spin_button_new)libgtk.resolve("gtk_spin_button_new");
+ QGtk::gtk_hscale_new = (Ptr_gtk_hscale_new)libgtk.resolve("gtk_hscale_new");
+ QGtk::gtk_vscale_new = (Ptr_gtk_vscale_new)libgtk.resolve("gtk_vscale_new");
+ QGtk::gtk_hscrollbar_new = (Ptr_gtk_hscrollbar_new)libgtk.resolve("gtk_hscrollbar_new");
+ QGtk::gtk_vscrollbar_new = (Ptr_gtk_vscrollbar_new)libgtk.resolve("gtk_vscrollbar_new");
+ QGtk::gtk_scrolled_window_new = (Ptr_gtk_scrolled_window_new)libgtk.resolve("gtk_scrolled_window_new");
+ QGtk::gtk_menu_shell_append = (Ptr_gtk_menu_shell_append)libgtk.resolve("gtk_menu_shell_append");
+ QGtk::gtk_entry_new = (Ptr_gtk_entry_new)libgtk.resolve("gtk_entry_new");
+ QGtk::gtk_tree_view_new = (Ptr_gtk_tree_view_new)libgtk.resolve("gtk_tree_view_new");
+ QGtk::gtk_combo_box_new = (Ptr_gtk_combo_box_new)libgtk.resolve("gtk_combo_box_new");
+ QGtk::gtk_progress_set_adjustment = (Ptr_gtk_progress_set_adjustment)libgtk.resolve("gtk_progress_set_adjustment");
+ QGtk::gtk_range_set_adjustment = (Ptr_gtk_range_set_adjustment)libgtk.resolve("gtk_range_set_adjustment");
+ QGtk::gtk_range_set_inverted = (Ptr_gtk_range_set_inverted)libgtk.resolve("gtk_range_set_inverted");
+ QGtk::gtk_container_add = (Ptr_gtk_container_add)libgtk.resolve("gtk_container_add");
+ QGtk::gtk_icon_factory_lookup_default = (Ptr_gtk_icon_factory_lookup_default)libgtk.resolve("gtk_icon_factory_lookup_default");
+ QGtk::gtk_widget_style_get = (Ptr_gtk_widget_style_get)libgtk.resolve("gtk_widget_style_get");
+ QGtk::gtk_icon_set_render_icon = (Ptr_gtk_icon_set_render_icon)libgtk.resolve("gtk_icon_set_render_icon");
+ QGtk::gtk_fixed_new = (Ptr_gtk_fixed_new)libgtk.resolve("gtk_fixed_new");
+ QGtk::gtk_tree_view_column_new = (Ptr_gtk_tree_view_column_new)libgtk.resolve("gtk_tree_view_column_new");
+ QGtk::gtk_tree_view_append_column= (Ptr_gtk_tree_view_append_column )libgtk.resolve("gtk_tree_view_append_column");
+ QGtk::gtk_tree_view_get_column = (Ptr_gtk_tree_view_get_column )libgtk.resolve("gtk_tree_view_get_column");
+ QGtk::gtk_paint_check = (Ptr_gtk_paint_check)libgtk.resolve("gtk_paint_check");
+ QGtk::gtk_paint_box = (Ptr_gtk_paint_box)libgtk.resolve("gtk_paint_box");
+ QGtk::gtk_paint_flat_box = (Ptr_gtk_paint_flat_box)libgtk.resolve("gtk_paint_flat_box");
+ QGtk::gtk_paint_check = (Ptr_gtk_paint_check)libgtk.resolve("gtk_paint_check");
+ QGtk::gtk_paint_box = (Ptr_gtk_paint_box)libgtk.resolve("gtk_paint_box");
+ QGtk::gtk_paint_resize_grip = (Ptr_gtk_paint_resize_grip)libgtk.resolve("gtk_paint_resize_grip");
+ QGtk::gtk_paint_focus = (Ptr_gtk_paint_focus)libgtk.resolve("gtk_paint_focus");
+ QGtk::gtk_paint_shadow = (Ptr_gtk_paint_shadow)libgtk.resolve("gtk_paint_shadow");
+ QGtk::gtk_paint_slider = (Ptr_gtk_paint_slider)libgtk.resolve("gtk_paint_slider");
+ QGtk::gtk_paint_expander = (Ptr_gtk_paint_expander)libgtk.resolve("gtk_paint_expander");
+ QGtk::gtk_paint_handle = (Ptr_gtk_paint_handle)libgtk.resolve("gtk_paint_handle");
+ QGtk::gtk_paint_option = (Ptr_gtk_paint_option)libgtk.resolve("gtk_paint_option");
+ QGtk::gtk_paint_arrow = (Ptr_gtk_paint_arrow)libgtk.resolve("gtk_paint_arrow");
+ QGtk::gtk_paint_box_gap = (Ptr_gtk_paint_box_gap)libgtk.resolve("gtk_paint_box_gap");
+ QGtk::gtk_paint_extension = (Ptr_gtk_paint_extension)libgtk.resolve("gtk_paint_extension");
+ QGtk::gtk_paint_hline = (Ptr_gtk_paint_hline)libgtk.resolve("gtk_paint_hline");
+ QGtk::gtk_paint_vline = (Ptr_gtk_paint_vline)libgtk.resolve("gtk_paint_vline");
+ QGtk::gtk_adjustment_new = (Ptr_gtk_adjustment_new)libgtk.resolve("gtk_adjustment_new");
+ QGtk::gtk_menu_item_set_submenu = (Ptr_gtk_menu_item_set_submenu)libgtk.resolve("gtk_menu_item_set_submenu");
+ QGtk::gtk_settings_get_default = (Ptr_gtk_settings_get_default)libgtk.resolve("gtk_settings_get_default");
+ QGtk::gtk_separator_menu_item_new = (Ptr_gtk_separator_menu_item_new)libgtk.resolve("gtk_separator_menu_item_new");
+ QGtk::gtk_frame_new = (Ptr_gtk_frame_new)libgtk.resolve("gtk_frame_new");
+ QGtk::gtk_expander_new = (Ptr_gtk_expander_new)libgtk.resolve("gtk_expander_new");
+ QGtk::gtk_statusbar_new = (Ptr_gtk_statusbar_new)libgtk.resolve("gtk_statusbar_new");
+ QGtk::gtk_combo_box_entry_new = (Ptr_gtk_combo_box_entry_new)libgtk.resolve("gtk_combo_box_entry_new");
+ QGtk::gtk_container_forall = (Ptr_gtk_container_forall)libgtk.resolve("gtk_container_forall");
+ QGtk::gtk_widget_size_allocate =(Ptr_gtk_widget_size_allocate)libgtk.resolve("gtk_widget_size_allocate");
+ QGtk::gtk_widget_set_direction =(Ptr_gtk_widget_set_direction)libgtk.resolve("gtk_widget_set_direction");
+ QGtk::gtk_widget_path =(Ptr_gtk_widget_path)libgtk.resolve("gtk_widget_path");
+ QGtk::gtk_container_get_type =(Ptr_gtk_container_get_type)libgtk.resolve("gtk_container_get_type");
+ QGtk::gtk_window_get_type =(Ptr_gtk_window_get_type)libgtk.resolve("gtk_window_get_type");
+ QGtk::gtk_widget_get_type =(Ptr_gtk_widget_get_type)libgtk.resolve("gtk_widget_get_type");
+ QGtk::gtk_rc_get_style_by_paths =(Ptr_gtk_rc_get_style_by_paths)libgtk.resolve("gtk_rc_get_style_by_paths");
+ QGtk::gtk_check_version =(Ptr_gtk_check_version)libgtk.resolve("gtk_check_version");
+ QGtk::pango_font_description_get_size = (Ptr_pango_font_description_get_size)libgtk.resolve("pango_font_description_get_size");
+ QGtk::pango_font_description_get_weight = (Ptr_pango_font_description_get_weight)libgtk.resolve("pango_font_description_get_weight");
+ QGtk::pango_font_description_get_family = (Ptr_pango_font_description_get_family)libgtk.resolve("pango_font_description_get_family");
+ QGtk::pango_font_description_get_style = (Ptr_pango_font_description_get_style)libgtk.resolve("pango_font_description_get_style");
}
void QGtk::cleanup_gtk_widgets()
@@ -332,15 +337,16 @@ static bool resolveGConf()
if (!QGtk::gconf_client_get_default) {
QGtk::gconf_client_get_default = (Ptr_gconf_client_get_default)QLibrary::resolve(QLS("gconf-2"), 4, "gconf_client_get_default");
QGtk::gconf_client_get_string = (Ptr_gconf_client_get_string)QLibrary::resolve(QLS("gconf-2"), 4, "gconf_client_get_string");
+ QGtk::gconf_client_get_bool = (Ptr_gconf_client_get_bool)QLibrary::resolve(QLS("gconf-2"), 4, "gconf_client_get_bool");
}
return (QGtk::gconf_client_get_default !=0);
}
typedef int (*x11ErrorHandler)(Display*, XErrorEvent*);
-static QString getGConfString(const QString &value)
+QString QGtk::getGConfString(const QString &value, const QString &fallback)
{
- QString retVal;
+ QString retVal = fallback;
if (resolveGConf()) {
g_type_init();
GConfClient* client = QGtk::gconf_client_get_default();
@@ -357,6 +363,23 @@ static QString getGConfString(const QString &value)
return retVal;
}
+bool QGtk::getGConfBool(const QString &key, bool fallback)
+{
+ bool retVal = fallback;
+ if (resolveGConf()) {
+ g_type_init();
+ GConfClient* client = QGtk::gconf_client_get_default();
+ GError *err = 0;
+ bool result = QGtk::gconf_client_get_bool(client, qPrintable(key), &err);
+ g_object_unref(client);
+ if (!err)
+ retVal = result;
+ else
+ g_error_free (err);
+ }
+ return retVal;
+}
+
static QString getThemeName()
{
QString themeName;
@@ -374,8 +397,8 @@ static QString getThemeName()
while(!in.atEnd()) {
QString line = in.readLine();
if (line.contains(QLS("gtk-theme-name"))) {
- line = line.right(line.length() - line.indexOf(QLS("=")) - 1);
- line.remove(QLS("\""));
+ line = line.right(line.length() - line.indexOf(QLatin1Char('=')) - 1);
+ line.remove(QLatin1Char('\"'));
line = line.trimmed();
themeName = line;
break;
@@ -390,7 +413,7 @@ static QString getThemeName()
// Fall back to gconf
if (themeName.isEmpty() && resolveGConf())
- themeName = getGConfString(QLS("/desktop/gnome/interface/gtk_theme"));
+ themeName = QGtk::getGConfString(QLS("/desktop/gnome/interface/gtk_theme"));
return themeName;
}
@@ -543,9 +566,13 @@ void QGtkStyleUpdateScheduler::updateTheme()
{
static QString oldTheme(QLS("qt_not_set"));
QPixmapCache::clear();
+
+ QFont font = QGtk::getThemeFont();
+ if (QApplication::font() != font)
+ qApp->setFont(font);
+
if (oldTheme != getThemeName()) {
oldTheme = getThemeName();
- qApp->setFont(QGtk::getThemeFont());
QPalette newPalette = qApp->style()->standardPalette();
QApplicationPrivate::setSystemPalette(newPalette);
QApplication::setPalette(newPalette);
@@ -558,6 +585,7 @@ void QGtkStyleUpdateScheduler::updateTheme()
QApplication::sendEvent(widget, &e);
}
}
+ QIconLoader::instance()->updateSystemTheme();
}
static void add_widget(GtkWidget *widget)
@@ -633,6 +661,20 @@ GtkStyle* QGtk::gtkStyle(const QString &path)
return 0;
}
+static void update_toolbar_style(GtkWidget *gtkToolBar, GParamSpec *, gpointer)
+{
+ GtkToolbarStyle toolbar_style = GTK_TOOLBAR_ICONS;
+ g_object_get(gtkToolBar, "toolbar-style", &toolbar_style, NULL);
+ QWidgetList widgets = QApplication::allWidgets();
+ for (int i = 0; i < widgets.size(); ++i) {
+ QWidget *widget = widgets.at(i);
+ if (qobject_cast<QToolButton*>(widget)) {
+ QEvent event(QEvent::StyleChange);
+ QApplication::sendEvent(widget, &event);
+ }
+ }
+}
+
void QGtk::initGtkWidgets()
{
// From gtkmain.c
@@ -679,6 +721,7 @@ void QGtk::initGtkWidgets()
add_widget(QGtk::gtk_spin_button_new((GtkAdjustment*)
(QGtk::gtk_adjustment_new(1, 0, 1, 0, 0, 0)), 0.1, 3));
GtkWidget *toolbar = QGtk::gtk_toolbar_new();
+ g_signal_connect (toolbar, "notify::toolbar-style", G_CALLBACK (update_toolbar_style), toolbar);
QGtk::gtk_toolbar_insert((GtkToolbar*)toolbar, QGtk::gtk_separator_tool_item_new(), -1);
add_widget(toolbar);
init_gtk_treeview();
@@ -695,7 +738,7 @@ void QGtk::initGtkWidgets()
QHashIterator<QString, GtkWidget*> it(oldMap);
while (it.hasNext()) {
it.next();
- if (!it.key().contains(QLS("."))) {
+ if (!it.key().contains(QLatin1Char('.'))) {
add_all_sub_widgets(it.value());
}
}
@@ -720,7 +763,8 @@ extern QStringList qt_make_filter_list(const QString &filter);
static void setupGtkFileChooser(GtkWidget* gtkFileChooser, QWidget *parent,
const QString &dir, const QString &filter, QString *selectedFilter,
- QFileDialog::Options options, bool isSaveDialog = false)
+ QFileDialog::Options options, bool isSaveDialog = false,
+ QMap<GtkFileFilter *, QString> *filterMap = 0)
{
g_object_set(gtkFileChooser, "do-overwrite-confirmation", gboolean(!(options & QFileDialog::DontConfirmOverwrite)), NULL);
g_object_set(gtkFileChooser, "local_only", gboolean(true), NULL);
@@ -752,6 +796,8 @@ static void setupGtkFileChooser(GtkWidget* gtkFileChooser, QWidget *parent,
QGtk::gtk_file_filter_add_pattern (gtkFilter, qPrintable(caseInsensitive));
}
+ if (filterMap)
+ filterMap->insert(gtkFilter, rawfilter);
QGtk::gtk_file_chooser_add_filter((GtkFileChooser*)gtkFileChooser, gtkFilter);
if (selectedFilter && (rawfilter == *selectedFilter))
QGtk::gtk_file_chooser_set_filter((GtkFileChooser*)gtkFileChooser, gtkFilter);
@@ -788,7 +834,7 @@ static void setupGtkFileChooser(GtkWidget* gtkFileChooser, QWidget *parent,
QString QGtk::openFilename(QWidget *parent, const QString &caption, const QString &dir, const QString &filter,
QString *selectedFilter, QFileDialog::Options options)
{
-
+ QMap<GtkFileFilter *, QString> filterMap;
GtkWidget *gtkFileChooser = QGtk::gtk_file_chooser_dialog_new (qPrintable(caption),
NULL,
GTK_FILE_CHOOSER_ACTION_OPEN,
@@ -796,7 +842,7 @@ QString QGtk::openFilename(QWidget *parent, const QString &caption, const QStrin
GTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT,
NULL);
- setupGtkFileChooser(gtkFileChooser, parent, dir, filter, selectedFilter, options);
+ setupGtkFileChooser(gtkFileChooser, parent, dir, filter, selectedFilter, options, false, &filterMap);
QWidget modal_widget;
modal_widget.setAttribute(Qt::WA_NoChildEventsForParent, true);
@@ -808,6 +854,10 @@ QString QGtk::openFilename(QWidget *parent, const QString &caption, const QStrin
char *gtk_filename = QGtk::gtk_file_chooser_get_filename ((GtkFileChooser*)gtkFileChooser);
filename = QString::fromUtf8(gtk_filename);
g_free (gtk_filename);
+ if (selectedFilter) {
+ GtkFileFilter *gtkFilter = QGtk::gtk_file_chooser_get_filter ((GtkFileChooser*)gtkFileChooser);
+ *selectedFilter = filterMap.value(gtkFilter);
+ }
}
QApplicationPrivate::leaveModal(&modal_widget);
@@ -818,6 +868,7 @@ QString QGtk::openFilename(QWidget *parent, const QString &caption, const QStrin
QString QGtk::openDirectory(QWidget *parent, const QString &caption, const QString &dir, QFileDialog::Options options)
{
+ QMap<GtkFileFilter *, QString> filterMap;
GtkWidget *gtkFileChooser = QGtk::gtk_file_chooser_dialog_new (qPrintable(caption),
NULL,
GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER,
@@ -847,6 +898,7 @@ QStringList QGtk::openFilenames(QWidget *parent, const QString &caption, const Q
QString *selectedFilter, QFileDialog::Options options)
{
QStringList filenames;
+ QMap<GtkFileFilter *, QString> filterMap;
GtkWidget *gtkFileChooser = QGtk::gtk_file_chooser_dialog_new (qPrintable(caption),
NULL,
GTK_FILE_CHOOSER_ACTION_OPEN,
@@ -854,7 +906,7 @@ QStringList QGtk::openFilenames(QWidget *parent, const QString &caption, const Q
GTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT,
NULL);
- setupGtkFileChooser(gtkFileChooser, parent, dir, filter, selectedFilter, options);
+ setupGtkFileChooser(gtkFileChooser, parent, dir, filter, selectedFilter, options, false, &filterMap);
g_object_set(gtkFileChooser, "select-multiple", gboolean(true), NULL);
QWidget modal_widget;
@@ -867,6 +919,10 @@ QStringList QGtk::openFilenames(QWidget *parent, const QString &caption, const Q
for (GSList *iterator = gtk_file_names ; iterator; iterator = iterator->next)
filenames << QString::fromUtf8((const char*)iterator->data);
g_slist_free(gtk_file_names);
+ if (selectedFilter) {
+ GtkFileFilter *gtkFilter = QGtk::gtk_file_chooser_get_filter ((GtkFileChooser*)gtkFileChooser);
+ *selectedFilter = filterMap.value(gtkFilter);
+ }
}
QApplicationPrivate::leaveModal(&modal_widget);
@@ -877,13 +933,14 @@ QStringList QGtk::openFilenames(QWidget *parent, const QString &caption, const Q
QString QGtk::saveFilename(QWidget *parent, const QString &caption, const QString &dir, const QString &filter,
QString *selectedFilter, QFileDialog::Options options)
{
+ QMap<GtkFileFilter *, QString> filterMap;
GtkWidget *gtkFileChooser = QGtk::gtk_file_chooser_dialog_new (qPrintable(caption),
NULL,
GTK_FILE_CHOOSER_ACTION_SAVE,
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
GTK_STOCK_SAVE, GTK_RESPONSE_ACCEPT,
NULL);
- setupGtkFileChooser(gtkFileChooser, parent, dir, filter, selectedFilter, options, true);
+ setupGtkFileChooser(gtkFileChooser, parent, dir, filter, selectedFilter, options, true, &filterMap);
QWidget modal_widget;
modal_widget.setAttribute(Qt::WA_NoChildEventsForParent, true);
@@ -895,6 +952,10 @@ QString QGtk::saveFilename(QWidget *parent, const QString &caption, const QStrin
char *gtk_filename = QGtk::gtk_file_chooser_get_filename ((GtkFileChooser*)gtkFileChooser);
filename = QString::fromUtf8(gtk_filename);
g_free (gtk_filename);
+ if (selectedFilter) {
+ GtkFileFilter *gtkFilter = QGtk::gtk_file_chooser_get_filter ((GtkFileChooser*)gtkFileChooser);
+ *selectedFilter = filterMap.value(gtkFilter);
+ }
}
QApplicationPrivate::leaveModal(&modal_widget);
diff --git a/src/gui/styles/gtksymbols_p.h b/src/gui/styles/gtksymbols_p.h
index 906fbde..fb9d129 100644
--- a/src/gui/styles/gtksymbols_p.h
+++ b/src/gui/styles/gtksymbols_p.h
@@ -1,7 +1,6 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the QtGui module of the Qt Toolkit.
@@ -21,9 +20,10 @@
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.1, included in the file LGPL_EXCEPTION.txt in this
+** package.
**
** If you have questions regarding the use of this file, please contact
** Nokia at qt-info@nokia.com.
@@ -77,6 +77,7 @@ class GConfClient;
typedef GConfClient* (*Ptr_gconf_client_get_default)();
typedef char* (*Ptr_gconf_client_get_string)(GConfClient*, const char*, GError **);
+typedef bool (*Ptr_gconf_client_get_bool)(GConfClient*, const char*, GError **);
typedef void (*Ptr_gtk_init)(int *, char ***);
typedef GtkWidget* (*Ptr_gtk_window_new) (GtkWindowType);
@@ -162,6 +163,7 @@ typedef void (*Ptr_gtk_file_filter_set_name)(GtkFileFilter *, const gchar *);
typedef void (*Ptr_gtk_file_filter_add_pattern)(GtkFileFilter *filter, const gchar *pattern);
typedef void (*Ptr_gtk_file_chooser_add_filter)(GtkFileChooser *chooser, GtkFileFilter *filter);
typedef void (*Ptr_gtk_file_chooser_set_filter)(GtkFileChooser *chooser, GtkFileFilter *filter);
+typedef GtkFileFilter* (*Ptr_gtk_file_chooser_get_filter)(GtkFileChooser *chooser);
typedef gchar* (*Ptr_gtk_file_chooser_get_filename)(GtkFileChooser *chooser);
typedef GSList* (*Ptr_gtk_file_chooser_get_filenames)(GtkFileChooser *chooser);
typedef GtkWidget* (*Ptr_gtk_file_chooser_dialog_new)(const gchar *title,
@@ -215,6 +217,8 @@ public:
static QString openDirectory(QWidget *parent, const QString &caption, const QString &dir, QFileDialog::Options options);
static QStringList openFilenames(QWidget *parent, const QString &caption, const QString &dir, const QString &filter,
QString *selectedFilter, QFileDialog::Options options);
+ static QString getGConfString(const QString &key, const QString &fallback = QString());
+ static bool getGConfBool(const QString &key, bool fallback = 0);
static Ptr_gtk_container_forall gtk_container_forall;
static Ptr_gtk_init gtk_init;
@@ -302,6 +306,7 @@ public:
static Ptr_gtk_file_filter_add_pattern gtk_file_filter_add_pattern;
static Ptr_gtk_file_chooser_add_filter gtk_file_chooser_add_filter;
static Ptr_gtk_file_chooser_set_filter gtk_file_chooser_set_filter;
+ static Ptr_gtk_file_chooser_get_filter gtk_file_chooser_get_filter;
static Ptr_gtk_file_chooser_dialog_new gtk_file_chooser_dialog_new;
static Ptr_gtk_file_chooser_set_current_folder gtk_file_chooser_set_current_folder;
static Ptr_gtk_file_chooser_get_filename gtk_file_chooser_get_filename;
@@ -327,6 +332,7 @@ public:
static Ptr_gconf_client_get_default gconf_client_get_default;
static Ptr_gconf_client_get_string gconf_client_get_string;
+ static Ptr_gconf_client_get_bool gconf_client_get_bool;
};
// Helper to ensure that we have polished all our gtk widgets
diff --git a/src/gui/styles/images/defaults60theme.blob b/src/gui/styles/images/defaults60theme.blob
new file mode 100644
index 0000000..f3a5952
--- /dev/null
+++ b/src/gui/styles/images/defaults60theme.blob
Binary files differ
diff --git a/src/gui/styles/qcdestyle.cpp b/src/gui/styles/qcdestyle.cpp
index 5d70d6a..f5d3dc2 100644
--- a/src/gui/styles/qcdestyle.cpp
+++ b/src/gui/styles/qcdestyle.cpp
@@ -1,7 +1,6 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the QtGui module of the Qt Toolkit.
@@ -21,9 +20,10 @@
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.1, included in the file LGPL_EXCEPTION.txt in this
+** package.
**
** If you have questions regarding the use of this file, please contact
** Nokia at qt-info@nokia.com.
diff --git a/src/gui/styles/qcdestyle.h b/src/gui/styles/qcdestyle.h
index b3b620e..ff8d59c 100644
--- a/src/gui/styles/qcdestyle.h
+++ b/src/gui/styles/qcdestyle.h
@@ -1,7 +1,6 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the QtGui module of the Qt Toolkit.
@@ -21,9 +20,10 @@
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.1, included in the file LGPL_EXCEPTION.txt in this
+** package.
**
** If you have questions regarding the use of this file, please contact
** Nokia at qt-info@nokia.com.
diff --git a/src/gui/styles/qcleanlooksstyle.cpp b/src/gui/styles/qcleanlooksstyle.cpp
index 92ef1c1..20f1d26 100644
--- a/src/gui/styles/qcleanlooksstyle.cpp
+++ b/src/gui/styles/qcleanlooksstyle.cpp
@@ -1,7 +1,6 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the QtGui module of the Qt Toolkit.
@@ -21,9 +20,10 @@
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.1, included in the file LGPL_EXCEPTION.txt in this
+** package.
**
** If you have questions regarding the use of this file, please contact
** Nokia at qt-info@nokia.com.
@@ -44,6 +44,7 @@
#if !defined(QT_NO_STYLE_CLEANLOOKS) || defined(QT_PLUGIN)
+#include <private/qstylehelper_p.h>
#include "qwindowsstyle_p.h"
#include <qcombobox.h>
#include <qpushbutton.h>
@@ -72,7 +73,7 @@
QT_BEGIN_NAMESPACE
-static const bool UsePixmapCache = true;
+using namespace QStyleHelper;
enum Direction {
TopDown,
@@ -83,14 +84,9 @@ enum Direction {
// from windows style
static const int windowsItemFrame = 2; // menu item frame width
-static const int windowsSepHeight = 6; // separator item height
static const int windowsItemHMargin = 3; // menu item hor text margin
static const int windowsItemVMargin = 8; // menu item ver text margin
-static const int windowsArrowHMargin = 6; // arrow horizontal margin
-static const int windowsTabSpacing = 12; // space between text and tab
-static const int windowsCheckMarkHMargin = 2; // horiz. margins of check mark
static const int windowsRightBorder = 15; // right border on windows
-static const int windowsCheckMarkWidth = 12; // checkmarks width on windows
/* XPM */
static const char * const dock_widget_close_xpm[] = {
@@ -461,26 +457,6 @@ static const char * const qt_cleanlooks_checkbox_checked[] = {
" ",
" "};
-#ifdef Q_WS_X11
-extern "C" {
- struct GConfClient;
- struct GError;
- typedef void (*Ptr_g_type_init)();
- typedef GConfClient* (*Ptr_gconf_client_get_default)();
- typedef char* (*Ptr_gconf_client_get_string)(GConfClient*, const char*, GError **);
- typedef void (*Ptr_g_object_unref)(void *);
- typedef void (*Ptr_g_error_free)(GError *);
- typedef void (*Ptr_g_free)(void*);
-}
-
-static Ptr_g_type_init p_g_type_init = 0;
-static Ptr_gconf_client_get_default p_gconf_client_get_default = 0;
-static Ptr_gconf_client_get_string p_gconf_client_get_string = 0;
-static Ptr_g_object_unref p_g_object_unref = 0;
-static Ptr_g_error_free p_g_error_free = 0;
-static Ptr_g_free p_g_free = 0;
-#endif
-
static void qt_cleanlooks_draw_gradient(QPainter *painter, const QRect &rect, const QColor &gradientStart,
const QColor &gradientStop, Direction direction = TopDown, QBrush bgBrush = QBrush())
{
@@ -553,26 +529,6 @@ static void qt_cleanlooks_draw_buttongradient(QPainter *painter, const QRect &re
delete gradient;
}
-static QString uniqueName(const QString &key, const QStyleOption *option, const QSize &size)
-{
- QString tmp;
- const QStyleOptionComplex *complexOption = qstyleoption_cast<const QStyleOptionComplex *>(option);
- tmp.sprintf("%s-%d-%d-%lld-%dx%d-%d", key.toLatin1().constData(), uint(option->state),
- complexOption ? uint(complexOption->activeSubControls) : uint(0),
- option->palette.cacheKey(), size.width(), size.height(), option->direction);
-#ifndef QT_NO_SPINBOX
- if (const QStyleOptionSpinBox *spinBox = qstyleoption_cast<const QStyleOptionSpinBox *>(option)) {
- tmp.append(QLatin1Char('-'));
- tmp.append(QString::number(spinBox->buttonSymbols));
- tmp.append(QLatin1Char('-'));
- tmp.append(QString::number(spinBox->stepEnabled));
- tmp.append(QLatin1Char('-'));
- tmp.append(QLatin1Char(spinBox->frame ? '1' : '0'));
- }
-#endif // QT_NO_SPINBOX
- return tmp;
-}
-
static void qt_cleanlooks_draw_mdibutton(QPainter *painter, const QStyleOptionTitleBar *option, const QRect &tmp, bool hover, bool sunken)
{
QColor dark;
@@ -605,14 +561,20 @@ static void qt_cleanlooks_draw_mdibutton(QPainter *painter, const QStyleOptionTi
QColor mdiButtonBorderColor(active ? option->palette.highlight().color().darker(180): dark.darker(110));
painter->setPen(QPen(mdiButtonBorderColor, 1));
- painter->drawLine(tmp.left() + 2, tmp.top(), tmp.right() - 2, tmp.top());
- painter->drawLine(tmp.left() + 2, tmp.bottom(), tmp.right() - 2, tmp.bottom());
- painter->drawLine(tmp.left(), tmp.top() + 2, tmp.left(), tmp.bottom() - 2);
- painter->drawLine(tmp.right(), tmp.top() + 2, tmp.right(), tmp.bottom() - 2);
- painter->drawPoint(tmp.left() + 1, tmp.top() + 1);
- painter->drawPoint(tmp.right() - 1, tmp.top() + 1);
- painter->drawPoint(tmp.left() + 1, tmp.bottom() - 1);
- painter->drawPoint(tmp.right() - 1, tmp.bottom() - 1);
+ const QLine lines[4] = {
+ QLine(tmp.left() + 2, tmp.top(), tmp.right() - 2, tmp.top()),
+ QLine(tmp.left() + 2, tmp.bottom(), tmp.right() - 2, tmp.bottom()),
+ QLine(tmp.left(), tmp.top() + 2, tmp.left(), tmp.bottom() - 2),
+ QLine(tmp.right(), tmp.top() + 2, tmp.right(), tmp.bottom() - 2)
+ };
+ painter->drawLines(lines, 4);
+ const QPoint points[4] = {
+ QPoint(tmp.left() + 1, tmp.top() + 1),
+ QPoint(tmp.right() - 1, tmp.top() + 1),
+ QPoint(tmp.left() + 1, tmp.bottom() - 1),
+ QPoint(tmp.right() - 1, tmp.bottom() - 1)
+ };
+ painter->drawPoints(points, 4);
painter->setPen(titleBarHighlight);
painter->drawLine(tmp.left() + 2, tmp.top() + 1, tmp.right() - 2, tmp.top() + 1);
@@ -782,7 +744,7 @@ void QCleanlooksStyle::drawPrimitive(PrimitiveElement elem,
QStyleOptionButton button;
button.QStyleOption::operator=(*option);
button.state &= ~State_MouseOver;
- drawPrimitive(PE_IndicatorCheckBox, &button, painter, widget);
+ proxy()->drawPrimitive(PE_IndicatorCheckBox, &button, painter, widget);
}
return;
case PE_IndicatorHeaderArrow:
@@ -802,7 +764,7 @@ void QCleanlooksStyle::drawPrimitive(PrimitiveElement elem,
}
break;
case PE_IndicatorButtonDropDown:
- drawPrimitive(PE_PanelButtonCommand, option, painter, widget);
+ proxy()->drawPrimitive(PE_PanelButtonCommand, option, painter, widget);
break;
case PE_IndicatorToolBarSeparator:
{
@@ -887,9 +849,9 @@ void QCleanlooksStyle::drawPrimitive(PrimitiveElement elem,
if (widget && widget->inherits("QDockWidgetTitleButton")) {
if (option->state & State_MouseOver)
- drawPrimitive(PE_PanelButtonCommand, option, painter, widget);
+ proxy()->drawPrimitive(PE_PanelButtonCommand, option, painter, widget);
} else {
- drawPrimitive(PE_PanelButtonCommand, option, painter, widget);
+ proxy()->drawPrimitive(PE_PanelButtonCommand, option, painter, widget);
}
}
painter->restore();
@@ -902,7 +864,7 @@ void QCleanlooksStyle::drawPrimitive(PrimitiveElement elem,
dockWidgetHandle.state &= ~State_Horizontal;
else
dockWidgetHandle.state |= State_Horizontal;
- drawControl(CE_Splitter, &dockWidgetHandle, painter, widget);
+ proxy()->drawControl(CE_Splitter, &dockWidgetHandle, painter, widget);
}
break;
case PE_FrameWindow:
@@ -928,7 +890,7 @@ void QCleanlooksStyle::drawPrimitive(PrimitiveElement elem,
#endif // QT_NO_LINEEDIT
#ifdef QT3_SUPPORT
if (widget && widget->inherits("Q3ToolBar")) {
- drawPrimitive(PE_Q3Separator, option, painter, widget);
+ proxy()->drawPrimitive(PE_Q3Separator, option, painter, widget);
break;
}
#endif
@@ -944,14 +906,17 @@ void QCleanlooksStyle::drawPrimitive(PrimitiveElement elem,
QRect r = rect.adjusted(0, 1, 0, -1);
painter->setPen(buttonShadowAlpha);
painter->drawLine(QPoint(r.left() + 2, r.top() - 1), QPoint(r.right() - 2, r.top() - 1));
- painter->drawPoint(r.right() - 1, r.top());
- painter->drawPoint(r.right(), r.top() + 1);
- painter->drawPoint(r.right() - 1, r.bottom());
- painter->drawPoint(r.right(), r.bottom() - 1);
- painter->drawPoint(r.left() + 1, r.top() );
- painter->drawPoint(r.left(), r.top() + 1);
- painter->drawPoint(r.left() + 1, r.bottom() );
- painter->drawPoint(r.left(), r.bottom() - 1);
+ const QPoint points[8] = {
+ QPoint(r.right() - 1, r.top()),
+ QPoint(r.right(), r.top() + 1),
+ QPoint(r.right() - 1, r.bottom()),
+ QPoint(r.right(), r.bottom() - 1),
+ QPoint(r.left() + 1, r.top() ),
+ QPoint(r.left(), r.top() + 1),
+ QPoint(r.left() + 1, r.bottom() ),
+ QPoint(r.left(), r.bottom() - 1)
+ };
+ painter->drawPoints(points, 8);
painter->setPen(QPen(option->palette.background().color(), 1));
painter->drawLine(QPoint(r.left() + 2, r.top() + 1), QPoint(r.right() - 2, r.top() + 1));
@@ -983,10 +948,13 @@ void QCleanlooksStyle::drawPrimitive(PrimitiveElement elem,
painter->drawLine(QPoint(r.left(), r.top() + 2), QPoint(r.left(), r.bottom() - 2));
painter->drawLine(QPoint(r.right(), r.top() + 2), QPoint(r.right(), r.bottom() - 2));
painter->drawLine(QPoint(r.left() + 2, r.bottom()), QPoint(r.right() - 2, r.bottom()));
- painter->drawPoint(QPoint(r.right() - 1, r.bottom() - 1));
- painter->drawPoint(QPoint(r.right() - 1, r.top() + 1));
- painter->drawPoint(QPoint(r.left() + 1, r.bottom() - 1));
- painter->drawPoint(QPoint(r.left() + 1, r.top() + 1));
+ const QPoint points2[4] = {
+ QPoint(r.right() - 1, r.bottom() - 1),
+ QPoint(r.right() - 1, r.top() + 1),
+ QPoint(r.left() + 1, r.bottom() - 1),
+ QPoint(r.left() + 1, r.top() + 1)
+ };
+ painter->drawPoints(points2, 4);
painter->drawLine(QPoint(r.left() + 2, r.top()), QPoint(r.right() - 2, r.top()));
painter->setPen(oldPen);
}
@@ -1084,10 +1052,13 @@ void QCleanlooksStyle::drawPrimitive(PrimitiveElement elem,
painter->setBrush(QBrush(dark.darker(120), Qt::Dense4Pattern));
painter->setBrushOrigin(rect.topLeft());
painter->setPen(Qt::NoPen);
- painter->drawRect(rect.left(), rect.top(), rect.width(), 1); // Top
- painter->drawRect(rect.left(), rect.bottom(), rect.width(), 1); // Bottom
- painter->drawRect(rect.left(), rect.top(), 1, rect.height()); // Left
- painter->drawRect(rect.right(), rect.top(), 1, rect.height()); // Right
+ const QRect rects[4] = {
+ QRect(rect.left(), rect.top(), rect.width(), 1), // Top
+ QRect(rect.left(), rect.bottom(), rect.width(), 1), // Bottom
+ QRect(rect.left(), rect.top(), 1, rect.height()), // Left
+ QRect(rect.right(), rect.top(), 1, rect.height()) // Right
+ };
+ painter->drawRects(rects, 4);
painter->restore();
}
break;
@@ -1109,18 +1080,24 @@ void QCleanlooksStyle::drawPrimitive(PrimitiveElement elem,
if (isDefault) {
r = option->rect.adjusted(0, 1, 0, -1);
painter->setPen(QPen(Qt::black, 0));
- painter->drawLine(QPoint(r.left() + 2, r.top()),
- QPoint(r.right() - 2, r.top()));
- painter->drawLine(QPoint(r.left(), r.top() + 2),
- QPoint(r.left(), r.bottom() - 2));
- painter->drawLine(QPoint(r.right(), r.top() + 2),
- QPoint(r.right(), r.bottom() - 2));
- painter->drawLine(QPoint(r.left() + 2, r.bottom()),
- QPoint(r.right() - 2, r.bottom()));
- painter->drawPoint(QPoint(r.right() - 1, r.bottom() - 1));
- painter->drawPoint(QPoint(r.right() - 1, r.top() + 1));
- painter->drawPoint(QPoint(r.left() + 1, r.bottom() - 1));
- painter->drawPoint(QPoint(r.left() + 1, r.top() + 1));
+ const QLine lines[4] = {
+ QLine(QPoint(r.left() + 2, r.top()),
+ QPoint(r.right() - 2, r.top())),
+ QLine(QPoint(r.left(), r.top() + 2),
+ QPoint(r.left(), r.bottom() - 2)),
+ QLine(QPoint(r.right(), r.top() + 2),
+ QPoint(r.right(), r.bottom() - 2)),
+ QLine(QPoint(r.left() + 2, r.bottom()),
+ QPoint(r.right() - 2, r.bottom()))
+ };
+ painter->drawLines(lines, 4);
+ const QPoint points[4] = {
+ QPoint(r.right() - 1, r.bottom() - 1),
+ QPoint(r.right() - 1, r.top() + 1),
+ QPoint(r.left() + 1, r.bottom() - 1),
+ QPoint(r.left() + 1, r.top() + 1)
+ };
+ painter->drawPoints(points, 4);
painter->setPen(oldPen);
}
return;
@@ -1184,10 +1161,13 @@ void QCleanlooksStyle::drawPrimitive(PrimitiveElement elem,
QPoint(r.right(), r.bottom() - 2));
p->drawLine(QPoint(r.left() + 2, r.bottom()),
QPoint(r.right() - 2, r.bottom()));
- p->drawPoint(QPoint(r.right() - 1, r.bottom() - 1));
- p->drawPoint(QPoint(r.right() - 1, r.top() + 1));
- p->drawPoint(QPoint(r.left() + 1, r.bottom() - 1));
- p->drawPoint(QPoint(r.left() + 1, r.top() + 1));
+ const QPoint points[4] = {
+ QPoint(r.right() - 1, r.bottom() - 1),
+ QPoint(r.right() - 1, r.top() + 1),
+ QPoint(r.left() + 1, r.bottom() - 1),
+ QPoint(r.left() + 1, r.top() + 1)
+ };
+ p->drawPoints(points, 4);
if (!isDefault && !hasFocus && isEnabled)
p->setPen(QPen(darkOutline.darker(110), 0));
@@ -1207,14 +1187,17 @@ void QCleanlooksStyle::drawPrimitive(PrimitiveElement elem,
topShadow.setAlpha(60);
p->setPen(topShadow);
- p->drawPoint(QPoint(r.right(), r.top() + 1));
- p->drawPoint(QPoint(r.right() - 1, r.top() ));
- p->drawPoint(QPoint(r.right(), r.bottom() - 1));
- p->drawPoint(QPoint(r.right() - 1, r.bottom() ));
- p->drawPoint(QPoint(r.left() + 1, r.bottom()));
- p->drawPoint(QPoint(r.left(), r.bottom() - 1));
- p->drawPoint(QPoint(r.left() + 1, r.top()));
- p->drawPoint(QPoint(r.left(), r.top() + 1));
+ const QPoint points2[8] = {
+ QPoint(r.right(), r.top() + 1),
+ QPoint(r.right() - 1, r.top() ),
+ QPoint(r.right(), r.bottom() - 1),
+ QPoint(r.right() - 1, r.bottom() ),
+ QPoint(r.left() + 1, r.bottom()),
+ QPoint(r.left(), r.bottom() - 1),
+ QPoint(r.left() + 1, r.top()),
+ QPoint(r.left(), r.top() + 1)
+ };
+ p->drawPoints(points2, 8);
topShadow.setAlpha(30);
p->setPen(topShadow);
@@ -1227,18 +1210,24 @@ void QCleanlooksStyle::drawPrimitive(PrimitiveElement elem,
if (isDefault) {
r.adjust(-1, -1, 1, 1);
p->setPen(buttonShadowAlpha.darker(120));
- p->drawLine(r.topLeft() + QPoint(3, 0), r.topRight() - QPoint(3, 0));
- p->drawLine(r.bottomLeft() + QPoint(3, 0), r.bottomRight() - QPoint(3, 0));
- p->drawLine(r.topLeft() + QPoint(0, 3), r.bottomLeft() - QPoint(0, 3));
- p->drawLine(r.topRight() + QPoint(0, 3), r.bottomRight() - QPoint(0, 3));
- p->drawPoint(r.topRight() + QPoint(-2, 1));
- p->drawPoint(r.topRight() + QPoint(-1, 2));
- p->drawPoint(r.bottomRight() + QPoint(-1, -2));
- p->drawPoint(r.bottomRight() + QPoint(-2, -1));
- p->drawPoint(r.topLeft() + QPoint(1, 2));
- p->drawPoint(r.topLeft() + QPoint(2, 1));
- p->drawPoint(r.bottomLeft() + QPoint(1, -2));
- p->drawPoint(r.bottomLeft() + QPoint(2, -1));
+ const QLine lines[4] = {
+ QLine(r.topLeft() + QPoint(3, 0), r.topRight() - QPoint(3, 0)),
+ QLine(r.bottomLeft() + QPoint(3, 0), r.bottomRight() - QPoint(3, 0)),
+ QLine(r.topLeft() + QPoint(0, 3), r.bottomLeft() - QPoint(0, 3)),
+ QLine(r.topRight() + QPoint(0, 3), r.bottomRight() - QPoint(0, 3))
+ };
+ p->drawLines(lines, 4);
+ const QPoint points3[8] = {
+ r.topRight() + QPoint(-2, 1),
+ r.topRight() + QPoint(-1, 2),
+ r.bottomRight() + QPoint(-1, -2),
+ r.bottomRight() + QPoint(-2, -1),
+ r.topLeft() + QPoint(1, 2),
+ r.topLeft() + QPoint(2, 1),
+ r.bottomLeft() + QPoint(1, -2),
+ r.bottomLeft() + QPoint(2, -1)
+ };
+ p->drawPoints(points3, 8);
}
painter->setPen(oldPen);
painter->setBrush(oldBrush);
@@ -1257,7 +1246,7 @@ void QCleanlooksStyle::drawPrimitive(PrimitiveElement elem,
QColor alphaCornerColor = mergedColors(borderColor, option->palette.background().color());
QColor innerShadow = mergedColors(borderColor, option->palette.base().color());
- int borderThickness = pixelMetric(PM_TabBarBaseOverlap, twf, widget);
+ int borderThickness = proxy()->pixelMetric(PM_TabBarBaseOverlap, twf, widget);
bool reverse = (twf->direction == Qt::RightToLeft);
QRect tabBarRect;
@@ -1351,12 +1340,15 @@ void QCleanlooksStyle::drawPrimitive(PrimitiveElement elem,
painter->drawLine(innerBottomLine);
painter->setPen(alphaCornerColor);
- painter->drawPoint(leftBottomInnerCorner1);
- painter->drawPoint(leftBottomInnerCorner2);
- painter->drawPoint(rightBottomInnerCorner1);
- painter->drawPoint(rightBottomInnerCorner2);
- painter->drawPoint(leftTopInnerCorner1);
- painter->drawPoint(leftTopInnerCorner2);
+ const QPoint points[6] = {
+ leftBottomInnerCorner1,
+ leftBottomInnerCorner2,
+ rightBottomInnerCorner1,
+ rightBottomInnerCorner2,
+ leftTopInnerCorner1,
+ leftTopInnerCorner2
+ };
+ painter->drawPoints(points, 6);
}
#endif // QT_NO_TABWIDGET
painter->restore();
@@ -1370,9 +1362,9 @@ void QCleanlooksStyle::drawPrimitive(PrimitiveElement elem,
if (d->tabBarcloseButtonIcon.isNull())
d->tabBarcloseButtonIcon = standardIcon(SP_DialogCloseButton, option, widget);
if ((option->state & State_Enabled) && (option->state & State_MouseOver))
- drawPrimitive(PE_PanelButtonCommand, option, painter, widget);
+ proxy()->drawPrimitive(PE_PanelButtonCommand, option, painter, widget);
QPixmap pixmap = d->tabBarcloseButtonIcon.pixmap(QSize(16, 16), QIcon::Normal, QIcon::On);
- drawItemPixmap(painter, option->rect, Qt::AlignCenter, pixmap);
+ proxy()->drawItemPixmap(painter, option->rect, Qt::AlignCenter, pixmap);
}
break;
@@ -1543,7 +1535,7 @@ void QCleanlooksStyle::drawControl(ControlElement element, const QStyleOption *o
default:
break;
}
- if (QApplication::layoutDirection() == Qt::RightToLeft) { //reverse layout changes the order of Beginning/end
+ if (toolbar->direction == Qt::RightToLeft) { //reverse layout changes the order of Beginning/end
bool tmp = paintLeftBorder;
paintRightBorder=paintLeftBorder;
paintLeftBorder=tmp;
@@ -1649,7 +1641,7 @@ void QCleanlooksStyle::drawControl(ControlElement element, const QStyleOption *o
QString titleText
= painter->fontMetrics().elidedText(dwOpt->title,
Qt::ElideRight, titleRect.width());
- drawItemText(painter,
+ proxy()->drawItemText(painter,
titleRect,
Qt::AlignLeft | Qt::AlignVCenter | Qt::TextShowMnemonic, dwOpt->palette,
dwOpt->state & State_Enabled, titleText,
@@ -1664,9 +1656,9 @@ void QCleanlooksStyle::drawControl(ControlElement element, const QStyleOption *o
// Draws the header in tables.
if (const QStyleOptionHeader *header = qstyleoption_cast<const QStyleOptionHeader *>(option)) {
QPixmap cache;
- QString pixmapName = uniqueName(QLatin1String("headersection"), option, option->rect.size());
- pixmapName += QLatin1String("-") + QString::number(int(header->position));
- pixmapName += QLatin1String("-") + QString::number(int(header->orientation));
+ QString pixmapName = QStyleHelper::uniqueName(QLatin1String("headersection"), option, option->rect.size());
+ pixmapName += QString::number(- int(header->position));
+ pixmapName += QString::number(- int(header->orientation));
QRect r = option->rect;
QColor gradientStopColor;
QColor gradientStartColor = option->palette.button().color();
@@ -1683,7 +1675,7 @@ void QCleanlooksStyle::drawControl(ControlElement element, const QStyleOption *o
}
painter->fillRect(r, gradient);
- if (!UsePixmapCache || !QPixmapCache::find(pixmapName, cache)) {
+ if (!QPixmapCache::find(pixmapName, cache)) {
cache = QPixmap(r.size());
cache.fill(Qt::transparent);
QRect pixmapRect(0, 0, r.width(), r.height());
@@ -1702,8 +1694,7 @@ void QCleanlooksStyle::drawControl(ControlElement element, const QStyleOption *o
cachePainter.drawLine(pixmapRect.topRight() + QPoint(-1, 3), pixmapRect.bottomRight() + QPoint(-1, -3)); cachePainter.setPen(QPen(option->palette.light().color()));
cachePainter.drawLine(pixmapRect.topRight() + QPoint(0, 3), pixmapRect.bottomRight() + QPoint(0, -3)); }
cachePainter.end();
- if (UsePixmapCache)
- QPixmapCache::insert(pixmapName, cache);
+ QPixmapCache::insert(pixmapName, cache);
}
painter->drawPixmap(r.topLeft(), cache);
}
@@ -1715,19 +1706,25 @@ void QCleanlooksStyle::drawControl(ControlElement element, const QStyleOption *o
painter->fillRect(rect, option->palette.base());
QColor borderColor = dark.lighter(110);
painter->setPen(QPen(borderColor, 0));
- painter->drawLine(QPoint(rect.left() + 1, rect.top()), QPoint(rect.right() - 1, rect.top()));
- painter->drawLine(QPoint(rect.left() + 1, rect.bottom()), QPoint(rect.right() - 1, rect.bottom()));
- painter->drawLine(QPoint(rect.left(), rect.top() + 1), QPoint(rect.left(), rect.bottom() - 1));
- painter->drawLine(QPoint(rect.right(), rect.top() + 1), QPoint(rect.right(), rect.bottom() - 1));
+ const QLine lines[4] = {
+ QLine(QPoint(rect.left() + 1, rect.top()), QPoint(rect.right() - 1, rect.top())),
+ QLine(QPoint(rect.left() + 1, rect.bottom()), QPoint(rect.right() - 1, rect.bottom())),
+ QLine(QPoint(rect.left(), rect.top() + 1), QPoint(rect.left(), rect.bottom() - 1)),
+ QLine(QPoint(rect.right(), rect.top() + 1), QPoint(rect.right(), rect.bottom() - 1))
+ };
+ painter->drawLines(lines, 4);
QColor alphaCorner = mergedColors(borderColor, option->palette.background().color());
QColor innerShadow = mergedColors(borderColor, option->palette.base().color());
//corner smoothing
painter->setPen(alphaCorner);
- painter->drawPoint(rect.topRight());
- painter->drawPoint(rect.topLeft());
- painter->drawPoint(rect.bottomRight());
- painter->drawPoint(rect.bottomLeft());
+ const QPoint points[4] = {
+ rect.topRight(),
+ rect.topLeft(),
+ rect.bottomRight(),
+ rect.bottomLeft()
+ };
+ painter->drawPoints(points, 4);
//inner shadow
painter->setPen(innerShadow);
@@ -1758,18 +1755,16 @@ void QCleanlooksStyle::drawControl(ControlElement element, const QStyleOption *o
// same rendering code for both orientations.
if (vertical) {
rect = QRect(rect.left(), rect.top(), rect.height(), rect.width()); // flip width and height
- QTransform m;
- m.translate(rect.height()-1, -1.0);
+ QTransform m = QTransform::fromTranslate(rect.height()-1, -1.0);
m.rotate(90.0);
painter->setTransform(m, true);
}
int maxWidth = rect.width() - 4;
int minWidth = 4;
- qint64 progress = (qint64)qMax(bar->progress, bar->minimum); // workaround for bug in QProgressBar
- double vc6_workaround = ((progress - qint64(bar->minimum)) / qMax(double(1.0), double(qint64(bar->maximum) - qint64(bar->minimum))) * maxWidth);
- int progressBarWidth = (int(vc6_workaround) > minWidth ) ? int(vc6_workaround) : minWidth;
- int width = indeterminate ? maxWidth : progressBarWidth;
+ qreal progress = qMax(bar->progress, bar->minimum); // workaround for bug in QProgressBar
+ int progressBarWidth = (progress - bar->minimum) * qreal(maxWidth) / qMax(qreal(1.0), qreal(bar->maximum) - bar->minimum);
+ int width = indeterminate ? maxWidth : qMax(minWidth, progressBarWidth);
bool reverse = (!vertical && (bar->direction == Qt::RightToLeft)) || vertical;
if (inverted)
@@ -1854,17 +1849,20 @@ void QCleanlooksStyle::drawControl(ControlElement element, const QStyleOption *o
option->palette.highlight());
painter->setPen(QPen(highlightOutline, 0));
- painter->drawLine(QPoint(r.left(), r.top() + 1), QPoint(r.left(), r.bottom()));
- painter->drawLine(QPoint(r.right(), r.top() + 1), QPoint(r.right(), r.bottom()));
- painter->drawLine(QPoint(r.left() + 1, r.bottom()), QPoint(r.right() - 1, r.bottom()));
- painter->drawLine(QPoint(r.left() + 1, r.top()), QPoint(r.right() - 1, r.top()));
+ const QLine lines[4] = {
+ QLine(QPoint(r.left(), r.top() + 1), QPoint(r.left(), r.bottom())),
+ QLine(QPoint(r.right(), r.top() + 1), QPoint(r.right(), r.bottom())),
+ QLine(QPoint(r.left() + 1, r.bottom()), QPoint(r.right() - 1, r.bottom())),
+ QLine(QPoint(r.left() + 1, r.top()), QPoint(r.right() - 1, r.top()))
+ };
+ painter->drawLines(lines, 4);
//draw text
QPalette::ColorRole textRole = dis ? QPalette::Text : QPalette::HighlightedText;
uint alignment = Qt::AlignCenter | Qt::TextShowMnemonic | Qt::TextDontClip | Qt::TextSingleLine;
if (!styleHint(SH_UnderlineShortcut, mbi, widget))
alignment |= Qt::TextHideMnemonic;
- drawItemText(painter, item.rect, alignment, mbi->palette, mbi->state & State_Enabled, mbi->text, textRole);
+ proxy()->drawItemText(painter, item.rect, alignment, mbi->palette, mbi->state & State_Enabled, mbi->text, textRole);
}
}
@@ -1891,7 +1889,7 @@ void QCleanlooksStyle::drawControl(ControlElement element, const QStyleOption *o
int w = 0;
if (!menuItem->text.isEmpty()) {
painter->setFont(menuItem->font);
- drawItemText(painter, menuItem->rect.adjusted(5, 0, -5, 0), Qt::AlignLeft | Qt::AlignVCenter,
+ proxy()->drawItemText(painter, menuItem->rect.adjusted(5, 0, -5, 0), Qt::AlignLeft | Qt::AlignVCenter,
menuItem->palette, menuItem->state & State_Enabled, menuItem->text,
QPalette::Text);
w = menuItem->fontMetrics.width(menuItem->text) + 5;
@@ -1911,10 +1909,13 @@ void QCleanlooksStyle::drawControl(ControlElement element, const QStyleOption *o
highlight);
r = r.adjusted(-1, 0, 1, 0);
painter->setPen(QPen(highlightOutline, 0));
- painter->drawLine(QPoint(r.left(), r.top() + 1), QPoint(r.left(), r.bottom() - 1));
- painter->drawLine(QPoint(r.right(), r.top() + 1), QPoint(r.right(), r.bottom() - 1));
- painter->drawLine(QPoint(r.left() + 1, r.bottom()), QPoint(r.right() - 1, r.bottom()));
- painter->drawLine(QPoint(r.left() + 1, r.top()), QPoint(r.right() - 1, r.top()));
+ const QLine lines[4] = {
+ QLine(QPoint(r.left(), r.top() + 1), QPoint(r.left(), r.bottom() - 1)),
+ QLine(QPoint(r.right(), r.top() + 1), QPoint(r.right(), r.bottom() - 1)),
+ QLine(QPoint(r.left() + 1, r.bottom()), QPoint(r.right() - 1, r.bottom())),
+ QLine(QPoint(r.left() + 1, r.top()), QPoint(r.right() - 1, r.top()))
+ };
+ painter->drawLines(lines, 4);
} else {
painter->fillRect(option->rect, menuBackground);
}
@@ -1995,7 +1996,7 @@ void QCleanlooksStyle::drawControl(ControlElement element, const QStyleOption *o
mode = QIcon::Active;
QPixmap pixmap;
- int smallIconSize = pixelMetric(PM_SmallIconSize, option, widget);
+ int smallIconSize = proxy()->pixelMetric(PM_SmallIconSize, option, widget);
QSize iconSize(smallIconSize, smallIconSize);
#ifndef QT_NO_COMBOBOX
if (const QComboBox *combo = qobject_cast<const QComboBox*>(widget))
@@ -2021,7 +2022,7 @@ void QCleanlooksStyle::drawControl(ControlElement element, const QStyleOption *o
}
opt.state |= State_Sunken;
opt.rect = vCheckRect;
- drawPrimitive(PE_PanelButtonCommand, &opt, painter, widget);
+ proxy()->drawPrimitive(PE_PanelButtonCommand, &opt, painter, widget);
}
painter->drawPixmap(pmr.topLeft(), pixmap);
}
@@ -2054,7 +2055,7 @@ void QCleanlooksStyle::drawControl(ControlElement element, const QStyleOption *o
if (t >= 0) {
QRect vShortcutRect = visualRect(opt->direction, menuitem->rect,
QRect(textRect.topRight(), QPoint(menuitem->rect.right(), textRect.bottom())));
- if (dis && !act && styleHint(SH_EtchDisabledText, option, widget)) {
+ if (dis && !act && proxy()->styleHint(SH_EtchDisabledText, option, widget)) {
p->setPen(menuitem->palette.light().color());
p->drawText(vShortcutRect.adjusted(1, 1, 1, 1), text_flags, s.mid(t + 1));
p->setPen(discol);
@@ -2063,12 +2064,18 @@ void QCleanlooksStyle::drawControl(ControlElement element, const QStyleOption *o
s = s.left(t);
}
QFont font = menuitem->font;
+ // font may not have any "hard" flags set. We override
+ // the point size so that when it is resolved against the device, this font will win.
+ // This is mainly to handle cases where someone sets the font on the window
+ // and then the combo inherits it and passes it onward. At that point the resolve mask
+ // is very, very weak. This makes it stonger.
+ font.setPointSizeF(menuItem->font.pointSizeF());
if (menuitem->menuItemType == QStyleOptionMenuItem::DefaultItem)
font.setBold(true);
p->setFont(font);
- if (dis && !act && styleHint(SH_EtchDisabledText, option, widget)) {
+ if (dis && !act && proxy()->styleHint(SH_EtchDisabledText, option, widget)) {
p->setPen(menuitem->palette.light().color());
p->drawText(vTextRect.adjusted(1, 1, 1, 1), text_flags, s.left(t));
p->setPen(discol);
@@ -2091,7 +2098,7 @@ void QCleanlooksStyle::drawControl(ControlElement element, const QStyleOption *o
if (selected)
newMI.palette.setColor(QPalette::ButtonText,
newMI.palette.highlightedText().color());
- drawPrimitive(arrow, &newMI, painter, widget);
+ proxy()->drawPrimitive(arrow, &newMI, painter, widget);
}
}
painter->restore();
@@ -2152,7 +2159,7 @@ void QCleanlooksStyle::drawControl(ControlElement element, const QStyleOption *o
if (button->features & QStyleOptionButton::HasMenu)
ir = ir.adjusted(0, 0, -pixelMetric(PM_MenuButtonIndicator, button, widget), 0);
- drawItemText(painter, ir, tf, button->palette, (button->state & State_Enabled),
+ proxy()->drawItemText(painter, ir, tf, button->palette, (button->state & State_Enabled),
button->text, QPalette::ButtonText);
}
break;
@@ -2207,7 +2214,7 @@ void QCleanlooksStyle::drawControl(ControlElement element, const QStyleOption *o
|| (rtlHorTabs
&& tab->selectedPosition
== QStyleOptionTab::PreviousIsSelected));
- int tabBarAlignment = styleHint(SH_TabBar_Alignment, tab, widget);
+ int tabBarAlignment = proxy()->styleHint(SH_TabBar_Alignment, tab, widget);
bool leftAligned = (!rtlHorTabs && tabBarAlignment == Qt::AlignLeft)
|| (rtlHorTabs
&& tabBarAlignment == Qt::AlignRight);
@@ -2220,7 +2227,7 @@ void QCleanlooksStyle::drawControl(ControlElement element, const QStyleOption *o
QColor midlight = tab->palette.midlight().color();
QColor background = tab->palette.background().color();
- int borderThinkness = pixelMetric(PM_TabBarBaseOverlap, tab, widget);
+ int borderThinkness = proxy()->pixelMetric(PM_TabBarBaseOverlap, tab, widget);
if (selected)
borderThinkness /= 2;
QRect r2(option->rect);
@@ -2456,8 +2463,8 @@ void QCleanlooksStyle::drawComplexControl(ComplexControl control, const QStyleOp
case CC_SpinBox:
if (const QStyleOptionSpinBox *spinBox = qstyleoption_cast<const QStyleOptionSpinBox *>(option)) {
QPixmap cache;
- QString pixmapName = uniqueName(QLatin1String("spinbox"), spinBox, spinBox->rect.size());
- if (!UsePixmapCache || !QPixmapCache::find(pixmapName, cache)) {
+ QString pixmapName = QStyleHelper::uniqueName(QLatin1String("spinbox"), spinBox, spinBox->rect.size());
+ if (!QPixmapCache::find(pixmapName, cache)) {
cache = QPixmap(spinBox->rect.size());
cache.fill(Qt::transparent);
QRect pixmapRect(0, 0, spinBox->rect.width(), spinBox->rect.height());
@@ -2473,10 +2480,10 @@ void QCleanlooksStyle::drawComplexControl(ComplexControl control, const QStyleOp
QRect rect = pixmapRect;
QStyleOptionSpinBox spinBoxCopy = *spinBox;
spinBoxCopy.rect = pixmapRect;
- QRect upRect = subControlRect(CC_SpinBox, &spinBoxCopy, SC_SpinBoxUp, widget);
- QRect downRect = subControlRect(CC_SpinBox, &spinBoxCopy, SC_SpinBoxDown, widget);
+ QRect upRect = proxy()->subControlRect(CC_SpinBox, &spinBoxCopy, SC_SpinBoxUp, widget);
+ QRect downRect = proxy()->subControlRect(CC_SpinBox, &spinBoxCopy, SC_SpinBoxDown, widget);
- int fw = spinBoxCopy.frame ? pixelMetric(PM_SpinBoxFrameWidth, &spinBoxCopy, widget) : 0;
+ int fw = spinBoxCopy.frame ? proxy()->pixelMetric(PM_SpinBoxFrameWidth, &spinBoxCopy, widget) : 0;
cachePainter.fillRect(rect.adjusted(1, qMax(fw - 1, 0), -1, -fw),
option->palette.base());
@@ -2488,14 +2495,17 @@ void QCleanlooksStyle::drawComplexControl(ComplexControl control, const QStyleOp
cachePainter.setPen(topShadow);
// antialias corners
- cachePainter.drawPoint(QPoint(r.right(), r.top() + 1));
- cachePainter.drawPoint(QPoint(r.right() - 1, r.top() ));
- cachePainter.drawPoint(QPoint(r.right(), r.bottom() - 1));
- cachePainter.drawPoint(QPoint(r.right() - 1, r.bottom() ));
- cachePainter.drawPoint(QPoint(r.left() + 1, r.bottom()));
- cachePainter.drawPoint(QPoint(r.left(), r.bottom() - 1));
- cachePainter.drawPoint(QPoint(r.left() + 1, r.top()));
- cachePainter.drawPoint(QPoint(r.left(), r.top() + 1));
+ const QPoint points[8] = {
+ QPoint(r.right(), r.top() + 1),
+ QPoint(r.right() - 1, r.top() ),
+ QPoint(r.right(), r.bottom() - 1),
+ QPoint(r.right() - 1, r.bottom() ),
+ QPoint(r.left() + 1, r.bottom()),
+ QPoint(r.left(), r.bottom() - 1),
+ QPoint(r.left() + 1, r.top()),
+ QPoint(r.left(), r.top() + 1)
+ };
+ cachePainter.drawPoints(points, 8);
// draw frame
topShadow.setAlpha(30);
@@ -2523,10 +2533,13 @@ void QCleanlooksStyle::drawComplexControl(ComplexControl control, const QStyleOp
cachePainter.setPen(QPen(darkOutline, 1));
// top and bottom lines
- cachePainter.drawLine(QPoint(r.left() + 2, r.bottom()), QPoint(r.right()- 2, r.bottom()));
- cachePainter.drawLine(QPoint(r.left() + 2, r.top()), QPoint(r.right() - 2, r.top()));
- cachePainter.drawLine(QPoint(r.right(), r.top() + 2), QPoint(r.right(), r.bottom() - 2));
- cachePainter.drawLine(QPoint(r.left(), r.top() + 2), QPoint(r.left(), r.bottom() - 2));
+ const QLine lines[4] = {
+ QLine(QPoint(r.left() + 2, r.bottom()), QPoint(r.right()- 2, r.bottom())),
+ QLine(QPoint(r.left() + 2, r.top()), QPoint(r.right() - 2, r.top())),
+ QLine(QPoint(r.right(), r.top() + 2), QPoint(r.right(), r.bottom() - 2)),
+ QLine(QPoint(r.left(), r.top() + 2), QPoint(r.left(), r.bottom() - 2))
+ };
+ cachePainter.drawLines(lines, 4);
}
// gradients
@@ -2560,10 +2573,13 @@ void QCleanlooksStyle::drawComplexControl(ComplexControl control, const QStyleOp
if (spinBox->frame) {
// rounded corners
- cachePainter.drawPoint(QPoint(r.left() + 1, r.bottom() - 1));
- cachePainter.drawPoint(QPoint(r.left() + 1, r.top() + 1));
- cachePainter.drawPoint(QPoint(r.right() - 1, r.bottom() - 1));
- cachePainter.drawPoint(QPoint(r.right() - 1, r.top() + 1));
+ const QPoint points[4] = {
+ QPoint(r.left() + 1, r.bottom() - 1),
+ QPoint(r.left() + 1, r.top() + 1),
+ QPoint(r.right() - 1, r.bottom() - 1),
+ QPoint(r.right() - 1, r.top() + 1)
+ };
+ cachePainter.drawPoints(points, 4);
if (option->state & State_HasFocus) {
QColor darkoutline = option->palette.highlight().color().darker(150);
@@ -2572,10 +2588,13 @@ void QCleanlooksStyle::drawComplexControl(ComplexControl control, const QStyleOp
if (spinBox->direction == Qt::LeftToRight) {
cachePainter.drawRect(rect.adjusted(1, 2, -3 -downRect.width(), -3));
cachePainter.setPen(QPen(darkoutline, 0));
- cachePainter.drawLine(QPoint(r.left() + 2, r.bottom()), QPoint(r.right()- downRect.width() - 1, r.bottom()));
- cachePainter.drawLine(QPoint(r.left() + 2, r.top()), QPoint(r.right() - downRect.width() - 1, r.top()));
- cachePainter.drawLine(QPoint(r.right() - downRect.width() - 1, r.top() + 1), QPoint(r.right()- downRect.width() - 1, r.bottom() - 1));
- cachePainter.drawLine(QPoint(r.left(), r.top() + 2), QPoint(r.left(), r.bottom() - 2));
+ const QLine lines[4] = {
+ QLine(QPoint(r.left() + 2, r.bottom()), QPoint(r.right()- downRect.width() - 1, r.bottom())),
+ QLine(QPoint(r.left() + 2, r.top()), QPoint(r.right() - downRect.width() - 1, r.top())),
+ QLine(QPoint(r.right() - downRect.width() - 1, r.top() + 1), QPoint(r.right()- downRect.width() - 1, r.bottom() - 1)),
+ QLine(QPoint(r.left(), r.top() + 2), QPoint(r.left(), r.bottom() - 2))
+ };
+ cachePainter.drawLines(lines, 4);
cachePainter.drawPoint(QPoint(r.left() + 1, r.bottom() - 1));
cachePainter.drawPoint(QPoint(r.left() + 1, r.top() + 1));
cachePainter.drawLine(QPoint(r.left(), r.top() + 2), QPoint(r.left(), r.bottom() - 2));
@@ -2674,8 +2693,7 @@ void QCleanlooksStyle::drawComplexControl(ComplexControl control, const QStyleOp
cachePainter.fillRect(downRect.adjusted(1, 0, 0, 0), disabledColor);
}
cachePainter.end();
- if (UsePixmapCache)
- QPixmapCache::insert(pixmapName, cache);
+ QPixmapCache::insert(pixmapName, cache);
}
painter->drawPixmap(spinBox->rect.topLeft(), cache);
}
@@ -2699,7 +2717,7 @@ void QCleanlooksStyle::drawComplexControl(ComplexControl control, const QStyleOp
if (widget && widget->inherits("Q3DockWindowTitleBar")) {
QStyleOptionDockWidgetV2 dockwidget;
dockwidget.QStyleOption::operator=(*option);
- drawControl(CE_DockWidgetTitle, &dockwidget, painter, widget);
+ proxy()->drawControl(CE_DockWidgetTitle, &dockwidget, painter, widget);
} else
#endif // QT3_SUPPORT
{
@@ -2721,18 +2739,24 @@ void QCleanlooksStyle::drawComplexControl(ComplexControl control, const QStyleOp
// top outline
painter->drawLine(fullRect.left() + 5, fullRect.top(), fullRect.right() - 5, fullRect.top());
painter->drawLine(fullRect.left(), fullRect.top() + 4, fullRect.left(), fullRect.bottom());
- painter->drawPoint(fullRect.left() + 4, fullRect.top() + 1);
- painter->drawPoint(fullRect.left() + 3, fullRect.top() + 1);
- painter->drawPoint(fullRect.left() + 2, fullRect.top() + 2);
- painter->drawPoint(fullRect.left() + 1, fullRect.top() + 3);
- painter->drawPoint(fullRect.left() + 1, fullRect.top() + 4);
+ const QPoint points[5] = {
+ QPoint(fullRect.left() + 4, fullRect.top() + 1),
+ QPoint(fullRect.left() + 3, fullRect.top() + 1),
+ QPoint(fullRect.left() + 2, fullRect.top() + 2),
+ QPoint(fullRect.left() + 1, fullRect.top() + 3),
+ QPoint(fullRect.left() + 1, fullRect.top() + 4)
+ };
+ painter->drawPoints(points, 5);
painter->drawLine(fullRect.right(), fullRect.top() + 4, fullRect.right(), fullRect.bottom());
- painter->drawPoint(fullRect.right() - 3, fullRect.top() + 1);
- painter->drawPoint(fullRect.right() - 4, fullRect.top() + 1);
- painter->drawPoint(fullRect.right() - 2, fullRect.top() + 2);
- painter->drawPoint(fullRect.right() - 1, fullRect.top() + 3);
- painter->drawPoint(fullRect.right() - 1, fullRect.top() + 4);
+ const QPoint points2[5] = {
+ QPoint(fullRect.right() - 3, fullRect.top() + 1),
+ QPoint(fullRect.right() - 4, fullRect.top() + 1),
+ QPoint(fullRect.right() - 2, fullRect.top() + 2),
+ QPoint(fullRect.right() - 1, fullRect.top() + 3),
+ QPoint(fullRect.right() - 1, fullRect.top() + 4)
+ };
+ painter->drawPoints(points2, 5);
// draw bottomline
painter->drawLine(fullRect.right(), fullRect.bottom(), fullRect.left(), fullRect.bottom());
@@ -2742,7 +2766,7 @@ void QCleanlooksStyle::drawComplexControl(ComplexControl control, const QStyleOp
painter->drawLine(fullRect.left() + 6, fullRect.top() + 1, fullRect.right() - 6, fullRect.top() + 1);
}
// draw title
- QRect textRect = subControlRect(CC_TitleBar, titleBar, SC_TitleBarLabel, widget);
+ QRect textRect = proxy()->subControlRect(CC_TitleBar, titleBar, SC_TitleBarLabel, widget);
QFont font = painter->font();
font.setBold(true);
painter->setFont(font);
@@ -2757,7 +2781,7 @@ void QCleanlooksStyle::drawComplexControl(ComplexControl control, const QStyleOp
// min button
if ((titleBar->subControls & SC_TitleBarMinButton) && (titleBar->titleBarFlags & Qt::WindowMinimizeButtonHint) &&
!(titleBar->titleBarState& Qt::WindowMinimized)) {
- QRect minButtonRect = subControlRect(CC_TitleBar, titleBar, SC_TitleBarMinButton, widget);
+ QRect minButtonRect = proxy()->subControlRect(CC_TitleBar, titleBar, SC_TitleBarMinButton, widget);
if (minButtonRect.isValid()) {
bool hover = (titleBar->activeSubControls & SC_TitleBarMinButton) && (titleBar->state & State_MouseOver);
bool sunken = (titleBar->activeSubControls & SC_TitleBarMinButton) && (titleBar->state & State_Sunken);
@@ -2778,7 +2802,7 @@ void QCleanlooksStyle::drawComplexControl(ComplexControl control, const QStyleOp
// max button
if ((titleBar->subControls & SC_TitleBarMaxButton) && (titleBar->titleBarFlags & Qt::WindowMaximizeButtonHint) &&
!(titleBar->titleBarState & Qt::WindowMaximized)) {
- QRect maxButtonRect = subControlRect(CC_TitleBar, titleBar, SC_TitleBarMaxButton, widget);
+ QRect maxButtonRect = proxy()->subControlRect(CC_TitleBar, titleBar, SC_TitleBarMaxButton, widget);
if (maxButtonRect.isValid()) {
bool hover = (titleBar->activeSubControls & SC_TitleBarMaxButton) && (titleBar->state & State_MouseOver);
bool sunken = (titleBar->activeSubControls & SC_TitleBarMaxButton) && (titleBar->state & State_Sunken);
@@ -2791,34 +2815,43 @@ void QCleanlooksStyle::drawComplexControl(ComplexControl control, const QStyleOp
painter->drawLine(maxButtonIconRect.left() + 1, maxButtonIconRect.top() + 1,
maxButtonIconRect.right() - 1, maxButtonIconRect.top() + 1);
painter->setPen(textAlphaColor);
- painter->drawPoint(maxButtonIconRect.topLeft());
- painter->drawPoint(maxButtonIconRect.topRight());
- painter->drawPoint(maxButtonIconRect.bottomLeft());
- painter->drawPoint(maxButtonIconRect.bottomRight());
+ const QPoint points[4] = {
+ maxButtonIconRect.topLeft(),
+ maxButtonIconRect.topRight(),
+ maxButtonIconRect.bottomLeft(),
+ maxButtonIconRect.bottomRight()
+ };
+ painter->drawPoints(points, 4);
}
}
// close button
if ((titleBar->subControls & SC_TitleBarCloseButton) && (titleBar->titleBarFlags & Qt::WindowSystemMenuHint)) {
- QRect closeButtonRect = subControlRect(CC_TitleBar, titleBar, SC_TitleBarCloseButton, widget);
+ QRect closeButtonRect = proxy()->subControlRect(CC_TitleBar, titleBar, SC_TitleBarCloseButton, widget);
if (closeButtonRect.isValid()) {
bool hover = (titleBar->activeSubControls & SC_TitleBarCloseButton) && (titleBar->state & State_MouseOver);
bool sunken = (titleBar->activeSubControls & SC_TitleBarCloseButton) && (titleBar->state & State_Sunken);
qt_cleanlooks_draw_mdibutton(painter, titleBar, closeButtonRect, hover, sunken);
QRect closeIconRect = closeButtonRect.adjusted(buttonMargin, buttonMargin, -buttonMargin, -buttonMargin);
painter->setPen(textAlphaColor);
- painter->drawLine(closeIconRect.left() + 1, closeIconRect.top(),
- closeIconRect.right(), closeIconRect.bottom() - 1);
- painter->drawLine(closeIconRect.left(), closeIconRect.top() + 1,
- closeIconRect.right() - 1, closeIconRect.bottom());
- painter->drawLine(closeIconRect.right() - 1, closeIconRect.top(),
- closeIconRect.left(), closeIconRect.bottom() - 1);
- painter->drawLine(closeIconRect.right(), closeIconRect.top() + 1,
- closeIconRect.left() + 1, closeIconRect.bottom());
- painter->drawPoint(closeIconRect.topLeft());
- painter->drawPoint(closeIconRect.topRight());
- painter->drawPoint(closeIconRect.bottomLeft());
- painter->drawPoint(closeIconRect.bottomRight());
+ const QLine lines[4] = {
+ QLine(closeIconRect.left() + 1, closeIconRect.top(),
+ closeIconRect.right(), closeIconRect.bottom() - 1),
+ QLine(closeIconRect.left(), closeIconRect.top() + 1,
+ closeIconRect.right() - 1, closeIconRect.bottom()),
+ QLine(closeIconRect.right() - 1, closeIconRect.top(),
+ closeIconRect.left(), closeIconRect.bottom() - 1),
+ QLine(closeIconRect.right(), closeIconRect.top() + 1,
+ closeIconRect.left() + 1, closeIconRect.bottom())
+ };
+ painter->drawLines(lines, 4);
+ const QPoint points[4] = {
+ closeIconRect.topLeft(),
+ closeIconRect.topRight(),
+ closeIconRect.bottomLeft(),
+ closeIconRect.bottomRight()
+ };
+ painter->drawPoints(points, 4);
painter->setPen(textColor);
painter->drawLine(closeIconRect.left() + 1, closeIconRect.top() + 1,
@@ -2834,7 +2867,7 @@ void QCleanlooksStyle::drawComplexControl(ComplexControl control, const QStyleOp
(titleBar->titleBarState & Qt::WindowMinimized)) ||
((titleBar->titleBarFlags & Qt::WindowMaximizeButtonHint) &&
(titleBar->titleBarState & Qt::WindowMaximized)))) {
- QRect normalButtonRect = subControlRect(CC_TitleBar, titleBar, SC_TitleBarNormalButton, widget);
+ QRect normalButtonRect = proxy()->subControlRect(CC_TitleBar, titleBar, SC_TitleBarNormalButton, widget);
if (normalButtonRect.isValid()) {
bool hover = (titleBar->activeSubControls & SC_TitleBarNormalButton) && (titleBar->state & State_MouseOver);
@@ -2848,10 +2881,13 @@ void QCleanlooksStyle::drawComplexControl(ComplexControl control, const QStyleOp
painter->drawLine(frontWindowRect.left() + 1, frontWindowRect.top() + 1,
frontWindowRect.right() - 1, frontWindowRect.top() + 1);
painter->setPen(textAlphaColor);
- painter->drawPoint(frontWindowRect.topLeft());
- painter->drawPoint(frontWindowRect.topRight());
- painter->drawPoint(frontWindowRect.bottomLeft());
- painter->drawPoint(frontWindowRect.bottomRight());
+ const QPoint points[4] = {
+ frontWindowRect.topLeft(),
+ frontWindowRect.topRight(),
+ frontWindowRect.bottomLeft(),
+ frontWindowRect.bottomRight()
+ };
+ painter->drawPoints(points, 4);
QRect backWindowRect = normalButtonIconRect.adjusted(3, 0, 0, -3);
QRegion clipRegion = backWindowRect;
@@ -2863,10 +2899,13 @@ void QCleanlooksStyle::drawComplexControl(ComplexControl control, const QStyleOp
painter->drawLine(backWindowRect.left() + 1, backWindowRect.top() + 1,
backWindowRect.right() - 1, backWindowRect.top() + 1);
painter->setPen(textAlphaColor);
- painter->drawPoint(backWindowRect.topLeft());
- painter->drawPoint(backWindowRect.topRight());
- painter->drawPoint(backWindowRect.bottomLeft());
- painter->drawPoint(backWindowRect.bottomRight());
+ const QPoint points2[4] = {
+ backWindowRect.topLeft(),
+ backWindowRect.topRight(),
+ backWindowRect.bottomLeft(),
+ backWindowRect.bottomRight()
+ };
+ painter->drawPoints(points2, 4);
painter->restore();
}
}
@@ -2874,7 +2913,7 @@ void QCleanlooksStyle::drawComplexControl(ComplexControl control, const QStyleOp
// context help button
if (titleBar->subControls & SC_TitleBarContextHelpButton
&& (titleBar->titleBarFlags & Qt::WindowContextHelpButtonHint)) {
- QRect contextHelpButtonRect = subControlRect(CC_TitleBar, titleBar, SC_TitleBarContextHelpButton, widget);
+ QRect contextHelpButtonRect = proxy()->subControlRect(CC_TitleBar, titleBar, SC_TitleBarContextHelpButton, widget);
if (contextHelpButtonRect.isValid()) {
bool hover = (titleBar->activeSubControls & SC_TitleBarContextHelpButton) && (titleBar->state & State_MouseOver);
bool sunken = (titleBar->activeSubControls & SC_TitleBarContextHelpButton) && (titleBar->state & State_Sunken);
@@ -2893,7 +2932,7 @@ void QCleanlooksStyle::drawComplexControl(ComplexControl control, const QStyleOp
// shade button
if (titleBar->subControls & SC_TitleBarShadeButton && (titleBar->titleBarFlags & Qt::WindowShadeButtonHint)) {
- QRect shadeButtonRect = subControlRect(CC_TitleBar, titleBar, SC_TitleBarShadeButton, widget);
+ QRect shadeButtonRect = proxy()->subControlRect(CC_TitleBar, titleBar, SC_TitleBarShadeButton, widget);
if (shadeButtonRect.isValid()) {
bool hover = (titleBar->activeSubControls & SC_TitleBarShadeButton) && (titleBar->state & State_MouseOver);
bool sunken = (titleBar->activeSubControls & SC_TitleBarShadeButton) && (titleBar->state & State_Sunken);
@@ -2906,7 +2945,7 @@ void QCleanlooksStyle::drawComplexControl(ComplexControl control, const QStyleOp
// unshade button
if (titleBar->subControls & SC_TitleBarUnshadeButton && (titleBar->titleBarFlags & Qt::WindowShadeButtonHint)) {
- QRect unshadeButtonRect = subControlRect(CC_TitleBar, titleBar, SC_TitleBarUnshadeButton, widget);
+ QRect unshadeButtonRect = proxy()->subControlRect(CC_TitleBar, titleBar, SC_TitleBarUnshadeButton, widget);
if (unshadeButtonRect.isValid()) {
bool hover = (titleBar->activeSubControls & SC_TitleBarUnshadeButton) && (titleBar->state & State_MouseOver);
bool sunken = (titleBar->activeSubControls & SC_TitleBarUnshadeButton) && (titleBar->state & State_Sunken);
@@ -2918,7 +2957,7 @@ void QCleanlooksStyle::drawComplexControl(ComplexControl control, const QStyleOp
}
if ((titleBar->subControls & SC_TitleBarSysMenu) && (titleBar->titleBarFlags & Qt::WindowSystemMenuHint)) {
- QRect iconRect = subControlRect(CC_TitleBar, titleBar, SC_TitleBarSysMenu, widget);
+ QRect iconRect = proxy()->subControlRect(CC_TitleBar, titleBar, SC_TitleBarSysMenu, widget);
if (iconRect.isValid()) {
if (!titleBar->icon.isNull()) {
titleBar->icon.paint(painter, iconRect);
@@ -2928,7 +2967,7 @@ void QCleanlooksStyle::drawComplexControl(ComplexControl control, const QStyleOp
QPixmap pm = standardIcon(SP_TitleBarMenuButton, &tool, widget).pixmap(16, 16);
tool.rect = iconRect;
painter->save();
- drawItemPixmap(painter, iconRect, Qt::AlignCenter, pm);
+ proxy()->drawItemPixmap(painter, iconRect, Qt::AlignCenter, pm);
painter->restore();
}
}
@@ -2948,10 +2987,10 @@ void QCleanlooksStyle::drawComplexControl(ComplexControl control, const QStyleOp
painter->fillRect(option->rect, option->palette.background());
QRect rect = scrollBar->rect;
- QRect scrollBarSubLine = subControlRect(control, scrollBar, SC_ScrollBarSubLine, widget);
- QRect scrollBarAddLine = subControlRect(control, scrollBar, SC_ScrollBarAddLine, widget);
- QRect scrollBarSlider = subControlRect(control, scrollBar, SC_ScrollBarSlider, widget);
- QRect grooveRect = subControlRect(control, scrollBar, SC_ScrollBarGroove, widget);
+ QRect scrollBarSubLine = proxy()->subControlRect(control, scrollBar, SC_ScrollBarSubLine, widget);
+ QRect scrollBarAddLine = proxy()->subControlRect(control, scrollBar, SC_ScrollBarAddLine, widget);
+ QRect scrollBarSlider = proxy()->subControlRect(control, scrollBar, SC_ScrollBarSlider, widget);
+ QRect grooveRect = proxy()->subControlRect(control, scrollBar, SC_ScrollBarGroove, widget);
// paint groove
if (scrollBar->subControls & SC_ScrollBarGroove) {
@@ -3086,7 +3125,7 @@ void QCleanlooksStyle::drawComplexControl(ComplexControl control, const QStyleOp
// The SubLine (up/left) buttons
if (scrollBar->subControls & SC_ScrollBarSubLine) {
- //int scrollBarExtent = pixelMetric(PM_ScrollBarExtent, option, widget);
+ //int scrollBarExtent = proxy()->pixelMetric(PM_ScrollBarExtent, option, widget);
QRect pixmapRect = scrollBarSubLine;
if (isEnabled ) {
QRect fillRect = pixmapRect.adjusted(1, 1, -1, -1);
@@ -3132,12 +3171,12 @@ void QCleanlooksStyle::drawComplexControl(ComplexControl control, const QStyleOp
arrow = PE_IndicatorArrowUp;
QStyleOption arrowOpt = *option;
arrowOpt.rect = scrollBarSubLine.adjusted(3, 3, -2, -2);
- drawPrimitive(arrow, &arrowOpt, painter, widget);
+ proxy()->drawPrimitive(arrow, &arrowOpt, painter, widget);
// The AddLine (down/right) button
if (scrollBar->subControls & SC_ScrollBarAddLine) {
- QString addLinePixmapName = uniqueName(QLatin1String("scrollbar_addline"), option, QSize(16, 16));
+ QString addLinePixmapName = QStyleHelper::uniqueName(QLatin1String("scrollbar_addline"), option, QSize(16, 16));
QRect pixmapRect = scrollBarAddLine;
if (isEnabled) {
QRect fillRect = pixmapRect.adjusted(1, 1, -1, -1);
@@ -3183,7 +3222,7 @@ void QCleanlooksStyle::drawComplexControl(ComplexControl control, const QStyleOp
QStyleOption arrowOpt = *option;
arrowOpt.rect = scrollBarAddLine.adjusted(3, 3, -2, -2);
- drawPrimitive(arrow, &arrowOpt, painter, widget);
+ proxy()->drawPrimitive(arrow, &arrowOpt, painter, widget);
}
}
}
@@ -3198,7 +3237,7 @@ void QCleanlooksStyle::drawComplexControl(ComplexControl control, const QStyleOp
bool isEnabled = (comboBox->state & State_Enabled);
bool focus = isEnabled && (comboBox->state & State_HasFocus);
QPixmap cache;
- QString pixmapName = uniqueName(QLatin1String("combobox"), option, comboBox->rect.size());
+ QString pixmapName = QStyleHelper::uniqueName(QLatin1String("combobox"), option, comboBox->rect.size());
if (sunken)
pixmapName += QLatin1String("-sunken");
if (comboBox->editable)
@@ -3206,7 +3245,7 @@ void QCleanlooksStyle::drawComplexControl(ComplexControl control, const QStyleOp
if (isEnabled)
pixmapName += QLatin1String("-enabled");
- if (!UsePixmapCache || !QPixmapCache::find(pixmapName, cache)) {
+ if (!QPixmapCache::find(pixmapName, cache)) {
cache = QPixmap(comboBox->rect.size());
cache.fill(Qt::transparent);
QPainter cachePainter(&cache);
@@ -3215,9 +3254,9 @@ void QCleanlooksStyle::drawComplexControl(ComplexControl control, const QStyleOp
comboBoxCopy.rect = pixmapRect;
QRect rect = pixmapRect;
- QRect downArrowRect = subControlRect(CC_ComboBox, &comboBoxCopy,
+ QRect downArrowRect = proxy()->subControlRect(CC_ComboBox, &comboBoxCopy,
SC_ComboBoxArrow, widget);
- QRect editRect = subControlRect(CC_ComboBox, &comboBoxCopy,
+ QRect editRect = proxy()->subControlRect(CC_ComboBox, &comboBoxCopy,
SC_ComboBoxEditField, widget);
// Draw a push button
if (comboBox->editable) {
@@ -3231,7 +3270,7 @@ void QCleanlooksStyle::drawComplexControl(ComplexControl control, const QStyleOp
buttonOption.state &= ~State_MouseOver;
}
- drawPrimitive(PE_PanelButtonCommand, &buttonOption, &cachePainter, widget);
+ proxy()->drawPrimitive(PE_PanelButtonCommand, &buttonOption, &cachePainter, widget);
//remove shadow from left side of edit field when pressed:
if (comboBox->direction != Qt::RightToLeft)
@@ -3273,7 +3312,7 @@ void QCleanlooksStyle::drawComplexControl(ComplexControl control, const QStyleOp
buttonOption.state |= State_Sunken;
buttonOption.state &= ~State_MouseOver;
}
- drawPrimitive(PE_PanelButtonCommand, &buttonOption, &cachePainter, widget);
+ proxy()->drawPrimitive(PE_PanelButtonCommand, &buttonOption, &cachePainter, widget);
cachePainter.setPen(buttonShadow.darker(102));
int borderSize = 4;
@@ -3326,15 +3365,15 @@ void QCleanlooksStyle::drawComplexControl(ComplexControl control, const QStyleOp
}
}
// Draw the focus rect
- if ((focus && (option->state & State_KeyboardFocusChange)) && !comboBox->editable) {
+ if (focus && !comboBox->editable
+ && ((option->state & State_KeyboardFocusChange) || styleHint(SH_UnderlineShortcut, option, widget))) {
QStyleOptionFocusRect focus;
- focus.rect = subControlRect(CC_ComboBox, &comboBoxCopy, SC_ComboBoxEditField, widget)
+ focus.rect = proxy()->subControlRect(CC_ComboBox, &comboBoxCopy, SC_ComboBoxEditField, widget)
.adjusted(0, 2, option->direction == Qt::RightToLeft ? 1 : -1, -2);
- drawPrimitive(PE_FrameFocusRect, &focus, &cachePainter, widget);
+ proxy()->drawPrimitive(PE_FrameFocusRect, &focus, &cachePainter, widget);
}
cachePainter.end();
- if (UsePixmapCache)
- QPixmapCache::insert(pixmapName, cache);
+ QPixmapCache::insert(pixmapName, cache);
}
painter->drawPixmap(comboBox->rect.topLeft(), cache);
}
@@ -3345,8 +3384,8 @@ void QCleanlooksStyle::drawComplexControl(ComplexControl control, const QStyleOp
case CC_GroupBox:
painter->save();
if (const QStyleOptionGroupBox *groupBox = qstyleoption_cast<const QStyleOptionGroupBox *>(option)) {
- QRect textRect = subControlRect(CC_GroupBox, groupBox, SC_GroupBoxLabel, widget);
- QRect checkBoxRect = subControlRect(CC_GroupBox, groupBox, SC_GroupBoxCheckBox, widget);
+ QRect textRect = proxy()->subControlRect(CC_GroupBox, groupBox, SC_GroupBoxLabel, widget);
+ QRect checkBoxRect = proxy()->subControlRect(CC_GroupBox, groupBox, SC_GroupBoxCheckBox, widget);
bool flat = groupBox->features & QStyleOptionFrameV2::Flat;
if(!flat) {
@@ -3356,7 +3395,7 @@ void QCleanlooksStyle::drawComplexControl(ComplexControl control, const QStyleOp
frame.features = groupBox->features;
frame.lineWidth = groupBox->lineWidth;
frame.midLineWidth = groupBox->midLineWidth;
- frame.rect = subControlRect(CC_GroupBox, option, SC_GroupBoxFrame, widget);
+ frame.rect = proxy()->subControlRect(CC_GroupBox, option, SC_GroupBoxFrame, widget);
painter->save();
QRegion region(groupBox->rect);
@@ -3365,7 +3404,7 @@ void QCleanlooksStyle::drawComplexControl(ComplexControl control, const QStyleOp
if (!groupBox->text.isEmpty() || groupBox->subControls & SC_GroupBoxCheckBox)
painter->setClipRegion(region);
frame.palette.setBrush(QPalette::Dark, option->palette.mid().color().lighter(110));
- drawPrimitive(PE_FrameGroupBox, &frame, painter);
+ proxy()->drawPrimitive(PE_FrameGroupBox, &frame, painter);
painter->restore();
}
}
@@ -3393,7 +3432,7 @@ void QCleanlooksStyle::drawComplexControl(ComplexControl control, const QStyleOp
QStyleOptionButton box;
box.QStyleOption::operator=(*groupBox);
box.rect = checkBoxRect;
- drawPrimitive(PE_IndicatorCheckBox, &box, painter, widget);
+ proxy()->drawPrimitive(PE_IndicatorCheckBox, &box, painter, widget);
}
}
painter->restore();
@@ -3402,9 +3441,9 @@ void QCleanlooksStyle::drawComplexControl(ComplexControl control, const QStyleOp
#ifndef QT_NO_SLIDER
case CC_Slider:
if (const QStyleOptionSlider *slider = qstyleoption_cast<const QStyleOptionSlider *>(option)) {
- QRect groove = subControlRect(CC_Slider, option, SC_SliderGroove, widget);
- QRect handle = subControlRect(CC_Slider, option, SC_SliderHandle, widget);
- QRect ticks = subControlRect(CC_Slider, option, SC_SliderTickmarks, widget);
+ QRect groove = proxy()->subControlRect(CC_Slider, option, SC_SliderGroove, widget);
+ QRect handle = proxy()->subControlRect(CC_Slider, option, SC_SliderHandle, widget);
+ QRect ticks = proxy()->subControlRect(CC_Slider, option, SC_SliderTickmarks, widget);
bool horizontal = slider->orientation == Qt::Horizontal;
bool ticksAbove = slider->tickPosition & QSlider::TicksAbove;
@@ -3421,11 +3460,11 @@ void QCleanlooksStyle::drawComplexControl(ComplexControl control, const QStyleOp
highlightAlpha.setAlpha(80);
if ((option->subControls & SC_SliderGroove) && groove.isValid()) {
- QString groovePixmapName = uniqueName(QLatin1String("slider_groove"), option, groove.size());
+ QString groovePixmapName = QStyleHelper::uniqueName(QLatin1String("slider_groove"), option, groove.size());
QRect pixmapRect(0, 0, groove.width(), groove.height());
// draw background groove
- if (!UsePixmapCache || !QPixmapCache::find(groovePixmapName, cache)) {
+ if (!QPixmapCache::find(groovePixmapName, cache)) {
cache = QPixmap(pixmapRect.size());
cache.fill(Qt::transparent);
QPainter groovePainter(&cache);
@@ -3452,15 +3491,14 @@ void QCleanlooksStyle::drawComplexControl(ComplexControl control, const QStyleOp
groovePainter.setBrush(gradient);
groovePainter.drawRect(pixmapRect.adjusted(1, 1, -2, -2));
groovePainter.end();
- if (UsePixmapCache)
- QPixmapCache::insert(groovePixmapName, cache);
+ QPixmapCache::insert(groovePixmapName, cache);
}
painter->drawPixmap(groove.topLeft(), cache);
// draw blue groove highlight
QRect clipRect;
groovePixmapName += QLatin1String("_blue");
- if (!UsePixmapCache || !QPixmapCache::find(groovePixmapName, cache)) {
+ if (!QPixmapCache::find(groovePixmapName, cache)) {
cache = QPixmap(pixmapRect.size());
cache.fill(Qt::transparent);
QPainter groovePainter(&cache);
@@ -3479,8 +3517,7 @@ void QCleanlooksStyle::drawComplexControl(ComplexControl control, const QStyleOp
groovePainter.setBrush(gradient);
groovePainter.drawRect(pixmapRect.adjusted(1, 1, -2, -2));
groovePainter.end();
- if (UsePixmapCache)
- QPixmapCache::insert(groovePixmapName, cache);
+ QPixmapCache::insert(groovePixmapName, cache);
}
if (horizontal) {
if (slider->upsideDown)
@@ -3501,8 +3538,8 @@ void QCleanlooksStyle::drawComplexControl(ComplexControl control, const QStyleOp
// draw handle
if ((option->subControls & SC_SliderHandle) ) {
- QString handlePixmapName = uniqueName(QLatin1String("slider_handle"), option, handle.size());
- if (!UsePixmapCache || !QPixmapCache::find(handlePixmapName, cache)) {
+ QString handlePixmapName = QStyleHelper::uniqueName(QLatin1String("slider_handle"), option, handle.size());
+ if (!QPixmapCache::find(handlePixmapName, cache)) {
cache = QPixmap(handle.size());
cache.fill(Qt::transparent);
QRect pixmapRect(0, 0, handle.width(), handle.height());
@@ -3542,10 +3579,13 @@ void QCleanlooksStyle::drawComplexControl(ComplexControl control, const QStyleOp
handlePainter.save();
handlePainter.setRenderHint(QPainter::Antialiasing);
handlePainter.translate(0.5, 0.5);
- handlePainter.drawLine(QPoint(r.left(), r.bottom() - 2), QPoint(r.left() + 2, r.bottom()));
- handlePainter.drawLine(QPoint(r.left(), r.top() + 2), QPoint(r.left() + 2, r.top()));
- handlePainter.drawLine(QPoint(r.right(), r.bottom() - 2), QPoint(r.right() - 2, r.bottom()));
- handlePainter.drawLine(QPoint(r.right(), r.top() + 2), QPoint(r.right() - 2, r.top()));
+ const QLine lines[4] = {
+ QLine(QPoint(r.left(), r.bottom() - 2), QPoint(r.left() + 2, r.bottom())),
+ QLine(QPoint(r.left(), r.top() + 2), QPoint(r.left() + 2, r.top())),
+ QLine(QPoint(r.right(), r.bottom() - 2), QPoint(r.right() - 2, r.bottom())),
+ QLine(QPoint(r.right(), r.top() + 2), QPoint(r.right() - 2, r.top()))
+ };
+ handlePainter.drawLines(lines, 4);
handlePainter.restore();;
handlePainter.setPen(QPen(outline.darker(130), 1));
handlePainter.drawLine(QPoint(r.left() + 3, r.top()), QPoint(r.right() - 3, r.top()));
@@ -3583,8 +3623,7 @@ void QCleanlooksStyle::drawComplexControl(ComplexControl control, const QStyleOp
}
}
handlePainter.end();
- if (UsePixmapCache)
- QPixmapCache::insert(handlePixmapName, cache);
+ QPixmapCache::insert(handlePixmapName, cache);
}
painter->drawPixmap(handle.topLeft(), cache);
@@ -3593,13 +3632,13 @@ void QCleanlooksStyle::drawComplexControl(ComplexControl control, const QStyleOp
QStyleOptionFocusRect fropt;
fropt.QStyleOption::operator=(*slider);
fropt.rect = slider->rect;
- drawPrimitive(PE_FrameFocusRect, &fropt, painter, widget);
+ proxy()->drawPrimitive(PE_FrameFocusRect, &fropt, painter, widget);
}
}
if (option->subControls & SC_SliderTickmarks) {
painter->setPen(darkOutline);
- int tickSize = pixelMetric(PM_SliderTickmarkOffset, option, widget);
- int available = pixelMetric(PM_SliderSpaceAvailable, slider, widget);
+ int tickSize = proxy()->pixelMetric(PM_SliderTickmarkOffset, option, widget);
+ int available = proxy()->pixelMetric(PM_SliderSpaceAvailable, slider, widget);
int interval = slider->tickInterval;
if (interval <= 0) {
interval = slider->singleStep;
@@ -3613,7 +3652,7 @@ void QCleanlooksStyle::drawComplexControl(ComplexControl control, const QStyleOp
interval = 1;
int v = slider->minimum;
- int len = pixelMetric(PM_SliderLength, slider, widget);
+ int len = proxy()->pixelMetric(PM_SliderLength, slider, widget);
while (v <= slider->maximum + 1) {
if (v == slider->maximum + 1 && interval == 1)
break;
@@ -3656,6 +3695,12 @@ void QCleanlooksStyle::drawComplexControl(ComplexControl control, const QStyleOp
}
break;
#endif // QT_NO_SLIDER
+#ifndef QT_NO_DIAL
+ case CC_Dial:
+ if (const QStyleOptionSlider *dial = qstyleoption_cast<const QStyleOptionSlider *>(option))
+ QStyleHelper::drawDial(dial, painter);
+ break;
+#endif // QT_NO_DIAL
default:
QWindowsStyle::drawComplexControl(control, option, painter, widget);
break;
@@ -3781,6 +3826,20 @@ QSize QCleanlooksStyle::sizeFromContents(ContentsType type, const QStyleOption *
}
break;
case CT_GroupBox:
+ // Since we use a bold font we have to recalculate base width
+ if (const QGroupBox *gb = qobject_cast<const QGroupBox*>(widget)) {
+ QFont font = gb->font();
+ font.setBold(true);
+ QFontMetrics metrics(font);
+ int baseWidth = metrics.width(gb->title()) + metrics.width(QLatin1Char(' '));
+ if (gb->isCheckable()) {
+ baseWidth += proxy()->pixelMetric(QStyle::PM_IndicatorWidth, option, widget);
+ baseWidth += proxy()->pixelMetric(QStyle::PM_CheckBoxLabelSpacing, option, widget);
+ }
+ newSize.setWidth(qMax(baseWidth, newSize.width()));
+ }
+ newSize += QSize(0, 1);
+ break;
case CT_RadioButton:
case CT_CheckBox:
newSize += QSize(0, 1);
@@ -3848,17 +3907,6 @@ QSize QCleanlooksStyle::sizeFromContents(ContentsType type, const QStyleOption *
void QCleanlooksStyle::polish(QApplication *app)
{
QWindowsStyle::polish(app);
-#ifdef Q_WS_X11
- Q_D(QCleanlooksStyle);
-
- QString dataDirs = QLatin1String(getenv("XDG_DATA_DIRS"));
-
- if (dataDirs.isEmpty())
- dataDirs = QLatin1String("/usr/local/share/:/usr/share/");
-
- dataDirs.prepend(QDir::homePath() + QLatin1String("/:"));
- d->iconDirs = dataDirs.split(QLatin1String(":"));
-#endif
}
/*!
@@ -3959,7 +4007,7 @@ QRect QCleanlooksStyle::subControlRect(ComplexControl control, const QStyleOptio
#ifndef QT_NO_SLIDER
case CC_Slider:
if (const QStyleOptionSlider *slider = qstyleoption_cast<const QStyleOptionSlider *>(option)) {
- int tickSize = pixelMetric(PM_SliderTickmarkOffset, option, widget);
+ int tickSize = proxy()->pixelMetric(PM_SliderTickmarkOffset, option, widget);
switch (subControl) {
case SC_SliderHandle: {
if (slider->orientation == Qt::Horizontal) {
@@ -4014,7 +4062,7 @@ QRect QCleanlooksStyle::subControlRect(ComplexControl control, const QStyleOptio
if (const QStyleOptionSpinBox *spinbox = qstyleoption_cast<const QStyleOptionSpinBox *>(option)) {
QSize bs;
int center = spinbox->rect.height() / 2;
- int fw = spinbox->frame ? pixelMetric(PM_SpinBoxFrameWidth, spinbox, widget) : 0;
+ int fw = spinbox->frame ? proxy()->pixelMetric(PM_SpinBoxFrameWidth, spinbox, widget) : 0;
int y = fw;
bs.setHeight(qMax(8, spinbox->rect.height()/2 - y));
bs.setWidth(15);
@@ -4055,7 +4103,7 @@ QRect QCleanlooksStyle::subControlRect(ComplexControl control, const QStyleOptio
if (const QStyleOptionGroupBox *groupBox = qstyleoption_cast<const QStyleOptionGroupBox *>(option)) {
int topMargin = 0;
int topHeight = 0;
- int verticalAlignment = styleHint(SH_GroupBox_TextLabelVerticalAlignment, groupBox, widget);
+ int verticalAlignment = proxy()->styleHint(SH_GroupBox_TextLabelVerticalAlignment, groupBox, widget);
bool flat = groupBox->features & QStyleOptionFrameV2::Flat;
if (!groupBox->text.isEmpty()) {
topHeight = groupBox->fontMetrics.height();
@@ -4086,8 +4134,8 @@ QRect QCleanlooksStyle::subControlRect(ComplexControl control, const QStyleOptio
QSize textRect = fontMetrics.boundingRect(groupBoxWidget->title()).size() + QSize(2, 2);
if (subControl == SC_GroupBoxCheckBox) {
- int indicatorWidth = pixelMetric(PM_IndicatorWidth, option, widget);
- int indicatorHeight = pixelMetric(PM_IndicatorHeight, option, widget);
+ int indicatorWidth = proxy()->pixelMetric(PM_IndicatorWidth, option, widget);
+ int indicatorHeight = proxy()->pixelMetric(PM_IndicatorHeight, option, widget);
rect.setWidth(indicatorWidth);
rect.setHeight(indicatorHeight);
rect.moveTop((fontMetrics.height() - indicatorHeight) / 2 + 2);
@@ -4108,7 +4156,7 @@ QRect QCleanlooksStyle::subControlRect(ComplexControl control, const QStyleOptio
rect = visualRect(option->direction, option->rect, rect);
break;
case SC_ComboBoxEditField: {
- int frameWidth = pixelMetric(PM_DefaultFrameWidth);
+ int frameWidth = proxy()->pixelMetric(PM_DefaultFrameWidth);
rect = visualRect(option->direction, option->rect, rect);
rect.setRect(option->rect.left() + frameWidth, option->rect.top() + frameWidth,
option->rect.width() - 19 - 2 * frameWidth,
@@ -4359,7 +4407,7 @@ QRect QCleanlooksStyle::subElementRect(SubElement sr, const QStyleOption *opt, c
if (verticalTitleBar) {
r.adjust(0, 0, 0, -4);
} else {
- if (QApplication::layoutDirection() == Qt::LeftToRight)
+ if (opt->direction == Qt::LeftToRight)
r.adjust(4, 0, 0, 0);
else
r.adjust(0, 0, -4, 0);
@@ -4376,44 +4424,6 @@ QRect QCleanlooksStyle::subElementRect(SubElement sr, const QStyleOption *opt, c
return r;
}
-void QCleanlooksStylePrivate::lookupIconTheme() const
-{
-#ifdef Q_WS_X11
-
- if (themeName.isEmpty()) {
- //resolve glib and gconf functions
- p_g_type_init = (Ptr_g_type_init)QLibrary::resolve(QLatin1String("gobject-2.0"), 0, "g_type_init");
- p_gconf_client_get_default = (Ptr_gconf_client_get_default)QLibrary::resolve(QLatin1String("gconf-2"), 4, "gconf_client_get_default");
- p_gconf_client_get_string = (Ptr_gconf_client_get_string)QLibrary::resolve(QLatin1String("gconf-2"), 4, "gconf_client_get_string");
- p_g_object_unref = (Ptr_g_object_unref)QLibrary::resolve(QLatin1String("gobject-2.0"), 0, "g_object_unref");
- p_g_error_free = (Ptr_g_error_free)QLibrary::resolve(QLatin1String("glib-2.0"), 0, "g_error_free");
- p_g_free = (Ptr_g_free)QLibrary::resolve(QLatin1String("glib-2.0"), 0, "g_free");
-
- if (p_g_type_init &&
- p_gconf_client_get_default &&
- p_gconf_client_get_string &&
- p_g_object_unref &&
- p_g_error_free &&
- p_g_free) {
-
- p_g_type_init();
- GConfClient* client = p_gconf_client_get_default();
- GError *err = 0;
- char *str = p_gconf_client_get_string(client, "/desktop/gnome/interface/icon_theme", &err);
- if (!err) {
- themeName = QString::fromUtf8(str);
- p_g_free(str);
- }
- p_g_object_unref(client);
- if (err)
- p_g_error_free (err);
- }
- if (themeName.isEmpty())
- themeName = QLatin1String("gnome");
- }
-#endif
-}
-
/*!
\internal
*/
@@ -4421,165 +4431,6 @@ QIcon QCleanlooksStyle::standardIconImplementation(StandardPixmap standardIcon,
const QStyleOption *option,
const QWidget *widget) const
{
-#ifdef Q_WS_X11
- Q_D(const QCleanlooksStyle);
- if (!qApp->desktopSettingsAware())
- return QWindowsStyle::standardIconImplementation(standardIcon, option, widget);
- QIcon icon;
- QPixmap pixmap;
- QPixmap link;
- d->lookupIconTheme();
- switch (standardIcon) {
- case SP_DirIcon: {
- icon = QIcon(standardPixmap(standardIcon, option, widget));
- icon.addPixmap(standardPixmap(SP_DirClosedIcon, option, widget),
- QIcon::Normal, QIcon::Off);
- pixmap = d->findIcon(16, QLatin1String("gnome-fs-directory.png"));
- if (!pixmap.isNull())
- icon.addPixmap(pixmap, QIcon::Normal, QIcon::Off);
- pixmap = d->findIcon(48, QLatin1String("gnome-fs-directory.png"));
- if (!pixmap.isNull())
- icon.addPixmap(pixmap, QIcon::Normal, QIcon::Off);
- pixmap = d->findIcon(16, QLatin1String("gnome-fs-directory-accept.png"));
- if (!pixmap.isNull())
- icon.addPixmap(pixmap, QIcon::Normal, QIcon::On);
- pixmap = d->findIcon(16, QLatin1String("gnome-fs-directory-accept.png"));
- if (!pixmap.isNull())
- icon.addPixmap(pixmap, QIcon::Normal, QIcon::On);
- }
- break;
- case SP_DirLinkIcon:
- {
- icon = QIcon(standardPixmap(standardIcon, option, widget));
- QPixmap link = d->findIcon(12, QLatin1String("emblem-symbolic-link.png"));
- if (!link.isNull()) {
- icon.addPixmap(standardPixmap(SP_DirLinkIcon, option, widget));
- pixmap = d->findIcon(16, QLatin1String("gnome-fs-directory.png"));
- if (!pixmap.isNull()) {
- QPainter painter(&pixmap);
- painter.drawPixmap(8, 8, 8, 8, link);
- painter.end();
- icon.addPixmap(pixmap);
- }
- }
- break;
- }
- case SP_FileIcon:
- {
- icon = d->createIcon(QLatin1String("unknown.png"));
- if (icon.isNull())
- icon = d->createIcon(QLatin1String("gnome-fs-regular.png"));
- if (icon.isNull())
- icon = d->createIcon(QLatin1String("stock_new.png"));
- break;
- }
- case SP_DialogCloseButton:
- {
- icon = d->createIcon(QLatin1String("gtk-close.png"));
- if (icon.isNull())
- icon = d->createIcon(QLatin1String("stock-close.png"));
- break;
- }
- case SP_DirHomeIcon:
- {
- icon = d->createIcon(QLatin1String("folder_home.png"));
- if (icon.isNull())
- icon = d->createIcon(QLatin1String("gnome_home.png"));
- break;
- }
- case SP_DriveFDIcon:
- {
- icon = d->createIcon(QLatin1String("gnome-dev-floppy.png"));
- break;
- }
- case SP_ComputerIcon:
- {
- icon = d->createIcon(QLatin1String("gnome-fs-client.png"));
- break;
- }
- case SP_DesktopIcon:
- {
- icon = d->createIcon(QLatin1String("gnome-fs-desktop.png"));
- break;
- }
- case SP_TrashIcon:
- {
- icon = d->createIcon(QLatin1String("gnome-fs-trash-empty.png"));
- break;
- }
- case SP_DriveCDIcon:
- case SP_DriveDVDIcon:
- {
- icon = d->createIcon(QLatin1String("gnome-dev-cdrom.png"));
- break;
- }
- case SP_DriveHDIcon:
- {
- icon = d->createIcon(QLatin1String("gnome-dev-harddisk.png"));
- break;
- }
- case SP_ArrowUp:
- {
- icon = d->createIcon(QLatin1String("stock_up.png"));
- break;
- }
- case SP_ArrowDown:
- {
- icon = d->createIcon(QLatin1String("stock_down.png"));
- break;
- }
- case SP_ArrowRight:
- {
- icon = d->createIcon(QLatin1String("stock_right.png"));
- break;
- }
- case SP_ArrowLeft:
- {
- icon = d->createIcon(QLatin1String("stock_left.png"));
- break;
- }
- case SP_BrowserReload:
- {
- icon = d->createIcon(QLatin1String("view-refresh.png"));
- break;
- }
- case SP_BrowserStop:
- {
- pixmap = d->findIcon(24, QLatin1String("stop.png"));
- break;
- }
- case SP_FileLinkIcon:
- {
- icon = QIcon(standardPixmap(standardIcon, option, widget));
- QPixmap link = d->findIcon(12, QLatin1String("emblem-symbolic-link.png"));
- if (!link.isNull()) {
- icon.addPixmap(standardPixmap(SP_FileLinkIcon,option, widget));
- pixmap = d->findIcon(16, QLatin1String("unknown.png"));
- if (pixmap.isNull())
- pixmap = d->findIcon(16, QLatin1String("stock_new.png"));
- if (!pixmap.isNull()) {
- QPainter painter(&pixmap);
- painter.drawPixmap(8, 8, 8, 8, link);
- painter.end();
- icon.addPixmap(pixmap);
- }
- }
- break;
- }
- case SP_ArrowForward:
- if (QApplication::layoutDirection() == Qt::RightToLeft)
- return standardIconImplementation(SP_ArrowLeft, option, widget);
- return standardIconImplementation(SP_ArrowRight, option, widget);
- case SP_ArrowBack:
- if (QApplication::layoutDirection() == Qt::RightToLeft)
- return standardIconImplementation(SP_ArrowRight, option, widget);
- return standardIconImplementation(SP_ArrowLeft, option, widget);
- default:
- icon = QIcon(standardPixmap(standardIcon, option, widget));
- }
- if (!icon.isNull())
- return icon;
-#endif // Q_WS_X11
return QWindowsStyle::standardIconImplementation(standardIcon, option, widget);
}
@@ -4589,341 +4440,10 @@ QIcon QCleanlooksStyle::standardIconImplementation(StandardPixmap standardIcon,
QPixmap QCleanlooksStyle::standardPixmap(StandardPixmap standardPixmap, const QStyleOption *opt,
const QWidget *widget) const
{
-#ifdef Q_WS_X11
- Q_D(const QCleanlooksStyle);
QPixmap pixmap;
- if (!qApp->desktopSettingsAware())
- return QWindowsStyle::standardPixmap(standardPixmap, opt, widget);
- d->lookupIconTheme();
+
#ifndef QT_NO_IMAGEFORMAT_XPM
switch (standardPixmap) {
- case SP_MessageBoxInformation:
- {
- pixmap = d->findIcon(48, QLatin1String("dialog-info.png"));
- if (pixmap.isNull())
- pixmap = d->findIcon(48, QLatin1String("stock_dialog-info.png"));
- if (!pixmap.isNull())
- return pixmap;
- break;
- }
- case SP_MessageBoxWarning:
- {
- pixmap = d->findIcon(48, QLatin1String("dialog-warning.png"));
- if (pixmap.isNull())
- pixmap = d->findIcon(48, QLatin1String("stock_dialog-warning.png"));
- if (!pixmap.isNull())
- return pixmap;
- break;
- }
- case SP_MessageBoxCritical:
- {
- pixmap = d->findIcon(48, QLatin1String("dialog-error.png"));
- if (pixmap.isNull())
- pixmap = d->findIcon(48, QLatin1String("stock_dialog-error.png"));
- if (!pixmap.isNull())
- return pixmap;
- break;
- }
- case SP_MessageBoxQuestion:
- {
- pixmap = d->findIcon(48, QLatin1String("dialog-question.png"));
- if (!pixmap.isNull())
- return pixmap;
- break;
- }
- case SP_DirHomeIcon:
- {
- pixmap = d->findIcon(16, QLatin1String("folder_home.png"));
- if (pixmap.isNull())
- pixmap = d->findIcon(16, QLatin1String("gnome_home.png"));
- if (!pixmap.isNull())
- return pixmap;
- break;
- }
- case SP_DialogOpenButton:
- case SP_DirOpenIcon:
- {
- pixmap = d->findIcon(24, QLatin1String("stock_open.png"));
- if (!pixmap.isNull())
- return pixmap;
- break;
- }
- case SP_FileIcon:
- {
- pixmap = d->findIcon(24, QLatin1String("unknown.png"));
- if (pixmap.isNull())
- pixmap = d->findIcon(24, QLatin1String("gnome-fs-regular.png"));
- if (pixmap.isNull())
- pixmap = d->findIcon(24, QLatin1String("stock_new.png"));
- if (!pixmap.isNull())
- return pixmap;
- break;
- }
- case SP_FileLinkIcon:
- {
- pixmap = d->findIcon(24, QLatin1String("emblem-symbolic-link.png"));
- if (!pixmap.isNull()) {
- QPixmap fileIcon = d->findIcon(24, QLatin1String("unknown.png"));
- if (fileIcon.isNull())
- fileIcon = d->findIcon(24, QLatin1String("stock_new.png"));
- if (!fileIcon.isNull()) {
- QPainter painter(&fileIcon);
- painter.setRenderHint(QPainter::SmoothPixmapTransform);
- painter.drawPixmap(12, 12, 12, 12, pixmap);
- return fileIcon;
- }
- }
- break;
- }
- case SP_DirClosedIcon:
- case SP_DirIcon:
- {
- pixmap = d->findIcon(24, QLatin1String("gnome-fs-directory.png"));
- if (!pixmap.isNull())
- return pixmap;
- break;
- }
- case SP_DirLinkIcon:
- {
- pixmap = d->findIcon(24, QLatin1String("emblem-symbolic-link.png"));
- if (!pixmap.isNull()) {
- QPixmap dirIcon = d->findIcon(24, QLatin1String("gnome-fs-directory.png"));
- if (!dirIcon.isNull()) {
- QPainter painter(&dirIcon);
- painter.setRenderHint(QPainter::SmoothPixmapTransform);
- painter.drawPixmap(12, 12, 12, 12, pixmap);
- return dirIcon;
- }
- }
- break;
- }
- case SP_DriveFDIcon:
- {
- pixmap = d->findIcon(24, QLatin1String("gnome-dev-floppy.png"));
- if (!pixmap.isNull())
- return pixmap;
- break;
- }
- case SP_ComputerIcon:
- {
- pixmap = d->findIcon(24, QLatin1String("gnome-fs-client.png"));
- if (!pixmap.isNull())
- return pixmap;
- break;
- }
- case SP_DesktopIcon:
- {
- pixmap = d->findIcon(24, QLatin1String("gnome-fs-desktop.png"));
- if (!pixmap.isNull())
- return pixmap;
- break;
- }
- case SP_TrashIcon:
- {
- pixmap = d->findIcon(24, QLatin1String("gnome-fs-trash-empty.png"));
- if (!pixmap.isNull())
- return pixmap;
- break;
- }
- case SP_DriveCDIcon:
- case SP_DriveDVDIcon:
- {
- pixmap = d->findIcon(24, QLatin1String("gnome-dev-cdrom.png"));
- if (!pixmap.isNull())
- return pixmap;
- break;
- }
- case SP_DriveHDIcon:
- {
- pixmap = d->findIcon(24, QLatin1String("gnome-dev-harddisk.png"));
- if (!pixmap.isNull())
- return pixmap;
- break;
- }
- case SP_FileDialogToParent:
- {
- pixmap = d->findIcon(16, QLatin1String("stock_up.png"));
- if (!pixmap.isNull())
- return pixmap;
- break;
- }
- case SP_FileDialogNewFolder:
- {
- pixmap = d->findIcon(16, QLatin1String("stock_new-dir.png"));
- if (!pixmap.isNull())
- return pixmap;
- break;
- }
- case SP_ArrowUp:
- {
- pixmap = d->findIcon(16, QLatin1String("stock_up.png"));
- if (!pixmap.isNull())
- return pixmap;
- break;
- }
- case SP_ArrowDown:
- {
- pixmap = d->findIcon(16, QLatin1String("stock_down.png"));
- if (!pixmap.isNull())
- return pixmap;
- break;
- }
- case SP_ArrowRight:
- {
- pixmap = d->findIcon(16, QLatin1String("stock_right.png"));
- if (!pixmap.isNull())
- return pixmap;
- break;
- }
- case SP_ArrowLeft:
- {
- pixmap = d->findIcon(16, QLatin1String("stock_left.png"));
- if (!pixmap.isNull())
- return pixmap;
- break;
- }
- case SP_DialogCloseButton:
- {
- pixmap = d->findIcon(24, QLatin1String("gtk-close.png"));
- if (pixmap.isNull())
- pixmap = d->findIcon(24, QLatin1String("stock-close.png"));
- if (!pixmap.isNull())
- return pixmap;
- break;
- }
- case SP_DialogApplyButton:
- {
- pixmap = d->findIcon(24, QLatin1String("dialog-apply.png"));
- if (pixmap.isNull())
- pixmap = d->findIcon(24, QLatin1String("stock-apply.png"));
- if (!pixmap.isNull())
- return pixmap;
- break;
- }
- case SP_DialogResetButton:
- {
- pixmap = d->findIcon(24, QLatin1String("gtk-clear.png"));
- if (!pixmap.isNull())
- return pixmap;
- break;
- }
- case SP_DialogHelpButton:
- {
- pixmap = d->findIcon(24, QLatin1String("gtk-help.png"));
- if (!pixmap.isNull())
- return pixmap;
- break;
- }
- case SP_DialogOkButton:
- {
- pixmap = d->findIcon(24, QLatin1String("dialog-ok.png"));
- if (pixmap.isNull())
- pixmap = d->findIcon(24, QLatin1String("stock-ok.png"));
- if (!pixmap.isNull())
- return pixmap;
- break;
- }
- case SP_DialogCancelButton:
- {
- pixmap = d->findIcon(24, QLatin1String("dialog-cancel.png"));
- if (pixmap.isNull())
- pixmap = d->findIcon(24, QLatin1String("stock-cancel.png"));
- if (pixmap.isNull())
- pixmap = d->findIcon(24, QLatin1String("process-stop.png"));
- if (!pixmap.isNull())
- return pixmap;
- break;
- }
- case SP_DialogSaveButton:
- {
- pixmap = d->findIcon(24, QLatin1String("stock_save.png"));
- if (!pixmap.isNull())
- return pixmap;
- break;
- }
- case SP_BrowserStop:
- {
- pixmap = d->findIcon(16, QLatin1String("process-stop.png"));
- if (!pixmap.isNull())
- return pixmap;
- break;
- }
- case SP_BrowserReload:
- {
- pixmap = d->findIcon(16, QLatin1String("view-refresh.png"));
- if (!pixmap.isNull())
- return pixmap;
- break;
- }
- case SP_MediaPlay:
- {
- pixmap = d->findIcon(24, QLatin1String("media-playback-start.png"));
- if (!pixmap.isNull())
- return pixmap;
- break;
- }
- case SP_MediaPause:
- {
- pixmap = d->findIcon(24, QLatin1String("media-playback-pause.png"));
- if (!pixmap.isNull())
- return pixmap;
- break;
- }
- case SP_MediaStop:
- {
- pixmap = d->findIcon(24, QLatin1String("media-playback-stop.png"));
- if (!pixmap.isNull())
- return pixmap;
- break;
- }
- case SP_MediaVolume:
- {
- pixmap = d->findIcon(16, QLatin1String("audio-volume-medium.png"));
- if (!pixmap.isNull())
- return pixmap;
- break;
- }
- case SP_MediaVolumeMuted:
- {
- pixmap = d->findIcon(16, QLatin1String("audio-volume-muted.png"));
- if (!pixmap.isNull())
- return pixmap;
- break;
- }
- case SP_MediaSeekForward:
- {
- pixmap = d->findIcon(24, QLatin1String("media-seek-forward.png"));
- if (!pixmap.isNull())
- return pixmap;
- break;
- }
- case SP_MediaSeekBackward:
- {
- pixmap = d->findIcon(24, QLatin1String("media-seek-backward.png"));
- if (!pixmap.isNull())
- return pixmap;
- break;
- }
- case SP_MediaSkipForward:
- {
- pixmap = d->findIcon(24, QLatin1String("media-skip-forward.png"));
- if (!pixmap.isNull())
- return pixmap;
- break;
- }
- case SP_MediaSkipBackward:
- {
- pixmap = d->findIcon(24, QLatin1String("media-skip-backward.png"));
- if (!pixmap.isNull())
- return pixmap;
- break;
- }
- case SP_TitleBarMenuButton:
- case SP_TitleBarShadeButton:
- case SP_TitleBarUnshadeButton:
- case SP_TitleBarMaxButton:
- case SP_TitleBarContextHelpButton:
- return QWindowsStyle::standardPixmap(standardPixmap, opt, widget);
case SP_TitleBarNormalButton:
return QPixmap((const char **)dock_widget_restore_xpm);
case SP_TitleBarMinButton:
@@ -4936,7 +4456,7 @@ QPixmap QCleanlooksStyle::standardPixmap(StandardPixmap standardPixmap, const QS
break;
}
#endif //QT_NO_IMAGEFORMAT_XPM
-#endif //Q_WS_X11
+
return QWindowsStyle::standardPixmap(standardPixmap, opt, widget);
}
diff --git a/src/gui/styles/qcleanlooksstyle.h b/src/gui/styles/qcleanlooksstyle.h
index 33defb9..a0e148c 100644
--- a/src/gui/styles/qcleanlooksstyle.h
+++ b/src/gui/styles/qcleanlooksstyle.h
@@ -1,7 +1,6 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the QtGui module of the Qt Toolkit.
@@ -21,9 +20,10 @@
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.1, included in the file LGPL_EXCEPTION.txt in this
+** package.
**
** If you have questions regarding the use of this file, please contact
** Nokia at qt-info@nokia.com.
diff --git a/src/gui/styles/qcleanlooksstyle_p.h b/src/gui/styles/qcleanlooksstyle_p.h
index f192efb..57401bb 100644
--- a/src/gui/styles/qcleanlooksstyle_p.h
+++ b/src/gui/styles/qcleanlooksstyle_p.h
@@ -1,7 +1,6 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the QtGui module of the Qt Toolkit.
@@ -21,9 +20,10 @@
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.1, included in the file LGPL_EXCEPTION.txt in this
+** package.
**
** If you have questions regarding the use of this file, please contact
** Nokia at qt-info@nokia.com.
@@ -71,8 +71,6 @@ public:
~QCleanlooksStylePrivate() {
}
-
- void lookupIconTheme() const;
};
QT_END_NAMESPACE
diff --git a/src/gui/styles/qcommonstyle.cpp b/src/gui/styles/qcommonstyle.cpp
index 9ffc0dd..817401e 100644
--- a/src/gui/styles/qcommonstyle.cpp
+++ b/src/gui/styles/qcommonstyle.cpp
@@ -1,7 +1,6 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the QtGui module of the Qt Toolkit.
@@ -21,9 +20,10 @@
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.1, included in the file LGPL_EXCEPTION.txt in this
+** package.
**
** If you have questions regarding the use of this file, please contact
** Nokia at qt-info@nokia.com.
@@ -63,9 +63,10 @@
#include <qtoolbar.h>
#include <qtoolbutton.h>
#include <qrubberband.h>
-#include <private/qapplication_p.h>
+#include <../kernel/qkde_p.h>
#include <private/qcommonstylepixmaps_p.h>
#include <private/qmath_p.h>
+#include <private/qstylehelper_p.h>
#include <qdebug.h>
#include <qtextformat.h>
#include <qwizard.h>
@@ -83,6 +84,8 @@
#ifdef Q_WS_X11
# include <private/qt_x11_p.h>
+#elif defined(Q_WS_MAC)
+# include <private/qt_cocoa_helpers_mac_p.h>
#endif
QT_BEGIN_NAMESPACE
@@ -124,9 +127,7 @@ QCommonStyle::QCommonStyle(QCommonStylePrivate &dd)
{ }
/*!
- \overload
-
- Destroys the style
+ Destroys the style.
*/
QCommonStyle::~QCommonStyle()
{ }
@@ -154,7 +155,7 @@ void QCommonStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, Q
&opt->palette.brush(QPalette::Button));
break;
case PE_IndicatorViewItemCheck:
- drawPrimitive(PE_IndicatorCheckBox, opt, p, widget);
+ proxy()->drawPrimitive(PE_IndicatorCheckBox, opt, p, widget);
break;
case PE_IndicatorCheckBox:
if (opt->state & State_NoChange) {
@@ -504,7 +505,7 @@ void QCommonStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, Q
QIcon::Active, QIcon::Off);
}
- int size = pixelMetric(QStyle::PM_SmallIconSize);
+ int size = proxy()->pixelMetric(QStyle::PM_SmallIconSize);
QIcon::Mode mode = opt->state & State_Enabled ?
(opt->state & State_Raised ? QIcon::Active : QIcon::Normal)
: QIcon::Disabled;
@@ -515,7 +516,7 @@ void QCommonStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, Q
QIcon::State state = opt->state & State_Sunken ? QIcon::On : QIcon::Off;
QPixmap pixmap = d->tabBarcloseButtonIcon.pixmap(size, mode, state);
- drawItemPixmap(p, opt->rect, Qt::AlignCenter, pixmap);
+ proxy()->drawItemPixmap(p, opt->rect, Qt::AlignCenter, pixmap);
break;
}
#endif // QT_NO_TABBAR
@@ -524,7 +525,7 @@ void QCommonStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, Q
qDrawWinPanel(p, opt->rect, opt->palette, false, 0);
break;
case PE_FrameLineEdit:
- drawPrimitive(PE_Frame, opt, p, widget);
+ proxy()->drawPrimitive(PE_Frame, opt, p, widget);
break;
#ifndef QT_NO_GROUPBOX
case PE_FrameGroupBox:
@@ -549,7 +550,7 @@ void QCommonStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, Q
if (const QStyleOptionFrame *frame = qstyleoption_cast<const QStyleOptionFrame *>(opt)) {
int lw = frame->lineWidth;
if (lw <= 0)
- lw = pixelMetric(PM_DockWidgetFrameWidth);
+ lw = proxy()->pixelMetric(PM_DockWidgetFrameWidth);
qDrawShadePanel(p, frame->rect, frame->palette, false, lw);
}
@@ -561,7 +562,7 @@ void QCommonStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, Q
p->translate(opt->rect.x(), opt->rect.y());
if (opt->state & State_Horizontal) {
int x = opt->rect.width() / 3;
- if (QApplication::layoutDirection() == Qt::RightToLeft)
+ if (opt->direction == Qt::RightToLeft)
x -= 2;
if (opt->rect.height() > 4) {
qDrawShadePanel(p, x, 2, 3, opt->rect.height() - 4,
@@ -581,7 +582,7 @@ void QCommonStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, Q
p->restore();
break;
case PE_Q3DockWindowSeparator:
- drawPrimitive(PE_IndicatorToolBarSeparator, opt, p, widget);
+ proxy()->drawPrimitive(PE_IndicatorToolBarSeparator, opt, p, widget);
break;
case PE_IndicatorToolBarSeparator:
{
@@ -601,7 +602,7 @@ void QCommonStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, Q
case PE_IndicatorSpinPlus:
case PE_IndicatorSpinMinus: {
QRect r = opt->rect;
- int fw = pixelMetric(PM_DefaultFrameWidth, opt, widget);
+ int fw = proxy()->pixelMetric(PM_DefaultFrameWidth, opt, widget);
QRect br = r.adjusted(fw, fw, -fw, -fw);
int offset = (opt->state & State_Sunken) ? 1 : 0;
@@ -618,7 +619,7 @@ void QCommonStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, Q
case PE_IndicatorSpinUp:
case PE_IndicatorSpinDown: {
QRect r = opt->rect;
- int fw = pixelMetric(PM_DefaultFrameWidth, opt, widget);
+ int fw = proxy()->pixelMetric(PM_DefaultFrameWidth, opt, widget);
// QRect br = r.adjusted(fw, fw, -fw, -fw);
int x = r.x(), y = r.y(), w = r.width(), h = r.height();
int sw = w-4;
@@ -643,8 +644,8 @@ void QCommonStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, Q
int bsx = 0;
int bsy = 0;
if (opt->state & State_Sunken) {
- bsx = pixelMetric(PM_ButtonShiftHorizontal);
- bsy = pixelMetric(PM_ButtonShiftVertical);
+ bsx = proxy()->pixelMetric(PM_ButtonShiftHorizontal);
+ bsy = proxy()->pixelMetric(PM_ButtonShiftVertical);
}
p->save();
p->translate(sx + bsx, sy + bsy);
@@ -693,7 +694,7 @@ void QCommonStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, Q
panel->palette.brush(QPalette::Base));
if (panel->lineWidth > 0)
- drawPrimitive(PE_FrameLineEdit, panel, p, widget);
+ proxy()->drawPrimitive(PE_FrameLineEdit, panel, p, widget);
}
break;
#endif // QT_NO_LINEEDIT
@@ -765,10 +766,12 @@ void QCommonStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, Q
if (cg == QPalette::Normal && !(vopt->state & QStyle::State_Active))
cg = QPalette::Inactive;
- if ((vopt->state & QStyle::State_Selected) && styleHint(QStyle::SH_ItemView_ShowDecorationSelected, opt, widget))
+ if ((vopt->state & QStyle::State_Selected) && proxy()->styleHint(QStyle::SH_ItemView_ShowDecorationSelected, opt, widget))
p->fillRect(vopt->rect, vopt->palette.brush(cg, QPalette::Highlight));
else if (vopt->features & QStyleOptionViewItemV2::Alternate)
p->fillRect(vopt->rect, vopt->palette.brush(cg, QPalette::AlternateBase));
+ else if (!(vopt->state & QStyle::State_Enabled))
+ p->fillRect(vopt->rect, vopt->palette.brush(cg, QPalette::Base));
}
break;
case PE_PanelItemViewItem:
@@ -835,171 +838,36 @@ static void drawArrow(const QStyle *style, const QStyleOptionToolButton *toolbut
#endif // QT_NO_TOOLBUTTON
-
#ifdef Q_WS_X11 // These functions are used to parse the X11 freedesktop icon spec
-void QCommonStylePrivate::lookupIconTheme() const
-{
- if (!themeName.isEmpty())
- return;
-
- QString dataDirs = QString::fromLocal8Bit(getenv("XDG_DATA_DIRS"));
- if (dataDirs.isEmpty())
- dataDirs = QLatin1String("/usr/local/share/:/usr/share/");
- dataDirs += QLatin1Char(':') + QApplicationPrivate::kdeHome() + QLatin1String("/share");
- dataDirs.prepend(QDir::homePath() + QLatin1String("/:"));
- QStringList kdeDirs = QString::fromLocal8Bit(getenv("KDEDIRS")).split(QLatin1Char(':'), QString::SkipEmptyParts);
- foreach (const QString &dirName, kdeDirs)
- dataDirs.append(QLatin1String(":") + dirName + QLatin1String("/share"));
- iconDirs = dataDirs.split(QLatin1Char(':'));
-
- QFileInfo fileInfo(QLatin1String("/usr/share/icons/default.kde"));
- QDir dir(fileInfo.canonicalFilePath());
- int kdeVersion = qgetenv("KDE_SESSION_VERSION").toInt();
- QString kdeDefault = kdeVersion >= 4 ? QString::fromLatin1("oxygen") : QString::fromLatin1("crystalsvg");
- QString defaultTheme = fileInfo.exists() ? dir.dirName() : kdeDefault;
- QSettings settings(QApplicationPrivate::kdeHome() +
- QLatin1String("/share/config/kdeglobals"), QSettings::IniFormat);
- settings.beginGroup(QLatin1String("Icons"));
- themeName = settings.value(QLatin1String("Theme"), defaultTheme).toString();
-}
-
-QIconTheme QCommonStylePrivate::parseIndexFile(const QString &themeName) const
-{
- Q_Q(const QCommonStyle);
- QIconTheme theme;
- QFile themeIndex;
- QStringList parents;
- QHash <int, QString> dirList;
-
- for ( int i = 0 ; i < iconDirs.size() && !themeIndex.exists() ; ++i) {
- QString contentDir = QLatin1String(iconDirs[i].startsWith(QDir::homePath()) ?
- "/.icons/" : "/icons/");
- themeIndex.setFileName(iconDirs[i] + contentDir +
- themeName + QLatin1String("/index.theme"));
- }
-
- if (themeIndex.open(QIODevice::ReadOnly | QIODevice::Text)) {
-
- QTextStream in(&themeIndex);
-
- while (!in.atEnd()) {
-
- QString line = in.readLine();
-
- if (line.startsWith(QLatin1String("Inherits="))) {
- line = line.right(line.length() - 9);
- parents = line.split(QLatin1Char(','));
- }
-
- if (line.startsWith(QLatin1String("["))) {
- line = line.trimmed();
- line.chop(1);
- QString dirName = line.right(line.length() - 1);
- if (!in.atEnd()) {
- line = in.readLine();
- int size;
- if (line.startsWith(QLatin1String("Size="))) {
- size = line.right(line.length() - 5).toInt();
- if (size)
- dirList.insertMulti(size, dirName);
- }
- }
- }
- }
- }
-
- if (q->inherits("QPlastiqueStyle")) {
- QFileInfo fileInfo(QLatin1String("/usr/share/icons/default.kde"));
- QDir dir(fileInfo.canonicalFilePath());
- QString defaultKDETheme = dir.exists() ? dir.dirName() : QString::fromLatin1("crystalsvg");
- if (!parents.contains(defaultKDETheme) && themeName != defaultKDETheme)
- parents.append(defaultKDETheme);
- } else if (parents.isEmpty() && themeName != QLatin1String("hicolor")) {
- parents.append(QLatin1String("hicolor"));
- }
- theme = QIconTheme(dirList, parents);
- return theme;
-}
-
-QPixmap QCommonStylePrivate::findIconHelper(int size,
- const QString &themeName,
- const QString &iconName,
- QStringList &visited) const
-{
- QPixmap pixmap;
-
- if (!themeName.isEmpty()) {
-
- visited << themeName;
- QIconTheme theme = themeList.value(themeName);
-
- if (!theme.isValid()) {
- theme = parseIndexFile(themeName);
- themeList.insert(themeName, theme);
- }
-
- if (!theme.isValid())
- return QPixmap();
-
- QList <QString> subDirs = theme.dirList().values(size);
-
- for ( int i = 0 ; i < iconDirs.size() ; ++i) {
- for ( int j = 0 ; j < subDirs.size() ; ++j) {
- QString contentDir = (iconDirs[i].startsWith(QDir::homePath())) ?
- QLatin1String("/.icons/") : QLatin1String("/icons/");
- QString fileName = iconDirs[i] + contentDir + themeName + QLatin1Char('/') + subDirs[j] + QLatin1Char('/') + iconName;
- QFile file(fileName);
- if (file.exists())
- pixmap.load(fileName);
- if (!pixmap.isNull())
- break;
- }
- }
+/*!internal
- if (pixmap.isNull()) {
- QStringList parents = theme.parents();
- //search recursively through inherited themes
- for (int i = 0 ; pixmap.isNull() && i < parents.size() ; ++i) {
- QString parentTheme = parents[i].trimmed();
- if (!visited.contains(parentTheme)) //guard against endless recursion
- pixmap = findIconHelper(size, parentTheme, iconName, visited);
- }
- }
- }
- return pixmap;
-}
+Checks if you are running KDE and looks up the toolbar
+from the KDE configuration file
-QPixmap QCommonStylePrivate::findIcon(int size, const QString &name) const
+*/
+int QCommonStylePrivate::lookupToolButtonStyle() const
{
- QPixmap pixmap;
- QString pixmapName = QLatin1String("$qt") + name + QString::number(size);
-
- if (QPixmapCache::find(pixmapName, pixmap))
- return pixmap;
-
- if (!themeName.isEmpty()) {
- QStringList visited;
- pixmap = findIconHelper(size, themeName, name, visited);
+ int result = Qt::ToolButtonIconOnly;
+ if (X11->desktopEnvironment == DE_KDE && X11->desktopVersion >= 4) {
+ QSettings settings(QKde::kdeHome() +
+ QLatin1String("/share/config/kdeglobals"), QSettings::IniFormat);
+ settings.beginGroup(QLatin1String("Toolbar style"));
+ QString toolbarStyle = settings.value(QLatin1String("ToolButtonStyle"), QLatin1String("TextBesideIcon")).toString();
+ if (toolbarStyle == QLatin1String("TextBesideIcon"))
+ result = Qt::ToolButtonTextBesideIcon;
+ else if (toolbarStyle == QLatin1String("TextOnly"))
+ result = Qt::ToolButtonTextOnly;
+ else if (toolbarStyle == QLatin1String("TextUnderIcon"))
+ result = Qt::ToolButtonTextUnderIcon;
}
- QPixmapCache::insert(pixmapName, pixmap);
- return pixmap;
-}
-
-QIcon QCommonStylePrivate::createIcon(const QString &name) const
-{
- QIcon icon;
- icon.addPixmap(findIcon(16, name));
- icon.addPixmap(findIcon(24, name));
- icon.addPixmap(findIcon(32, name));
- return icon;
+ return result;
}
#endif //Q_WS_X11
#ifndef QT_NO_ITEMVIEWS
-
QSize QCommonStylePrivate::viewItemSize(const QStyleOptionViewItemV4 *option, int role) const
{
Q_Q(const QCommonStyle);
@@ -1152,8 +1020,14 @@ void QCommonStylePrivate::viewItemDrawText(QPainter *p, const QStyleOptionViewIt
}
}
-/* Set sizehint to false to layout the elements inside opt->rect. Set sizehint to true to ignore
- opt->rect and return rectangles in infinite space */
+/*! \internal
+ compute the position for the different component of an item (pixmap, text, checkbox)
+
+ Set sizehint to false to layout the elements inside opt->rect. Set sizehint to true to ignore
+ opt->rect and return rectangles in infinite space
+
+ Code duplicated in QItemDelegate::doLayout
+*/
void QCommonStylePrivate::viewItemLayout(const QStyleOptionViewItemV4 *opt, QRect *checkRect,
QRect *pixmapRect, QRect *textRect, bool sizehint) const
{
@@ -1174,8 +1048,10 @@ void QCommonStylePrivate::viewItemLayout(const QStyleOptionViewItemV4 *opt, QRe
int y = opt->rect.top();
int w, h;
- if (textRect->height() == 0 && !hasPixmap)
+ if (textRect->height() == 0 && (!hasPixmap || !sizehint)) {
+ //if there is no text, we still want to have a decent height for the item sizeHint and the editor size
textRect->setHeight(opt->fontMetrics.height());
+ }
QSize pm(0, 0);
if (hasPixmap) {
@@ -1279,6 +1155,75 @@ void QCommonStylePrivate::viewItemLayout(const QStyleOptionViewItemV4 *opt, QRe
}
#endif // QT_NO_ITEMVIEWS
+
+#ifndef QT_NO_TABBAR
+/*! \internal
+ Compute the textRect and the pixmapRect from the opt rect
+
+ Uses the same computation than in QTabBar::tabSizeHint
+ */
+void QCommonStylePrivate::tabLayout(const QStyleOptionTabV3 *opt, const QWidget *widget, QRect *textRect, QRect *iconRect) const
+{
+ Q_ASSERT(textRect);
+ Q_ASSERT(iconRect);
+ QRect tr = opt->rect;
+ bool verticalTabs = opt->shape == QTabBar::RoundedEast
+ || opt->shape == QTabBar::RoundedWest
+ || opt->shape == QTabBar::TriangularEast
+ || opt->shape == QTabBar::TriangularWest;
+ if (verticalTabs)
+ tr.setRect(0, 0, tr.height(), tr.width()); //0, 0 as we will have a translate transform
+
+ int verticalShift = proxyStyle->pixelMetric(QStyle::PM_TabBarTabShiftVertical, opt, widget);
+ int horizontalShift = proxyStyle->pixelMetric(QStyle::PM_TabBarTabShiftHorizontal, opt, widget);
+ int hpadding = proxyStyle->pixelMetric(QStyle::PM_TabBarTabHSpace, opt, widget) / 2;
+ int vpadding = proxyStyle->pixelMetric(QStyle::PM_TabBarTabVSpace, opt, widget) / 2;
+ if (opt->shape == QTabBar::RoundedSouth || opt->shape == QTabBar::TriangularSouth)
+ verticalShift = -verticalShift;
+ tr.adjust(hpadding, vpadding, horizontalShift - hpadding, verticalShift - vpadding);
+ bool selected = opt->state & QStyle::State_Selected;
+ if (selected) {
+ tr.setBottom(tr.bottom() - verticalShift);
+ tr.setRight(tr.right() - horizontalShift);
+ }
+
+ // left widget
+ if (!opt->leftButtonSize.isEmpty()) {
+ tr.setLeft(tr.left() + 4 +
+ (verticalTabs ? opt->leftButtonSize.height() : opt->leftButtonSize.width()));
+ }
+ // right widget
+ if (!opt->rightButtonSize.isEmpty()) {
+ tr.setRight(tr.right() - 4 -
+ (verticalTabs ? opt->rightButtonSize.height() : opt->rightButtonSize.width()));
+ }
+
+ // icon
+ if (!opt->icon.isNull()) {
+ QSize iconSize = opt->iconSize;
+ if (!iconSize.isValid()) {
+ int iconExtent = proxyStyle->pixelMetric(QStyle::PM_SmallIconSize);
+ iconSize = QSize(iconExtent, iconExtent);
+ }
+ QSize tabIconSize = opt->icon.actualSize(iconSize,
+ (opt->state & QStyle::State_Enabled) ? QIcon::Normal : QIcon::Disabled,
+ (opt->state & QStyle::State_Selected) ? QIcon::On : QIcon::Off );
+
+ *iconRect = QRect(tr.left(), tr.center().y() - tabIconSize.height() / 2,
+ tabIconSize.width(), tabIconSize .height());
+ if (!verticalTabs)
+ *iconRect = proxyStyle->visualRect(opt->direction, opt->rect, *iconRect);
+ tr.setLeft(tr.left() + tabIconSize.width() + 4);
+ }
+
+ if (!verticalTabs)
+ tr = proxyStyle->visualRect(opt->direction, opt->rect, tr);
+
+ *textRect = tr;
+}
+#endif //QT_NO_TABBAR
+
+
/*!
\reimp
*/
@@ -1290,24 +1235,24 @@ void QCommonStyle::drawControl(ControlElement element, const QStyleOption *opt,
case CE_PushButton:
if (const QStyleOptionButton *btn = qstyleoption_cast<const QStyleOptionButton *>(opt)) {
- drawControl(CE_PushButtonBevel, btn, p, widget);
+ proxy()->drawControl(CE_PushButtonBevel, btn, p, widget);
QStyleOptionButton subopt = *btn;
subopt.rect = subElementRect(SE_PushButtonContents, btn, widget);
- drawControl(CE_PushButtonLabel, &subopt, p, widget);
+ proxy()->drawControl(CE_PushButtonLabel, &subopt, p, widget);
if (btn->state & State_HasFocus) {
QStyleOptionFocusRect fropt;
fropt.QStyleOption::operator=(*btn);
fropt.rect = subElementRect(SE_PushButtonFocusRect, btn, widget);
- drawPrimitive(PE_FrameFocusRect, &fropt, p, widget);
+ proxy()->drawPrimitive(PE_FrameFocusRect, &fropt, p, widget);
}
}
break;
case CE_PushButtonBevel:
if (const QStyleOptionButton *btn = qstyleoption_cast<const QStyleOptionButton *>(opt)) {
QRect br = btn->rect;
- int dbi = pixelMetric(PM_ButtonDefaultIndicator, btn, widget);
+ int dbi = proxy()->pixelMetric(PM_ButtonDefaultIndicator, btn, widget);
if (btn->features & QStyleOptionButton::DefaultButton)
- drawPrimitive(PE_FrameDefaultButton, opt, p, widget);
+ proxy()->drawPrimitive(PE_FrameDefaultButton, opt, p, widget);
if (btn->features & QStyleOptionButton::AutoDefaultButton)
br.setCoords(br.left() + dbi, br.top() + dbi, br.right() - dbi, br.bottom() - dbi);
if (!(btn->features & (QStyleOptionButton::Flat | QStyleOptionButton::CommandLinkButton))
@@ -1315,14 +1260,14 @@ void QCommonStyle::drawControl(ControlElement element, const QStyleOption *opt,
|| (btn->features & QStyleOptionButton::CommandLinkButton && btn->state & State_MouseOver)) {
QStyleOptionButton tmpBtn = *btn;
tmpBtn.rect = br;
- drawPrimitive(PE_PanelButtonCommand, &tmpBtn, p, widget);
+ proxy()->drawPrimitive(PE_PanelButtonCommand, &tmpBtn, p, widget);
}
if (btn->features & QStyleOptionButton::HasMenu) {
- int mbi = pixelMetric(PM_MenuButtonIndicator, btn, widget);
+ int mbi = proxy()->pixelMetric(PM_MenuButtonIndicator, btn, widget);
QRect ir = btn->rect;
QStyleOptionButton newBtn = *btn;
newBtn.rect = QRect(ir.right() - mbi + 2, ir.height()/2 - mbi/2 + 3, mbi - 6, mbi - 6);
- drawPrimitive(PE_IndicatorArrowDown, &newBtn, p, widget);
+ proxy()->drawPrimitive(PE_IndicatorArrowDown, &newBtn, p, widget);
}
}
break;
@@ -1330,7 +1275,7 @@ void QCommonStyle::drawControl(ControlElement element, const QStyleOption *opt,
if (const QStyleOptionButton *button = qstyleoption_cast<const QStyleOptionButton *>(opt)) {
QRect textRect = button->rect;
uint tf = Qt::AlignVCenter | Qt::TextShowMnemonic;
- if (!styleHint(SH_UnderlineShortcut, button, widget))
+ if (!proxy()->styleHint(SH_UnderlineShortcut, button, widget))
tf |= Qt::TextHideMnemonic;
if (!button->icon.isNull()) {
@@ -1365,24 +1310,24 @@ void QCommonStyle::drawControl(ControlElement element, const QStyleOption *opt,
textRect.setLeft(iconRect.left() + iconRect.width() + iconSpacing);
if (button->state & (State_On | State_Sunken))
- iconRect.translate(pixelMetric(PM_ButtonShiftHorizontal, opt, widget),
- pixelMetric(PM_ButtonShiftVertical, opt, widget));
+ iconRect.translate(proxy()->pixelMetric(PM_ButtonShiftHorizontal, opt, widget),
+ proxy()->pixelMetric(PM_ButtonShiftVertical, opt, widget));
p->drawPixmap(iconRect, pixmap);
} else {
tf |= Qt::AlignHCenter;
}
if (button->state & (State_On | State_Sunken))
- textRect.translate(pixelMetric(PM_ButtonShiftHorizontal, opt, widget),
- pixelMetric(PM_ButtonShiftVertical, opt, widget));
+ textRect.translate(proxy()->pixelMetric(PM_ButtonShiftHorizontal, opt, widget),
+ proxy()->pixelMetric(PM_ButtonShiftVertical, opt, widget));
if (button->features & QStyleOptionButton::HasMenu) {
- int indicatorSize = pixelMetric(PM_MenuButtonIndicator, button, widget);
+ int indicatorSize = proxy()->pixelMetric(PM_MenuButtonIndicator, button, widget);
if (button->direction == Qt::LeftToRight)
textRect = textRect.adjusted(0, 0, -indicatorSize, 0);
else
textRect = textRect.adjusted(indicatorSize, 0, 0, 0);
}
- drawItemText(p, textRect, tf, button->palette, (button->state & State_Enabled),
+ proxy()->drawItemText(p, textRect, tf, button->palette, (button->state & State_Enabled),
button->text, QPalette::ButtonText);
}
break;
@@ -1393,17 +1338,17 @@ void QCommonStyle::drawControl(ControlElement element, const QStyleOption *opt,
QStyleOptionButton subopt = *btn;
subopt.rect = subElementRect(isRadio ? SE_RadioButtonIndicator
: SE_CheckBoxIndicator, btn, widget);
- drawPrimitive(isRadio ? PE_IndicatorRadioButton : PE_IndicatorCheckBox,
+ proxy()->drawPrimitive(isRadio ? PE_IndicatorRadioButton : PE_IndicatorCheckBox,
&subopt, p, widget);
subopt.rect = subElementRect(isRadio ? SE_RadioButtonContents
: SE_CheckBoxContents, btn, widget);
- drawControl(isRadio ? CE_RadioButtonLabel : CE_CheckBoxLabel, &subopt, p, widget);
+ proxy()->drawControl(isRadio ? CE_RadioButtonLabel : CE_CheckBoxLabel, &subopt, p, widget);
if (btn->state & State_HasFocus) {
QStyleOptionFocusRect fropt;
fropt.QStyleOption::operator=(*btn);
fropt.rect = subElementRect(isRadio ? SE_RadioButtonFocusRect
: SE_CheckBoxFocusRect, btn, widget);
- drawPrimitive(PE_FrameFocusRect, &fropt, p, widget);
+ proxy()->drawPrimitive(PE_FrameFocusRect, &fropt, p, widget);
}
}
break;
@@ -1412,20 +1357,20 @@ void QCommonStyle::drawControl(ControlElement element, const QStyleOption *opt,
if (const QStyleOptionButton *btn = qstyleoption_cast<const QStyleOptionButton *>(opt)) {
uint alignment = visualAlignment(btn->direction, Qt::AlignLeft | Qt::AlignVCenter);
- if (!styleHint(SH_UnderlineShortcut, btn, widget))
+ if (!proxy()->styleHint(SH_UnderlineShortcut, btn, widget))
alignment |= Qt::TextHideMnemonic;
QPixmap pix;
QRect textRect = btn->rect;
if (!btn->icon.isNull()) {
pix = btn->icon.pixmap(btn->iconSize, btn->state & State_Enabled ? QIcon::Normal : QIcon::Disabled);
- drawItemPixmap(p, btn->rect, alignment, pix);
+ proxy()->drawItemPixmap(p, btn->rect, alignment, pix);
if (btn->direction == Qt::RightToLeft)
textRect.setRight(textRect.right() - btn->iconSize.width() - 4);
else
textRect.setLeft(textRect.left() + btn->iconSize.width() + 4);
}
if (!btn->text.isEmpty()){
- drawItemText(p, textRect, alignment | Qt::TextShowMnemonic,
+ proxy()->drawItemText(p, textRect, alignment | Qt::TextShowMnemonic,
btn->palette, btn->state & State_Enabled, btn->text, QPalette::WindowText);
}
}
@@ -1435,7 +1380,7 @@ void QCommonStyle::drawControl(ControlElement element, const QStyleOption *opt,
p->fillRect(opt->rect, opt->palette.background());
QStyleOption arrowOpt = *opt;
arrowOpt.state |= State_Enabled;
- drawPrimitive(((opt->state & State_DownArrow) ? PE_IndicatorArrowDown : PE_IndicatorArrowUp),
+ proxy()->drawPrimitive(((opt->state & State_DownArrow) ? PE_IndicatorArrowDown : PE_IndicatorArrowUp),
&arrowOpt, p, widget);
break; }
case CE_MenuTearoff:
@@ -1457,13 +1402,13 @@ void QCommonStyle::drawControl(ControlElement element, const QStyleOption *opt,
if (const QStyleOptionMenuItem *mbi = qstyleoption_cast<const QStyleOptionMenuItem *>(opt)) {
uint alignment = Qt::AlignCenter | Qt::TextShowMnemonic | Qt::TextDontClip
| Qt::TextSingleLine;
- if (!styleHint(SH_UnderlineShortcut, mbi, widget))
+ if (!proxy()->styleHint(SH_UnderlineShortcut, mbi, widget))
alignment |= Qt::TextHideMnemonic;
- QPixmap pix = mbi->icon.pixmap(pixelMetric(PM_SmallIconSize), (mbi->state & State_Enabled) ? QIcon::Normal : QIcon::Disabled);
+ QPixmap pix = mbi->icon.pixmap(proxy()->pixelMetric(PM_SmallIconSize), (mbi->state & State_Enabled) ? QIcon::Normal : QIcon::Disabled);
if (!pix.isNull())
- drawItemPixmap(p,mbi->rect, alignment, pix);
+ proxy()->drawItemPixmap(p,mbi->rect, alignment, pix);
else
- drawItemText(p, mbi->rect, alignment, mbi->palette, mbi->state & State_Enabled,
+ proxy()->drawItemText(p, mbi->rect, alignment, mbi->palette, mbi->state & State_Enabled,
mbi->text, QPalette::ButtonText);
}
break;
@@ -1478,12 +1423,12 @@ void QCommonStyle::drawControl(ControlElement element, const QStyleOption *opt,
= qstyleoption_cast<const QStyleOptionProgressBar *>(opt)) {
QStyleOptionProgressBarV2 subopt = *pb;
subopt.rect = subElementRect(SE_ProgressBarGroove, pb, widget);
- drawControl(CE_ProgressBarGroove, &subopt, p, widget);
+ proxy()->drawControl(CE_ProgressBarGroove, &subopt, p, widget);
subopt.rect = subElementRect(SE_ProgressBarContents, pb, widget);
- drawControl(CE_ProgressBarContents, &subopt, p, widget);
+ proxy()->drawControl(CE_ProgressBarContents, &subopt, p, widget);
if (pb->textVisible) {
subopt.rect = subElementRect(SE_ProgressBarLabel, pb, widget);
- drawControl(CE_ProgressBarLabel, &subopt, p, widget);
+ proxy()->drawControl(CE_ProgressBarLabel, &subopt, p, widget);
}
}
break;
@@ -1509,10 +1454,10 @@ void QCommonStyle::drawControl(ControlElement element, const QStyleOption *opt,
? QColor(255,255,255,160) : QColor(0,0,0,160);
QPalette shadowPalette = pb->palette;
shadowPalette.setColor(textRole, shadowColor);
- drawItemText(p, shadowRect, Qt::AlignCenter | Qt::TextSingleLine, shadowPalette,
+ proxy()->drawItemText(p, shadowRect, Qt::AlignCenter | Qt::TextSingleLine, shadowPalette,
pb->state & State_Enabled, pb->text, textRole);
}
- drawItemText(p, pb->rect, Qt::AlignCenter | Qt::TextSingleLine, pb->palette,
+ proxy()->drawItemText(p, pb->rect, Qt::AlignCenter | Qt::TextSingleLine, pb->palette,
pb->state & State_Enabled, pb->text, textRole);
}
}
@@ -1559,7 +1504,7 @@ void QCommonStyle::drawControl(ControlElement element, const QStyleOption *opt,
p->setPen(QPen(pal2.highlight().color(), 4));
p->drawLine(x, rect.y(), x, rect.height());
} else {
- const int unit_width = pixelMetric(PM_ProgressBarChunkWidth, pb, widget);
+ const int unit_width = proxy()->pixelMetric(PM_ProgressBarChunkWidth, pb, widget);
if (!unit_width)
return;
@@ -1601,7 +1546,7 @@ void QCommonStyle::drawControl(ControlElement element, const QStyleOption *opt,
for (int i = 0; i < nu; ++i) {
pbBits.rect.setRect(x0 + x, myY, unit_width, myHeight);
pbBits.rect = m.mapRect(QRectF(pbBits.rect)).toRect();
- drawPrimitive(PE_IndicatorProgressChunk, &pbBits, p, widget);
+ proxy()->drawPrimitive(PE_IndicatorProgressChunk, &pbBits, p, widget);
x += reverse ? -unit_width : unit_width;
}
@@ -1612,7 +1557,7 @@ void QCommonStyle::drawControl(ControlElement element, const QStyleOption *opt,
int offset = reverse ? x0 + x + unit_width-pixels_left : x0 + x;
pbBits.rect.setRect(offset, myY, pixels_left, myHeight);
pbBits.rect = m.mapRect(QRectF(pbBits.rect)).toRect();
- drawPrimitive(PE_IndicatorProgressChunk, &pbBits, p, widget);
+ proxy()->drawPrimitive(PE_IndicatorProgressChunk, &pbBits, p, widget);
}
}
}
@@ -1623,7 +1568,7 @@ void QCommonStyle::drawControl(ControlElement element, const QStyleOption *opt,
QRect rect = header->rect;
if (!header->icon.isNull()) {
QPixmap pixmap
- = header->icon.pixmap(pixelMetric(PM_SmallIconSize), (header->state & State_Enabled) ? QIcon::Normal : QIcon::Disabled);
+ = header->icon.pixmap(proxy()->pixelMetric(PM_SmallIconSize), (header->state & State_Enabled) ? QIcon::Normal : QIcon::Disabled);
int pixw = pixmap.width();
QRect aligned = alignedRect(header->direction, QFlag(header->iconAlignment), pixmap.size(), rect);
@@ -1640,7 +1585,7 @@ void QCommonStyle::drawControl(ControlElement element, const QStyleOption *opt,
fnt.setBold(true);
p->setFont(fnt);
}
- drawItemText(p, rect, header->textAlignment, header->palette,
+ proxy()->drawItemText(p, rect, header->textAlignment, header->palette,
(header->state & State_Enabled), header->text, QPalette::ButtonText);
}
break;
@@ -1652,18 +1597,19 @@ void QCommonStyle::drawControl(ControlElement element, const QStyleOption *opt,
int shiftX = 0;
int shiftY = 0;
if (toolbutton->state & (State_Sunken | State_On)) {
- shiftX = pixelMetric(PM_ButtonShiftHorizontal, toolbutton, widget);
- shiftY = pixelMetric(PM_ButtonShiftVertical, toolbutton, widget);
+ shiftX = proxy()->pixelMetric(PM_ButtonShiftHorizontal, toolbutton, widget);
+ shiftY = proxy()->pixelMetric(PM_ButtonShiftVertical, toolbutton, widget);
}
// Arrow type always overrules and is always shown
bool hasArrow = toolbutton->features & QStyleOptionToolButton::Arrow;
if (((!hasArrow && toolbutton->icon.isNull()) && !toolbutton->text.isEmpty())
|| toolbutton->toolButtonStyle == Qt::ToolButtonTextOnly) {
int alignment = Qt::AlignCenter | Qt::TextShowMnemonic;
- if (!styleHint(SH_UnderlineShortcut, opt, widget))
+ if (!proxy()->styleHint(SH_UnderlineShortcut, opt, widget))
alignment |= Qt::TextHideMnemonic;
rect.translate(shiftX, shiftY);
- drawItemText(p, rect, alignment, toolbutton->palette,
+ p->setFont(toolbutton->font);
+ proxy()->drawItemText(p, rect, alignment, toolbutton->palette,
opt->state & State_Enabled, toolbutton->text,
QPalette::ButtonText);
} else {
@@ -1688,7 +1634,7 @@ void QCommonStyle::drawControl(ControlElement element, const QStyleOption *opt,
QRect pr = rect,
tr = rect;
int alignment = Qt::TextShowMnemonic;
- if (!styleHint(SH_UnderlineShortcut, opt, widget))
+ if (!proxy()->styleHint(SH_UnderlineShortcut, opt, widget))
alignment |= Qt::TextHideMnemonic;
if (toolbutton->toolButtonStyle == Qt::ToolButtonTextUnderIcon) {
@@ -1696,7 +1642,7 @@ void QCommonStyle::drawControl(ControlElement element, const QStyleOption *opt,
tr.adjust(0, pr.height() - 1, 0, -3);
pr.translate(shiftX, shiftY);
if (!hasArrow) {
- drawItemPixmap(p, pr, Qt::AlignCenter, pm);
+ proxy()->drawItemPixmap(p, pr, Qt::AlignCenter, pm);
} else {
drawArrow(this, toolbutton, pr, p, widget);
}
@@ -1706,14 +1652,14 @@ void QCommonStyle::drawControl(ControlElement element, const QStyleOption *opt,
tr.adjust(pr.width(), 0, 0, 0);
pr.translate(shiftX, shiftY);
if (!hasArrow) {
- drawItemPixmap(p, QStyle::visualRect(opt->direction, rect, pr), Qt::AlignCenter, pm);
+ proxy()->drawItemPixmap(p, QStyle::visualRect(opt->direction, rect, pr), Qt::AlignCenter, pm);
} else {
drawArrow(this, toolbutton, pr, p, widget);
}
alignment |= Qt::AlignLeft | Qt::AlignVCenter;
}
tr.translate(shiftX, shiftY);
- drawItemText(p, QStyle::visualRect(opt->direction, rect, tr), alignment, toolbutton->palette,
+ proxy()->drawItemText(p, QStyle::visualRect(opt->direction, rect, tr), alignment, toolbutton->palette,
toolbutton->state & State_Enabled, toolbutton->text,
QPalette::ButtonText);
} else {
@@ -1721,7 +1667,7 @@ void QCommonStyle::drawControl(ControlElement element, const QStyleOption *opt,
if (hasArrow) {
drawArrow(this, toolbutton, rect, p, widget);
} else {
- drawItemPixmap(p, rect, Qt::AlignCenter, pm);
+ proxy()->drawItemPixmap(p, rect, Qt::AlignCenter, pm);
}
}
}
@@ -1731,8 +1677,8 @@ void QCommonStyle::drawControl(ControlElement element, const QStyleOption *opt,
#ifndef QT_NO_TOOLBOX
case CE_ToolBoxTab:
if (const QStyleOptionToolBox *tb = qstyleoption_cast<const QStyleOptionToolBox *>(opt)) {
- drawControl(CE_ToolBoxTabShape, tb, p, widget);
- drawControl(CE_ToolBoxTabLabel, tb, p, widget);
+ proxy()->drawControl(CE_ToolBoxTabShape, tb, p, widget);
+ proxy()->drawControl(CE_ToolBoxTabLabel, tb, p, widget);
}
break;
case CE_ToolBoxTabShape:
@@ -1778,8 +1724,8 @@ void QCommonStyle::drawControl(ControlElement element, const QStyleOption *opt,
#ifndef QT_NO_TABBAR
case CE_TabBarTab:
if (const QStyleOptionTab *tab = qstyleoption_cast<const QStyleOptionTab *>(opt)) {
- drawControl(CE_TabBarTabShape, tab, p, widget);
- drawControl(CE_TabBarTabLabel, tab, p, widget);
+ proxy()->drawControl(CE_TabBarTabShape, tab, p, widget);
+ proxy()->drawControl(CE_TabBarTabLabel, tab, p, widget);
}
break;
case CE_TabBarTabShape:
@@ -1789,7 +1735,7 @@ void QCommonStyle::drawControl(ControlElement element, const QStyleOption *opt,
QRect rect(tab->rect);
bool selected = tab->state & State_Selected;
bool onlyOne = tab->position == QStyleOptionTab::OnlyOneTab;
- int tabOverlap = onlyOne ? 0 : pixelMetric(PM_TabBarTabOverlap, opt, widget);
+ int tabOverlap = onlyOne ? 0 : proxy()->pixelMetric(PM_TabBarTabOverlap, opt, widget);
if (!selected) {
switch (tab->shape) {
@@ -1893,7 +1839,7 @@ void QCommonStyle::drawControl(ControlElement element, const QStyleOption *opt,
if (const QStyleOptionToolBox *tb = qstyleoption_cast<const QStyleOptionToolBox *>(opt)) {
bool enabled = tb->state & State_Enabled;
bool selected = tb->state & State_Selected;
- QPixmap pm = tb->icon.pixmap(pixelMetric(QStyle::PM_SmallIconSize, tb, widget),
+ QPixmap pm = tb->icon.pixmap(proxy()->pixelMetric(QStyle::PM_SmallIconSize, tb, widget),
enabled ? QIcon::Normal : QIcon::Disabled);
QRect cr = subElementRect(QStyle::SE_ToolBoxTabContents, tb, widget);
@@ -1909,7 +1855,7 @@ void QCommonStyle::drawControl(ControlElement element, const QStyleOption *opt,
tr = QRect(ir.right(), cr.top(), cr.width() - ir.right() - 4, cr.height());
}
- if (selected && styleHint(QStyle::SH_ToolBox_SelectedPageTitleBold, tb, widget)) {
+ if (selected && proxy()->styleHint(QStyle::SH_ToolBox_SelectedPageTitleBold, tb, widget)) {
QFont f(p->font());
f.setBold(true);
p->setFont(f);
@@ -1921,22 +1867,21 @@ void QCommonStyle::drawControl(ControlElement element, const QStyleOption *opt,
p->drawPixmap(ir.left(), (tb->rect.height() - ih) / 2, pm);
int alignment = Qt::AlignLeft | Qt::AlignVCenter | Qt::TextShowMnemonic;
- if (!styleHint(QStyle::SH_UnderlineShortcut, tb, widget))
+ if (!proxy()->styleHint(QStyle::SH_UnderlineShortcut, tb, widget))
alignment |= Qt::TextHideMnemonic;
- drawItemText(p, tr, alignment, tb->palette, enabled, txt, QPalette::ButtonText);
+ proxy()->drawItemText(p, tr, alignment, tb->palette, enabled, txt, QPalette::ButtonText);
if (!txt.isEmpty() && opt->state & State_HasFocus) {
QStyleOptionFocusRect opt;
opt.rect = tr;
opt.palette = tb->palette;
opt.state = QStyle::State_None;
- drawPrimitive(QStyle::PE_FrameFocusRect, &opt, p, widget);
+ proxy()->drawPrimitive(QStyle::PE_FrameFocusRect, &opt, p, widget);
}
}
break;
case CE_TabBarTabLabel:
if (const QStyleOptionTab *tab = qstyleoption_cast<const QStyleOptionTab *>(opt)) {
- // ### consider merging this with SE_TabBarTabText
QStyleOptionTabV3 tabV2(*tab);
QRect tr = tabV2.rect;
bool verticalTabs = tabV2.shape == QTabBar::RoundedEast
@@ -1945,7 +1890,7 @@ void QCommonStyle::drawControl(ControlElement element, const QStyleOption *opt,
|| tabV2.shape == QTabBar::TriangularWest;
int alignment = Qt::AlignCenter | Qt::TextShowMnemonic;
- if (!styleHint(SH_UnderlineShortcut, opt, widget))
+ if (!proxy()->styleHint(SH_UnderlineShortcut, opt, widget))
alignment |= Qt::TextHideMnemonic;
if (verticalTabs) {
@@ -1960,41 +1905,24 @@ void QCommonStyle::drawControl(ControlElement element, const QStyleOption *opt,
newY = tr.y() + tr.height();
newRot = -90;
}
- tr.setRect(0, 0, tr.height(), tr.width());
- QTransform m;
- m.translate(newX, newY);
+ QTransform m = QTransform::fromTranslate(newX, newY);
m.rotate(newRot);
p->setTransform(m, true);
}
- tr = subElementRect(SE_TabBarTabText, opt, widget);
+ QRect iconRect;
+ d->tabLayout(&tabV2, widget, &tr, &iconRect);
+ tr = proxy()->subElementRect(SE_TabBarTabText, opt, widget); //we compute tr twice because the style may override subElementRect
if (!tabV2.icon.isNull()) {
- QSize iconSize = tabV2.iconSize;
- if (!iconSize.isValid()) {
- int iconExtent = pixelMetric(PM_SmallIconSize);
- iconSize = QSize(iconExtent, iconExtent);
- }
- QSize tabIconSize = tabV2.icon.actualSize(iconSize,
- (tabV2.state & State_Enabled) ? QIcon::Normal
- : QIcon::Disabled);
- QPixmap tabIcon = tabV2.icon.pixmap(iconSize,
+ QPixmap tabIcon = tabV2.icon.pixmap(tabV2.iconSize,
(tabV2.state & State_Enabled) ? QIcon::Normal
- : QIcon::Disabled);
-
- int offset = 4;
- int left = opt->rect.left();
- if (tabV2.leftButtonSize.isEmpty())
- offset += 2;
- else
- left += tabV2.leftButtonSize.width() + (6 + 2) + 2;
- QRect iconRect = QRect(left + offset, tr.center().y() - tabIcon.height() / 2,
- tabIconSize.width(), tabIconSize.height());
- if (!verticalTabs)
- iconRect = visualRect(opt->direction, opt->rect, iconRect);
+ : QIcon::Disabled,
+ (tabV2.state & State_Selected) ? QIcon::On
+ : QIcon::Off);
p->drawPixmap(iconRect.x(), iconRect.y(), tabIcon);
}
- drawItemText(p, tr, alignment, tab->palette, tab->state & State_Enabled, tab->text, QPalette::WindowText);
+ proxy()->drawItemText(p, tr, alignment, tab->palette, tab->state & State_Enabled, tab->text, QPalette::WindowText);
if (verticalTabs)
p->restore();
@@ -2105,7 +2033,7 @@ void QCommonStyle::drawControl(ControlElement element, const QStyleOption *opt,
p->save();
QRect r = opt->rect;
QStyleHintReturnMask mask;
- if (styleHint(QStyle::SH_RubberBand_Mask, opt, widget, &mask))
+ if (proxy()->styleHint(QStyle::SH_RubberBand_Mask, opt, widget, &mask))
p->setClipRegion(mask.region);
p->drawTiledPixmap(r.x(), r.y(), r.width(), r.height(), tiledPixmap);
p->setPen(opt->palette.color(QPalette::Active, QPalette::WindowText));
@@ -2143,7 +2071,7 @@ void QCommonStyle::drawControl(ControlElement element, const QStyleOption *opt,
}
const int indent = p->fontMetrics().descent();
- drawItemText(p, r.adjusted(indent + 1, 1, -indent - 1, -1),
+ proxy()->drawItemText(p, r.adjusted(indent + 1, 1, -indent - 1, -1),
Qt::AlignLeft | Qt::AlignVCenter | Qt::TextShowMnemonic, dwOpt->palette,
dwOpt->state & State_Enabled, dwOpt->title,
QPalette::WindowText);
@@ -2158,14 +2086,14 @@ void QCommonStyle::drawControl(ControlElement element, const QStyleOption *opt,
if (const QStyleOptionHeader *header = qstyleoption_cast<const QStyleOptionHeader *>(opt)) {
QRegion clipRegion = p->clipRegion();
p->setClipRect(opt->rect);
- drawControl(CE_HeaderSection, header, p, widget);
+ proxy()->drawControl(CE_HeaderSection, header, p, widget);
QStyleOptionHeader subopt = *header;
subopt.rect = subElementRect(SE_HeaderLabel, header, widget);
if (subopt.rect.isValid())
- drawControl(CE_HeaderLabel, &subopt, p, widget);
+ proxy()->drawControl(CE_HeaderLabel, &subopt, p, widget);
if (header->sortIndicator != QStyleOptionHeader::None) {
subopt.rect = subElementRect(SE_HeaderArrow, opt, widget);
- drawPrimitive(PE_IndicatorHeaderArrow, &subopt, p, widget);
+ proxy()->drawPrimitive(PE_IndicatorHeaderArrow, &subopt, p, widget);
}
p->setClipRegion(clipRegion);
}
@@ -2184,7 +2112,7 @@ void QCommonStyle::drawControl(ControlElement element, const QStyleOption *opt,
#ifndef QT_NO_COMBOBOX
case CE_ComboBoxLabel:
if (const QStyleOptionComboBox *cb = qstyleoption_cast<const QStyleOptionComboBox *>(opt)) {
- QRect editRect = subControlRect(CC_ComboBox, cb, SC_ComboBoxEditField, widget);
+ QRect editRect = proxy()->subControlRect(CC_ComboBox, cb, SC_ComboBoxEditField, widget);
p->save();
p->setClipRect(editRect);
if (!cb->currentIcon.isNull()) {
@@ -2198,7 +2126,7 @@ void QCommonStyle::drawControl(ControlElement element, const QStyleOption *opt,
iconRect.size(), editRect);
if (cb->editable)
p->fillRect(iconRect, opt->palette.brush(QPalette::Base));
- drawItemPixmap(p, iconRect, Qt::AlignCenter, pixmap);
+ proxy()->drawItemPixmap(p, iconRect, Qt::AlignCenter, pixmap);
if (cb->direction == Qt::RightToLeft)
editRect.translate(-4 - cb->iconSize.width(), 0);
@@ -2206,7 +2134,7 @@ void QCommonStyle::drawControl(ControlElement element, const QStyleOption *opt,
editRect.translate(cb->iconSize.width() + 4, 0);
}
if (!cb->currentText.isEmpty() && !cb->editable) {
- drawItemText(p, editRect.adjusted(1, 0, -1, 0),
+ proxy()->drawItemText(p, editRect.adjusted(1, 0, -1, 0),
visualAlignment(cb->direction, Qt::AlignLeft | Qt::AlignVCenter),
cb->palette, cb->state & State_Enabled, cb->currentText);
}
@@ -2222,7 +2150,7 @@ void QCommonStyle::drawControl(ControlElement element, const QStyleOption *opt,
frame.QStyleOption::operator=(*toolBar);
frame.lineWidth = toolBar->lineWidth;
frame.midLineWidth = toolBar->midLineWidth;
- drawPrimitive(PE_PanelToolBar, opt, p, widget);
+ proxy()->drawPrimitive(PE_PanelToolBar, opt, p, widget);
if (widget && qobject_cast<QToolBar *>(widget->parentWidget()))
break;
@@ -2264,10 +2192,10 @@ void QCommonStyle::drawControl(ControlElement element, const QStyleOption *opt,
QRect textRect = subElementRect(SE_ItemViewItemText, vopt, widget);
// draw the background
- drawPrimitive(PE_PanelItemViewItem, opt, p, widget);
+ proxy()->drawPrimitive(PE_PanelItemViewItem, opt, p, widget);
// draw the check mark
- if (checkRect.isValid()) {
+ if (vopt->features & QStyleOptionViewItemV2::HasCheckIndicator) {
QStyleOptionViewItemV4 option(*vopt);
option.rect = checkRect;
option.state = option.state & ~QStyle::State_HasFocus;
@@ -2283,7 +2211,7 @@ void QCommonStyle::drawControl(ControlElement element, const QStyleOption *opt,
option.state |= QStyle::State_On;
break;
}
- drawPrimitive(QStyle::PE_IndicatorViewItemCheck, &option, p, widget);
+ proxy()->drawPrimitive(QStyle::PE_IndicatorViewItemCheck, &option, p, widget);
}
// draw the icon
@@ -2326,7 +2254,7 @@ void QCommonStyle::drawControl(ControlElement element, const QStyleOption *opt,
? QPalette::Normal : QPalette::Disabled;
o.backgroundColor = vopt->palette.color(cg, (vopt->state & QStyle::State_Selected)
? QPalette::Highlight : QPalette::Window);
- drawPrimitive(QStyle::PE_FrameFocusRect, &o, p, widget);
+ proxy()->drawPrimitive(QStyle::PE_FrameFocusRect, &o, p, widget);
}
p->restore();
@@ -2365,7 +2293,7 @@ void QCommonStyle::drawControl(ControlElement element, const QStyleOption *opt,
if (widget) {
widget->style()->drawPrimitive(QStyle::PE_Frame, opt, p, widget);
} else {
- drawPrimitive(QStyle::PE_Frame, opt, p, widget);
+ proxy()->drawPrimitive(QStyle::PE_Frame, opt, p, widget);
}
break;
case QFrame::Panel:
@@ -2423,9 +2351,9 @@ QRect QCommonStyle::subElementRect(SubElement sr, const QStyleOption *opt,
case SE_PushButtonContents:
if (const QStyleOptionButton *btn = qstyleoption_cast<const QStyleOptionButton *>(opt)) {
int dx1, dx2;
- dx1 = pixelMetric(PM_DefaultFrameWidth, btn, widget);
+ dx1 = proxy()->pixelMetric(PM_DefaultFrameWidth, btn, widget);
if (btn->features & QStyleOptionButton::AutoDefaultButton)
- dx1 += pixelMetric(PM_ButtonDefaultIndicator, btn, widget);
+ dx1 += proxy()->pixelMetric(PM_ButtonDefaultIndicator, btn, widget);
dx2 = dx1 * 2;
r.setRect(opt->rect.x() + dx1, opt->rect.y() + dx1, opt->rect.width() - dx2,
opt->rect.height() - dx2);
@@ -2436,11 +2364,11 @@ QRect QCommonStyle::subElementRect(SubElement sr, const QStyleOption *opt,
if (const QStyleOptionButton *btn = qstyleoption_cast<const QStyleOptionButton *>(opt)) {
int dbw1 = 0, dbw2 = 0;
if (btn->features & QStyleOptionButton::AutoDefaultButton){
- dbw1 = pixelMetric(PM_ButtonDefaultIndicator, btn, widget);
+ dbw1 = proxy()->pixelMetric(PM_ButtonDefaultIndicator, btn, widget);
dbw2 = dbw1 * 2;
}
- int dfw1 = pixelMetric(PM_DefaultFrameWidth, btn, widget) + 1,
+ int dfw1 = proxy()->pixelMetric(PM_DefaultFrameWidth, btn, widget) + 1,
dfw2 = dfw1 * 2;
r.setRect(btn->rect.x() + dfw1 + dbw1, btn->rect.y() + dfw1 + dbw1,
@@ -2450,9 +2378,9 @@ QRect QCommonStyle::subElementRect(SubElement sr, const QStyleOption *opt,
break;
case SE_CheckBoxIndicator:
{
- int h = pixelMetric(PM_IndicatorHeight, opt, widget);
+ int h = proxy()->pixelMetric(PM_IndicatorHeight, opt, widget);
r.setRect(opt->rect.x(), opt->rect.y() + ((opt->rect.height() - h) / 2),
- pixelMetric(PM_IndicatorWidth, opt, widget), h);
+ proxy()->pixelMetric(PM_IndicatorWidth, opt, widget), h);
r = visualRect(opt->direction, opt->rect, r);
}
break;
@@ -2462,7 +2390,7 @@ QRect QCommonStyle::subElementRect(SubElement sr, const QStyleOption *opt,
// Deal with the logical first, then convert it back to screen coords.
QRect ir = visualRect(opt->direction, opt->rect,
subElementRect(SE_CheckBoxIndicator, opt, widget));
- int spacing = pixelMetric(PM_CheckBoxLabelSpacing, opt, widget);
+ int spacing = proxy()->pixelMetric(PM_CheckBoxLabelSpacing, opt, widget);
r.setRect(ir.right() + spacing, opt->rect.y(), opt->rect.width() - ir.width() - spacing,
opt->rect.height());
r = visualRect(opt->direction, opt->rect, r);
@@ -2502,9 +2430,9 @@ QRect QCommonStyle::subElementRect(SubElement sr, const QStyleOption *opt,
case SE_RadioButtonIndicator:
{
- int h = pixelMetric(PM_ExclusiveIndicatorHeight, opt, widget);
+ int h = proxy()->pixelMetric(PM_ExclusiveIndicatorHeight, opt, widget);
r.setRect(opt->rect.x(), opt->rect.y() + ((opt->rect.height() - h) / 2),
- pixelMetric(PM_ExclusiveIndicatorWidth, opt, widget), h);
+ proxy()->pixelMetric(PM_ExclusiveIndicatorWidth, opt, widget), h);
r = visualRect(opt->direction, opt->rect, r);
}
break;
@@ -2513,7 +2441,7 @@ QRect QCommonStyle::subElementRect(SubElement sr, const QStyleOption *opt,
{
QRect ir = visualRect(opt->direction, opt->rect,
subElementRect(SE_RadioButtonIndicator, opt, widget));
- int spacing = pixelMetric(PM_RadioButtonLabelSpacing, opt, widget);
+ int spacing = proxy()->pixelMetric(PM_RadioButtonLabelSpacing, opt, widget);
r.setRect(ir.left() + ir.width() + spacing, opt->rect.y(), opt->rect.width() - ir.width() - spacing,
opt->rect.height());
r = visualRect(opt->direction, opt->rect, r);
@@ -2550,8 +2478,8 @@ QRect QCommonStyle::subElementRect(SubElement sr, const QStyleOption *opt,
#ifndef QT_NO_SLIDER
case SE_SliderFocusRect:
if (const QStyleOptionSlider *slider = qstyleoption_cast<const QStyleOptionSlider *>(opt)) {
- int tickOffset = pixelMetric(PM_SliderTickmarkOffset, slider, widget);
- int thickness = pixelMetric(PM_SliderControlThickness, slider, widget);
+ int tickOffset = proxy()->pixelMetric(PM_SliderTickmarkOffset, slider, widget);
+ int thickness = proxy()->pixelMetric(PM_SliderControlThickness, slider, widget);
if (slider->orientation == Qt::Horizontal)
r.setRect(0, tickOffset - 1, slider->rect.width(), thickness + 2);
else
@@ -2622,7 +2550,7 @@ QRect QCommonStyle::subElementRect(SubElement sr, const QStyleOption *opt,
break;
#endif // QT_NO_TOOLBOX
case SE_HeaderLabel: {
- int margin = pixelMetric(QStyle::PM_HeaderMargin, opt, widget);
+ int margin = proxy()->pixelMetric(QStyle::PM_HeaderMargin, opt, widget);
r.setRect(opt->rect.x() + margin, opt->rect.y() + margin,
opt->rect.width() - margin * 2, opt->rect.height() - margin * 2);
@@ -2642,7 +2570,7 @@ QRect QCommonStyle::subElementRect(SubElement sr, const QStyleOption *opt,
int w = opt->rect.width();
int x = opt->rect.x();
int y = opt->rect.y();
- int margin = pixelMetric(QStyle::PM_HeaderMargin, opt, widget);
+ int margin = proxy()->pixelMetric(QStyle::PM_HeaderMargin, opt, widget);
if (opt->state & State_Horizontal) {
int horiz_size = h / 2;
@@ -2678,7 +2606,7 @@ QRect QCommonStyle::subElementRect(SubElement sr, const QStyleOption *opt,
r.setWidth(qMin(r.width(), twf->rect.width()
- twf->leftCornerWidgetSize.width()
- twf->rightCornerWidgetSize.width()));
- switch (styleHint(SH_TabBar_Alignment, twf, widget) & alingMask) {
+ switch (proxy()->styleHint(SH_TabBar_Alignment, twf, widget) & alingMask) {
default:
case Qt::AlignLeft:
r.moveTopLeft(QPoint(twf->leftCornerWidgetSize.width(), 0));
@@ -2700,7 +2628,7 @@ QRect QCommonStyle::subElementRect(SubElement sr, const QStyleOption *opt,
r.setWidth(qMin(r.width(), twf->rect.width()
- twf->leftCornerWidgetSize.width()
- twf->rightCornerWidgetSize.width()));
- switch (styleHint(SH_TabBar_Alignment, twf, widget) & alingMask) {
+ switch (proxy()->styleHint(SH_TabBar_Alignment, twf, widget) & alingMask) {
default:
case Qt::AlignLeft:
r.moveTopLeft(QPoint(twf->leftCornerWidgetSize.width(),
@@ -2725,7 +2653,7 @@ QRect QCommonStyle::subElementRect(SubElement sr, const QStyleOption *opt,
r.setHeight(qMin(r.height(), twf->rect.height()
- twf->leftCornerWidgetSize.height()
- twf->rightCornerWidgetSize.height()));
- switch (styleHint(SH_TabBar_Alignment, twf, widget) & alingMask) {
+ switch (proxy()->styleHint(SH_TabBar_Alignment, twf, widget) & alingMask) {
default:
case Qt::AlignLeft:
r.moveTopLeft(QPoint(twf->rect.width() - twf->tabBarSize.width(),
@@ -2747,7 +2675,7 @@ QRect QCommonStyle::subElementRect(SubElement sr, const QStyleOption *opt,
r.setHeight(qMin(r.height(), twf->rect.height()
- twf->leftCornerWidgetSize.height()
- twf->rightCornerWidgetSize.height()));
- switch (styleHint(SH_TabBar_Alignment, twf, widget) & alingMask) {
+ switch (proxy()->styleHint(SH_TabBar_Alignment, twf, widget) & alingMask) {
default:
case Qt::AlignLeft:
r.moveTopLeft(QPoint(0, twf->leftCornerWidgetSize.height()));
@@ -2769,7 +2697,7 @@ QRect QCommonStyle::subElementRect(SubElement sr, const QStyleOption *opt,
if (const QStyleOptionTabWidgetFrame *twf = qstyleoption_cast<const QStyleOptionTabWidgetFrame *>(opt)) {
QStyleOptionTab tabopt;
tabopt.shape = twf->shape;
- int overlap = pixelMetric(PM_TabBarBaseOverlap, &tabopt, widget);
+ int overlap = proxy()->pixelMetric(PM_TabBarBaseOverlap, &tabopt, widget);
if (twf->lineWidth == 0)
overlap = 0;
switch (twf->shape) {
@@ -2837,71 +2765,20 @@ QRect QCommonStyle::subElementRect(SubElement sr, const QStyleOption *opt,
}
break;
case SE_TabBarTabText:
- // ### consider merging this with CE_TabBarTabLabel
if (const QStyleOptionTab *tab = qstyleoption_cast<const QStyleOptionTab *>(opt)) {
- QStyleOptionTabV3 tabV2(*tab);
- QRect tr = tabV2.rect;
- bool verticalTabs = tabV2.shape == QTabBar::RoundedEast
- || tabV2.shape == QTabBar::RoundedWest
- || tabV2.shape == QTabBar::TriangularEast
- || tabV2.shape == QTabBar::TriangularWest;
- if (verticalTabs)
- tr.setRect(0, 0, tr.height(), tr.width());
- int verticalShift = pixelMetric(QStyle::PM_TabBarTabShiftVertical, tab, widget);
- int horizontalShift = pixelMetric(QStyle::PM_TabBarTabShiftHorizontal, tab, widget);
- if (tabV2.shape == QTabBar::RoundedSouth || tabV2.shape == QTabBar::TriangularSouth)
- verticalShift = -verticalShift;
- tr.adjust(0, 0, horizontalShift, verticalShift);
- bool selected = tabV2.state & State_Selected;
- if (selected) {
- tr.setBottom(tr.bottom() - verticalShift);
- tr.setRight(tr.right() - horizontalShift);
- }
-
- // left widget
- if (!tabV2.leftButtonSize.isEmpty()) {
- tr.setLeft(tr.left() + 6 + 2 +
- (verticalTabs ? tabV2.leftButtonSize.height() : tabV2.leftButtonSize.width()));
- }
-
- // icon
- if (!tabV2.icon.isNull()) {
- QSize iconSize = tabV2.iconSize;
- if (!iconSize.isValid()) {
- int iconExtent = pixelMetric(PM_SmallIconSize);
- iconSize = QSize(iconExtent, iconExtent);
- }
- QSize tabIconSize = tabV2.icon.actualSize(iconSize,
- (tabV2.state & State_Enabled) ? QIcon::Normal
- : QIcon::Disabled);
- int offset = 4;
- if (tabV2.leftButtonSize.isEmpty())
- offset += 2;
-
- QRect iconRect = QRect(tr.left() + offset, tr.center().y() - tabIconSize.height() / 2,
- tabIconSize.width(), tabIconSize .height());
- if (!verticalTabs)
- iconRect = visualRect(opt->direction, opt->rect, iconRect);
- tr.setLeft(tr.left() + tabIconSize.width() + offset + 2);
- }
-
- // right widget
- if (!tabV2.rightButtonSize.isEmpty()) {
- tr.setRight(tr.right() - 6 - 2 -
- (verticalTabs ? tabV2.rightButtonSize.height() : tabV2.rightButtonSize.width()));
- }
-
- if (!verticalTabs)
- tr = visualRect(opt->direction, opt->rect, tr);
- r = tr;
+ QStyleOptionTabV3 tabV3(*tab);
+ QRect dummyIconRect;
+ d->tabLayout(&tabV3, widget, &r, &dummyIconRect);
}
break;
case SE_TabBarTabLeftButton:
case SE_TabBarTabRightButton:
if (const QStyleOptionTabV3 *tab = qstyleoption_cast<const QStyleOptionTabV3 *>(opt)) {
bool selected = tab->state & State_Selected;
- int verticalShift = pixelMetric(QStyle::PM_TabBarTabShiftVertical, tab, widget);
- int horizontalShift = pixelMetric(QStyle::PM_TabBarTabShiftHorizontal, tab, widget);
+ int verticalShift = proxy()->pixelMetric(QStyle::PM_TabBarTabShiftVertical, tab, widget);
+ int horizontalShift = proxy()->pixelMetric(QStyle::PM_TabBarTabShiftHorizontal, tab, widget);
+ int hpadding = proxy()->pixelMetric(QStyle::PM_TabBarTabHSpace, opt, widget) / 2;
+ hpadding = qMax(hpadding, 4); //workaround KStyle returning 0 because they workaround an old bug in Qt
bool verticalTabs = tab->shape == QTabBar::RoundedEast
|| tab->shape == QTabBar::RoundedWest
@@ -2916,6 +2793,9 @@ QRect QCommonStyle::subElementRect(SubElement sr, const QStyleOption *opt,
horizontalShift *= -1;
verticalShift *= -1;
}
+ if (tab->shape == QTabBar::RoundedWest || tab->shape == QTabBar::TriangularWest)
+ horizontalShift = -horizontalShift;
+
tr.adjust(0, 0, horizontalShift, verticalShift);
if (selected)
{
@@ -2941,16 +2821,16 @@ QRect QCommonStyle::subElementRect(SubElement sr, const QStyleOption *opt,
break;
default:
if (sr == SE_TabBarTabLeftButton)
- r = QRect(6 + tab->rect.x(), midHeight, w, h);
+ r = QRect(tab->rect.x() + hpadding, midHeight, w, h);
else
- r = QRect(tab->rect.right() - 6 - w, midHeight, w, h);
+ r = QRect(tab->rect.right() - w - hpadding, midHeight, w, h);
r = visualRect(tab->direction, tab->rect, r);
}
if (verticalTabs) {
if (atTheTop)
- r = QRect(midWidth, tr.y() + tab->rect.height() - 6 - h, w, h);
+ r = QRect(midWidth, tr.y() + tab->rect.height() - hpadding - h, w, h);
else
- r = QRect(midWidth, tr.y() + 6, w, h);
+ r = QRect(midWidth, tr.y() + hpadding, w, h);
}
}
@@ -2990,7 +2870,7 @@ QRect QCommonStyle::subElementRect(SubElement sr, const QStyleOption *opt,
break;
case SE_FrameContents:
if (const QStyleOptionFrameV2 *f = qstyleoption_cast<const QStyleOptionFrameV2 *>(opt)) {
- int fw = pixelMetric(PM_DefaultFrameWidth, f, widget);
+ int fw = proxy()->pixelMetric(PM_DefaultFrameWidth, f, widget);
r = opt->rect.adjusted(fw, fw, -fw, -fw);
r = visualRect(opt->direction, opt->rect, r);
}
@@ -3057,9 +2937,9 @@ QRect QCommonStyle::subElementRect(SubElement sr, const QStyleOption *opt,
case SE_DockWidgetFloatButton:
case SE_DockWidgetTitleBarText:
case SE_DockWidgetIcon: {
- int iconSize = pixelMetric(PM_SmallIconSize, opt, widget);
- int buttonMargin = pixelMetric(PM_DockWidgetTitleBarButtonMargin, opt, widget);
- int margin = pixelMetric(QStyle::PM_DockWidgetTitleMargin, opt, widget);
+ int iconSize = proxy()->pixelMetric(PM_SmallIconSize, opt, widget);
+ int buttonMargin = proxy()->pixelMetric(PM_DockWidgetTitleBarButtonMargin, opt, widget);
+ int margin = proxy()->pixelMetric(QStyle::PM_DockWidgetTitleMargin, opt, widget);
QRect rect = opt->rect;
const QStyleOptionDockWidget *dwOpt
@@ -3124,7 +3004,7 @@ QRect QCommonStyle::subElementRect(SubElement sr, const QStyleOption *opt,
if (dw->isFloating())
icon = dw->windowIcon();
if (!icon.isNull()
- && icon.cacheKey() != qApp->windowIcon().cacheKey()) {
+ && icon.cacheKey() != QApplication::windowIcon().cacheKey()) {
QSize sz = icon.actualSize(QSize(r.height(), r.height()));
if (verticalTitleBar)
sz.transpose();
@@ -3169,8 +3049,10 @@ QRect QCommonStyle::subElementRect(SubElement sr, const QStyleOption *opt,
if (const QStyleOptionViewItemV4 *vopt = qstyleoption_cast<const QStyleOptionViewItemV4 *>(opt)) {
if (!d->isViewItemCached(*vopt)) {
d->viewItemLayout(vopt, &d->checkRect, &d->decorationRect, &d->displayRect, false);
- if (d->cachedOption)
+ if (d->cachedOption) {
delete d->cachedOption;
+ d->cachedOption = 0;
+ }
d->cachedOption = new QStyleOptionViewItemV4(*vopt);
}
if (sr == SE_ViewItemCheckIndicator)
@@ -3182,6 +3064,25 @@ QRect QCommonStyle::subElementRect(SubElement sr, const QStyleOption *opt,
}
break;
#endif //QT_NO_ITEMVIEWS
+#ifndef QT_NO_TOOLBAR
+ case SE_ToolBarHandle:
+ if (const QStyleOptionToolBar *tbopt = qstyleoption_cast<const QStyleOptionToolBar *>(opt)) {
+ if (tbopt->features & QStyleOptionToolBar::Movable) {
+ ///we need to access the widget here because the style option doesn't
+ //have all the information we need (ie. the layout's margin)
+ const QToolBar *tb = qobject_cast<const QToolBar*>(widget);
+ const int margin = tb && tb->layout() ? tb->layout()->margin() : 2;
+ const int handleExtent = pixelMetric(QStyle::PM_ToolBarHandleExtent, opt, tb);
+ if (tbopt->state & QStyle::State_Horizontal) {
+ r = QRect(margin, margin, handleExtent, tbopt->rect.height() - 2*margin);
+ r = QStyle::visualRect(tbopt->direction, tbopt->rect, r);
+ } else {
+ r = QRect(margin, margin, tbopt->rect.width() - 2*margin, handleExtent);
+ }
+ }
+ }
+ break;
+#endif //QT_NO_TOOLBAR
default:
break;
}
@@ -3189,47 +3090,6 @@ QRect QCommonStyle::subElementRect(SubElement sr, const QStyleOption *opt,
}
#ifndef QT_NO_DIAL
-static qreal angle(const QPointF &p1, const QPointF &p2)
-{
- static const qreal rad_factor = 180 / Q_PI;
- qreal _angle = 0;
-
- if (p1.x() == p2.x()) {
- if (p1.y() < p2.y())
- _angle = 270;
- else
- _angle = 90;
- } else {
- qreal x1, x2, y1, y2;
-
- if (p1.x() <= p2.x()) {
- x1 = p1.x(); y1 = p1.y();
- x2 = p2.x(); y2 = p2.y();
- } else {
- x2 = p1.x(); y2 = p1.y();
- x1 = p2.x(); y1 = p2.y();
- }
-
- qreal m = -(y2 - y1) / (x2 - x1);
- _angle = atan(m) * rad_factor;
-
- if (p1.x() < p2.x())
- _angle = 180 - _angle;
- else
- _angle = -_angle;
- }
- return _angle;
-}
-
-static int calcBigLineSize(int radius)
-{
- int bigLineSize = radius / 6;
- if (bigLineSize < 4)
- bigLineSize = 4;
- if (bigLineSize > radius / 2)
- bigLineSize = radius / 2;
- return bigLineSize;
-}
static QPolygonF calcArrow(const QStyleOptionSlider *dial, qreal &a)
{
@@ -3250,7 +3110,7 @@ static QPolygonF calcArrow(const QStyleOptionSlider *dial, qreal &a)
int xc = width / 2;
int yc = height / 2;
- int len = r - calcBigLineSize(r) - 5;
+ int len = r - QStyleHelper::calcBigLineSize(r) - 5;
if (len < 5)
len = 5;
int back = len / 2;
@@ -3265,45 +3125,6 @@ static QPolygonF calcArrow(const QStyleOptionSlider *dial, qreal &a)
return arrow;
}
-static QPolygonF calcLines(const QStyleOptionSlider *dial, const QWidget *)
-{
- QPolygonF poly;
- int width = dial->rect.width();
- int height = dial->rect.height();
- qreal r = qMin(width, height) / 2;
- int bigLineSize = calcBigLineSize(int(r));
-
- qreal xc = width / 2;
- qreal yc = height / 2;
- int ns = dial->tickInterval;
- int notches = (dial->maximum + ns - 1 - dial->minimum) / ns;
- if (notches <= 0)
- return poly;
- if (dial->maximum < dial->minimum
- || dial->maximum - dial->minimum > 1000) {
- int maximum = dial->minimum + 1000;
- notches = (maximum + ns - 1 - dial->minimum) / ns;
- }
-
- poly.resize(2 + 2 * notches);
- int smallLineSize = bigLineSize / 2;
- for (int i = 0; i <= notches; ++i) {
- qreal angle = dial->dialWrapping ? Q_PI * 3 / 2 - i * 2 * Q_PI / notches
- : (Q_PI * 8 - i * 10 * Q_PI / notches) / 6;
- qreal s = qSin(angle);
- qreal c = qCos(angle);
- if (i == 0 || (((ns * i) % (dial->pageStep ? dial->pageStep : 1)) == 0)) {
- poly[2 * i] = QPointF(xc + (r - bigLineSize) * c,
- yc - (r - bigLineSize) * s);
- poly[2 * i + 1] = QPointF(xc + r * c, yc - r * s);
- } else {
- poly[2 * i] = QPointF(xc + (r - 1 - smallLineSize) * c,
- yc - (r - 1 - smallLineSize) * s);
- poly[2 * i + 1] = QPointF(xc + (r - 1) * c, yc -(r - 1) * s);
- }
- }
- return poly;
-}
#endif // QT_NO_DIAL
/*!
@@ -3317,11 +3138,11 @@ void QCommonStyle::drawComplexControl(ComplexControl cc, const QStyleOptionCompl
case CC_Slider:
if (const QStyleOptionSlider *slider = qstyleoption_cast<const QStyleOptionSlider *>(opt)) {
if (slider->subControls == SC_SliderTickmarks) {
- int tickOffset = pixelMetric(PM_SliderTickmarkOffset, slider, widget);
+ int tickOffset = proxy()->pixelMetric(PM_SliderTickmarkOffset, slider, widget);
int ticks = slider->tickPosition;
- int thickness = pixelMetric(PM_SliderControlThickness, slider, widget);
- int len = pixelMetric(PM_SliderLength, slider, widget);
- int available = pixelMetric(PM_SliderSpaceAvailable, slider, widget);
+ int thickness = proxy()->pixelMetric(PM_SliderControlThickness, slider, widget);
+ int len = proxy()->pixelMetric(PM_SliderLength, slider, widget);
+ int available = proxy()->pixelMetric(PM_SliderSpaceAvailable, slider, widget);
int interval = slider->tickInterval;
if (interval <= 0) {
interval = slider->singleStep;
@@ -3379,71 +3200,71 @@ void QCommonStyle::drawComplexControl(ComplexControl cc, const QStyleOptionCompl
if (scrollbar->subControls & SC_ScrollBarSubLine) {
newScrollbar.state = saveFlags;
- newScrollbar.rect = subControlRect(cc, &newScrollbar, SC_ScrollBarSubLine, widget);
+ newScrollbar.rect = proxy()->subControlRect(cc, &newScrollbar, SC_ScrollBarSubLine, widget);
if (newScrollbar.rect.isValid()) {
if (!(scrollbar->activeSubControls & SC_ScrollBarSubLine))
newScrollbar.state &= ~(State_Sunken | State_MouseOver);
- drawControl(CE_ScrollBarSubLine, &newScrollbar, p, widget);
+ proxy()->drawControl(CE_ScrollBarSubLine, &newScrollbar, p, widget);
}
}
if (scrollbar->subControls & SC_ScrollBarAddLine) {
newScrollbar.rect = scrollbar->rect;
newScrollbar.state = saveFlags;
- newScrollbar.rect = subControlRect(cc, &newScrollbar, SC_ScrollBarAddLine, widget);
+ newScrollbar.rect = proxy()->subControlRect(cc, &newScrollbar, SC_ScrollBarAddLine, widget);
if (newScrollbar.rect.isValid()) {
if (!(scrollbar->activeSubControls & SC_ScrollBarAddLine))
newScrollbar.state &= ~(State_Sunken | State_MouseOver);
- drawControl(CE_ScrollBarAddLine, &newScrollbar, p, widget);
+ proxy()->drawControl(CE_ScrollBarAddLine, &newScrollbar, p, widget);
}
}
if (scrollbar->subControls & SC_ScrollBarSubPage) {
newScrollbar.rect = scrollbar->rect;
newScrollbar.state = saveFlags;
- newScrollbar.rect = subControlRect(cc, &newScrollbar, SC_ScrollBarSubPage, widget);
+ newScrollbar.rect = proxy()->subControlRect(cc, &newScrollbar, SC_ScrollBarSubPage, widget);
if (newScrollbar.rect.isValid()) {
if (!(scrollbar->activeSubControls & SC_ScrollBarSubPage))
newScrollbar.state &= ~(State_Sunken | State_MouseOver);
- drawControl(CE_ScrollBarSubPage, &newScrollbar, p, widget);
+ proxy()->drawControl(CE_ScrollBarSubPage, &newScrollbar, p, widget);
}
}
if (scrollbar->subControls & SC_ScrollBarAddPage) {
newScrollbar.rect = scrollbar->rect;
newScrollbar.state = saveFlags;
- newScrollbar.rect = subControlRect(cc, &newScrollbar, SC_ScrollBarAddPage, widget);
+ newScrollbar.rect = proxy()->subControlRect(cc, &newScrollbar, SC_ScrollBarAddPage, widget);
if (newScrollbar.rect.isValid()) {
if (!(scrollbar->activeSubControls & SC_ScrollBarAddPage))
newScrollbar.state &= ~(State_Sunken | State_MouseOver);
- drawControl(CE_ScrollBarAddPage, &newScrollbar, p, widget);
+ proxy()->drawControl(CE_ScrollBarAddPage, &newScrollbar, p, widget);
}
}
if (scrollbar->subControls & SC_ScrollBarFirst) {
newScrollbar.rect = scrollbar->rect;
newScrollbar.state = saveFlags;
- newScrollbar.rect = subControlRect(cc, &newScrollbar, SC_ScrollBarFirst, widget);
+ newScrollbar.rect = proxy()->subControlRect(cc, &newScrollbar, SC_ScrollBarFirst, widget);
if (newScrollbar.rect.isValid()) {
if (!(scrollbar->activeSubControls & SC_ScrollBarFirst))
newScrollbar.state &= ~(State_Sunken | State_MouseOver);
- drawControl(CE_ScrollBarFirst, &newScrollbar, p, widget);
+ proxy()->drawControl(CE_ScrollBarFirst, &newScrollbar, p, widget);
}
}
if (scrollbar->subControls & SC_ScrollBarLast) {
newScrollbar.rect = scrollbar->rect;
newScrollbar.state = saveFlags;
- newScrollbar.rect = subControlRect(cc, &newScrollbar, SC_ScrollBarLast, widget);
+ newScrollbar.rect = proxy()->subControlRect(cc, &newScrollbar, SC_ScrollBarLast, widget);
if (newScrollbar.rect.isValid()) {
if (!(scrollbar->activeSubControls & SC_ScrollBarLast))
newScrollbar.state &= ~(State_Sunken | State_MouseOver);
- drawControl(CE_ScrollBarLast, &newScrollbar, p, widget);
+ proxy()->drawControl(CE_ScrollBarLast, &newScrollbar, p, widget);
}
}
if (scrollbar->subControls & SC_ScrollBarSlider) {
newScrollbar.rect = scrollbar->rect;
newScrollbar.state = saveFlags;
- newScrollbar.rect = subControlRect(cc, &newScrollbar, SC_ScrollBarSlider, widget);
+ newScrollbar.rect = proxy()->subControlRect(cc, &newScrollbar, SC_ScrollBarSlider, widget);
if (newScrollbar.rect.isValid()) {
if (!(scrollbar->activeSubControls & SC_ScrollBarSlider))
newScrollbar.state &= ~(State_Sunken | State_MouseOver);
- drawControl(CE_ScrollBarSlider, &newScrollbar, p, widget);
+ proxy()->drawControl(CE_ScrollBarSlider, &newScrollbar, p, widget);
if (scrollbar->state & State_HasFocus) {
QStyleOptionFocusRect fropt;
@@ -3451,7 +3272,7 @@ void QCommonStyle::drawComplexControl(ComplexControl cc, const QStyleOptionCompl
fropt.rect.setRect(newScrollbar.rect.x() + 2, newScrollbar.rect.y() + 2,
newScrollbar.rect.width() - 5,
newScrollbar.rect.height() - 5);
- drawPrimitive(PE_FrameFocusRect, &fropt, p, widget);
+ proxy()->drawPrimitive(PE_FrameFocusRect, &fropt, p, widget);
}
}
}
@@ -3473,7 +3294,7 @@ void QCommonStyle::drawComplexControl(ComplexControl cc, const QStyleOptionCompl
PrimitiveElement pe;
if (sb->frame && (sb->subControls & SC_SpinBoxFrame)) {
- QRect r = subControlRect(CC_SpinBox, sb, SC_SpinBoxFrame, widget);
+ QRect r = proxy()->subControlRect(CC_SpinBox, sb, SC_SpinBoxFrame, widget);
qDrawWinPanel(p, r, sb->palette, true);
}
@@ -3497,10 +3318,10 @@ void QCommonStyle::drawComplexControl(ComplexControl cc, const QStyleOptionCompl
pe = (sb->buttonSymbols == QAbstractSpinBox::PlusMinus ? PE_IndicatorSpinPlus
: PE_IndicatorSpinUp);
- copy.rect = subControlRect(CC_SpinBox, sb, SC_SpinBoxUp, widget);
- drawPrimitive(PE_PanelButtonBevel, &copy, p, widget);
+ copy.rect = proxy()->subControlRect(CC_SpinBox, sb, SC_SpinBoxUp, widget);
+ proxy()->drawPrimitive(PE_PanelButtonBevel, &copy, p, widget);
copy.rect.adjust(3, 0, -4, 0);
- drawPrimitive(pe, &copy, p, widget);
+ proxy()->drawPrimitive(pe, &copy, p, widget);
}
if (sb->subControls & SC_SpinBoxDown) {
@@ -3523,10 +3344,10 @@ void QCommonStyle::drawComplexControl(ComplexControl cc, const QStyleOptionCompl
pe = (sb->buttonSymbols == QAbstractSpinBox::PlusMinus ? PE_IndicatorSpinMinus
: PE_IndicatorSpinDown);
- copy.rect = subControlRect(CC_SpinBox, sb, SC_SpinBoxDown, widget);
- drawPrimitive(PE_PanelButtonBevel, &copy, p, widget);
+ copy.rect = proxy()->subControlRect(CC_SpinBox, sb, SC_SpinBoxDown, widget);
+ proxy()->drawPrimitive(PE_PanelButtonBevel, &copy, p, widget);
copy.rect.adjust(3, 0, -4, 0);
- drawPrimitive(pe, &copy, p, widget);
+ proxy()->drawPrimitive(pe, &copy, p, widget);
}
}
break;
@@ -3536,8 +3357,8 @@ void QCommonStyle::drawComplexControl(ComplexControl cc, const QStyleOptionCompl
if (const QStyleOptionToolButton *toolbutton
= qstyleoption_cast<const QStyleOptionToolButton *>(opt)) {
QRect button, menuarea;
- button = subControlRect(cc, toolbutton, SC_ToolButton, widget);
- menuarea = subControlRect(cc, toolbutton, SC_ToolButtonMenu, widget);
+ button = proxy()->subControlRect(cc, toolbutton, SC_ToolButton, widget);
+ menuarea = proxy()->subControlRect(cc, toolbutton, SC_ToolButtonMenu, widget);
State bflags = toolbutton->state & ~State_Sunken;
@@ -3559,7 +3380,7 @@ void QCommonStyle::drawComplexControl(ComplexControl cc, const QStyleOptionCompl
if (bflags & (State_Sunken | State_On | State_Raised)) {
tool.rect = button;
tool.state = bflags;
- drawPrimitive(PE_PanelButtonTool, &tool, p, widget);
+ proxy()->drawPrimitive(PE_PanelButtonTool, &tool, p, widget);
}
}
@@ -3568,28 +3389,28 @@ void QCommonStyle::drawComplexControl(ComplexControl cc, const QStyleOptionCompl
fr.QStyleOption::operator=(*toolbutton);
fr.rect.adjust(3, 3, -3, -3);
if (toolbutton->features & QStyleOptionToolButton::MenuButtonPopup)
- fr.rect.adjust(0, 0, -pixelMetric(QStyle::PM_MenuButtonIndicator,
+ fr.rect.adjust(0, 0, -proxy()->pixelMetric(QStyle::PM_MenuButtonIndicator,
toolbutton, widget), 0);
- drawPrimitive(PE_FrameFocusRect, &fr, p, widget);
+ proxy()->drawPrimitive(PE_FrameFocusRect, &fr, p, widget);
}
QStyleOptionToolButton label = *toolbutton;
label.state = bflags;
- int fw = pixelMetric(PM_DefaultFrameWidth, opt, widget);
+ int fw = proxy()->pixelMetric(PM_DefaultFrameWidth, opt, widget);
label.rect = button.adjusted(fw, fw, -fw, -fw);
- drawControl(CE_ToolButtonLabel, &label, p, widget);
+ proxy()->drawControl(CE_ToolButtonLabel, &label, p, widget);
if (toolbutton->subControls & SC_ToolButtonMenu) {
tool.rect = menuarea;
tool.state = mflags;
if (mflags & (State_Sunken | State_On | State_Raised))
- drawPrimitive(PE_IndicatorButtonDropDown, &tool, p, widget);
- drawPrimitive(PE_IndicatorArrowDown, &tool, p, widget);
+ proxy()->drawPrimitive(PE_IndicatorButtonDropDown, &tool, p, widget);
+ proxy()->drawPrimitive(PE_IndicatorArrowDown, &tool, p, widget);
} else if (toolbutton->features & QStyleOptionToolButton::HasMenu) {
- int mbi = pixelMetric(PM_MenuButtonIndicator, toolbutton, widget);
+ int mbi = proxy()->pixelMetric(PM_MenuButtonIndicator, toolbutton, widget);
QRect ir = toolbutton->rect;
QStyleOptionToolButton newBtn = *toolbutton;
newBtn.rect = QRect(ir.right() + 5 - mbi, ir.y() + ir.height() - mbi + 4, mbi - 6, mbi - 6);
- drawPrimitive(PE_IndicatorArrowDown, &newBtn, p, widget);
+ proxy()->drawPrimitive(PE_IndicatorArrowDown, &newBtn, p, widget);
}
}
break;
@@ -3613,7 +3434,7 @@ void QCommonStyle::drawComplexControl(ComplexControl cc, const QStyleOptionCompl
p->fillRect(opt->rect, fillBrush);
- ir = subControlRect(CC_TitleBar, tb, SC_TitleBarLabel, widget);
+ ir = proxy()->subControlRect(CC_TitleBar, tb, SC_TitleBarLabel, widget);
p->setPen(tb->palette.highlightedText().color());
p->drawText(ir.x() + 2, ir.y(), ir.width() - 2, ir.height(),
@@ -3626,7 +3447,7 @@ void QCommonStyle::drawComplexControl(ComplexControl cc, const QStyleOptionCompl
QStyleOption tool(0);
tool.palette = tb->palette;
if (tb->subControls & SC_TitleBarCloseButton && tb->titleBarFlags & Qt::WindowSystemMenuHint) {
- ir = subControlRect(CC_TitleBar, tb, SC_TitleBarCloseButton, widget);
+ ir = proxy()->subControlRect(CC_TitleBar, tb, SC_TitleBarCloseButton, widget);
down = tb->activeSubControls & SC_TitleBarCloseButton && (opt->state & State_Sunken);
if ((tb->titleBarFlags & Qt::WindowType_Mask) == Qt::Tool
#ifndef QT_NO_DOCKWIDGET
@@ -3638,50 +3459,50 @@ void QCommonStyle::drawComplexControl(ComplexControl cc, const QStyleOptionCompl
pm = standardIcon(SP_TitleBarCloseButton, &tool, widget).pixmap(10, 10);
tool.rect = ir;
tool.state = down ? State_Sunken : State_Raised;
- drawPrimitive(PE_PanelButtonTool, &tool, p, widget);
+ proxy()->drawPrimitive(PE_PanelButtonTool, &tool, p, widget);
p->save();
if (down)
- p->translate(pixelMetric(PM_ButtonShiftHorizontal, tb, widget),
- pixelMetric(PM_ButtonShiftVertical, tb, widget));
- drawItemPixmap(p, ir, Qt::AlignCenter, pm);
+ p->translate(proxy()->pixelMetric(PM_ButtonShiftHorizontal, tb, widget),
+ proxy()->pixelMetric(PM_ButtonShiftVertical, tb, widget));
+ proxy()->drawItemPixmap(p, ir, Qt::AlignCenter, pm);
p->restore();
}
if (tb->subControls & SC_TitleBarMaxButton
&& tb->titleBarFlags & Qt::WindowMaximizeButtonHint
&& !(tb->titleBarState & Qt::WindowMaximized)) {
- ir = subControlRect(CC_TitleBar, tb, SC_TitleBarMaxButton, widget);
+ ir = proxy()->subControlRect(CC_TitleBar, tb, SC_TitleBarMaxButton, widget);
down = tb->activeSubControls & SC_TitleBarMaxButton && (opt->state & State_Sunken);
pm = standardIcon(SP_TitleBarMaxButton, &tool, widget).pixmap(10, 10);
tool.rect = ir;
tool.state = down ? State_Sunken : State_Raised;
- drawPrimitive(PE_PanelButtonTool, &tool, p, widget);
+ proxy()->drawPrimitive(PE_PanelButtonTool, &tool, p, widget);
p->save();
if (down)
- p->translate(pixelMetric(PM_ButtonShiftHorizontal, tb, widget),
- pixelMetric(PM_ButtonShiftVertical, tb, widget));
- drawItemPixmap(p, ir, Qt::AlignCenter, pm);
+ p->translate(proxy()->pixelMetric(PM_ButtonShiftHorizontal, tb, widget),
+ proxy()->pixelMetric(PM_ButtonShiftVertical, tb, widget));
+ proxy()->drawItemPixmap(p, ir, Qt::AlignCenter, pm);
p->restore();
}
if (tb->subControls & SC_TitleBarMinButton
&& tb->titleBarFlags & Qt::WindowMinimizeButtonHint
&& !(tb->titleBarState & Qt::WindowMinimized)) {
- ir = subControlRect(CC_TitleBar, tb, SC_TitleBarMinButton, widget);
+ ir = proxy()->subControlRect(CC_TitleBar, tb, SC_TitleBarMinButton, widget);
down = tb->activeSubControls & SC_TitleBarMinButton && (opt->state & State_Sunken);
pm = standardIcon(SP_TitleBarMinButton, &tool, widget).pixmap(10, 10);
tool.rect = ir;
tool.state = down ? State_Sunken : State_Raised;
- drawPrimitive(PE_PanelButtonTool, &tool, p, widget);
+ proxy()->drawPrimitive(PE_PanelButtonTool, &tool, p, widget);
p->save();
if (down)
- p->translate(pixelMetric(PM_ButtonShiftHorizontal, tb, widget),
- pixelMetric(PM_ButtonShiftVertical, tb, widget));
- drawItemPixmap(p, ir, Qt::AlignCenter, pm);
+ p->translate(proxy()->pixelMetric(PM_ButtonShiftHorizontal, tb, widget),
+ proxy()->pixelMetric(PM_ButtonShiftVertical, tb, widget));
+ proxy()->drawItemPixmap(p, ir, Qt::AlignCenter, pm);
p->restore();
}
@@ -3692,81 +3513,81 @@ void QCommonStyle::drawComplexControl(ComplexControl cc, const QStyleOptionCompl
&& (tb->titleBarState & Qt::WindowMaximized)));
if (drawNormalButton) {
- ir = subControlRect(CC_TitleBar, tb, SC_TitleBarNormalButton, widget);
+ ir = proxy()->subControlRect(CC_TitleBar, tb, SC_TitleBarNormalButton, widget);
down = tb->activeSubControls & SC_TitleBarNormalButton && (opt->state & State_Sunken);
pm = standardIcon(SP_TitleBarNormalButton, &tool, widget).pixmap(10, 10);
tool.rect = ir;
tool.state = down ? State_Sunken : State_Raised;
- drawPrimitive(PE_PanelButtonTool, &tool, p, widget);
+ proxy()->drawPrimitive(PE_PanelButtonTool, &tool, p, widget);
p->save();
if (down)
- p->translate(pixelMetric(PM_ButtonShiftHorizontal, tb, widget),
- pixelMetric(PM_ButtonShiftVertical, tb, widget));
- drawItemPixmap(p, ir, Qt::AlignCenter, pm);
+ p->translate(proxy()->pixelMetric(PM_ButtonShiftHorizontal, tb, widget),
+ proxy()->pixelMetric(PM_ButtonShiftVertical, tb, widget));
+ proxy()->drawItemPixmap(p, ir, Qt::AlignCenter, pm);
p->restore();
}
if (tb->subControls & SC_TitleBarShadeButton
&& tb->titleBarFlags & Qt::WindowShadeButtonHint
&& !(tb->titleBarState & Qt::WindowMinimized)) {
- ir = subControlRect(CC_TitleBar, tb, SC_TitleBarShadeButton, widget);
+ ir = proxy()->subControlRect(CC_TitleBar, tb, SC_TitleBarShadeButton, widget);
down = (tb->activeSubControls & SC_TitleBarShadeButton && (opt->state & State_Sunken));
pm = standardIcon(SP_TitleBarShadeButton, &tool, widget).pixmap(10, 10);
tool.rect = ir;
tool.state = down ? State_Sunken : State_Raised;
- drawPrimitive(PE_PanelButtonTool, &tool, p, widget);
+ proxy()->drawPrimitive(PE_PanelButtonTool, &tool, p, widget);
p->save();
if (down)
- p->translate(pixelMetric(PM_ButtonShiftHorizontal, tb, widget),
- pixelMetric(PM_ButtonShiftVertical, tb, widget));
- drawItemPixmap(p, ir, Qt::AlignCenter, pm);
+ p->translate(proxy()->pixelMetric(PM_ButtonShiftHorizontal, tb, widget),
+ proxy()->pixelMetric(PM_ButtonShiftVertical, tb, widget));
+ proxy()->drawItemPixmap(p, ir, Qt::AlignCenter, pm);
p->restore();
}
if (tb->subControls & SC_TitleBarUnshadeButton
&& tb->titleBarFlags & Qt::WindowShadeButtonHint
&& tb->titleBarState & Qt::WindowMinimized) {
- ir = subControlRect(CC_TitleBar, tb, SC_TitleBarUnshadeButton, widget);
+ ir = proxy()->subControlRect(CC_TitleBar, tb, SC_TitleBarUnshadeButton, widget);
down = tb->activeSubControls & SC_TitleBarUnshadeButton && (opt->state & State_Sunken);
pm = standardIcon(SP_TitleBarUnshadeButton, &tool, widget).pixmap(10, 10);
tool.rect = ir;
tool.state = down ? State_Sunken : State_Raised;
- drawPrimitive(PE_PanelButtonTool, &tool, p, widget);
+ proxy()->drawPrimitive(PE_PanelButtonTool, &tool, p, widget);
p->save();
if (down)
- p->translate(pixelMetric(PM_ButtonShiftHorizontal, tb, widget),
- pixelMetric(PM_ButtonShiftVertical, tb, widget));
- drawItemPixmap(p, ir, Qt::AlignCenter, pm);
+ p->translate(proxy()->pixelMetric(PM_ButtonShiftHorizontal, tb, widget),
+ proxy()->pixelMetric(PM_ButtonShiftVertical, tb, widget));
+ proxy()->drawItemPixmap(p, ir, Qt::AlignCenter, pm);
p->restore();
}
if (tb->subControls & SC_TitleBarContextHelpButton
&& tb->titleBarFlags & Qt::WindowContextHelpButtonHint) {
- ir = subControlRect(CC_TitleBar, tb, SC_TitleBarContextHelpButton, widget);
+ ir = proxy()->subControlRect(CC_TitleBar, tb, SC_TitleBarContextHelpButton, widget);
down = tb->activeSubControls & SC_TitleBarContextHelpButton && (opt->state & State_Sunken);
pm = standardIcon(SP_TitleBarContextHelpButton, &tool, widget).pixmap(10, 10);
tool.rect = ir;
tool.state = down ? State_Sunken : State_Raised;
- drawPrimitive(PE_PanelButtonTool, &tool, p, widget);
+ proxy()->drawPrimitive(PE_PanelButtonTool, &tool, p, widget);
p->save();
if (down)
- p->translate(pixelMetric(PM_ButtonShiftHorizontal, tb, widget),
- pixelMetric(PM_ButtonShiftVertical, tb, widget));
- drawItemPixmap(p, ir, Qt::AlignCenter, pm);
+ p->translate(proxy()->pixelMetric(PM_ButtonShiftHorizontal, tb, widget),
+ proxy()->pixelMetric(PM_ButtonShiftVertical, tb, widget));
+ proxy()->drawItemPixmap(p, ir, Qt::AlignCenter, pm);
p->restore();
}
if (tb->subControls & SC_TitleBarSysMenu && tb->titleBarFlags & Qt::WindowSystemMenuHint) {
- ir = subControlRect(CC_TitleBar, tb, SC_TitleBarSysMenu, widget);
+ ir = proxy()->subControlRect(CC_TitleBar, tb, SC_TitleBarSysMenu, widget);
if (!tb->icon.isNull()) {
tb->icon.paint(p, ir);
} else {
- int iconSize = pixelMetric(PM_SmallIconSize, tb, widget);
+ int iconSize = proxy()->pixelMetric(PM_SmallIconSize, tb, widget);
pm = standardIcon(SP_TitleBarMenuButton, &tool, widget).pixmap(iconSize, iconSize);
tool.rect = ir;
p->save();
- drawItemPixmap(p, ir, Qt::AlignCenter, pm);
+ proxy()->drawItemPixmap(p, ir, Qt::AlignCenter, pm);
p->restore();
}
}
@@ -3794,11 +3615,11 @@ void QCommonStyle::drawComplexControl(ComplexControl cc, const QStyleOptionCompl
// draw notches
if (dial->subControls & QStyle::SC_DialTickmarks) {
p->setPen(pal.foreground().color());
- p->drawLines(calcLines(dial, widget)); // ### calcLines could be cached...
+ p->drawLines(QStyleHelper::calcLines(dial));
}
if (dial->state & State_Enabled) {
- p->setBrush(pal.brush(QPalette::ColorRole(styleHint(SH_Dial_BackgroundRole,
+ p->setBrush(pal.brush(QPalette::ColorRole(proxy()->styleHint(SH_Dial_BackgroundRole,
dial, widget))));
p->setPen(Qt::NoPen);
p->drawEllipse(br);
@@ -3816,7 +3637,7 @@ void QCommonStyle::drawComplexControl(ComplexControl cc, const QStyleOptionCompl
p->setBrush(pal.button());
p->drawPolygon(arrow);
- a = angle(QPointF(width / 2, height / 2), arrow[0]);
+ a = QStyleHelper::angle(QPointF(width / 2, height / 2), arrow[0]);
p->setBrush(Qt::NoBrush);
if (a <= 0 || a > 200) {
@@ -3859,7 +3680,7 @@ void QCommonStyle::drawComplexControl(ComplexControl cc, const QStyleOptionCompl
br.setHeight(br.height() + r / 3);
}
fropt.rect = br.adjusted(-2, -2, 2, 2);
- drawPrimitive(QStyle::PE_FrameFocusRect, &fropt, p, widget);
+ proxy()->drawPrimitive(QStyle::PE_FrameFocusRect, &fropt, p, widget);
}
p->restore();
}
@@ -3869,15 +3690,15 @@ void QCommonStyle::drawComplexControl(ComplexControl cc, const QStyleOptionCompl
case CC_GroupBox:
if (const QStyleOptionGroupBox *groupBox = qstyleoption_cast<const QStyleOptionGroupBox *>(opt)) {
// Draw frame
- QRect textRect = subControlRect(CC_GroupBox, opt, SC_GroupBoxLabel, widget);
- QRect checkBoxRect = subControlRect(CC_GroupBox, opt, SC_GroupBoxCheckBox, widget);
+ QRect textRect = proxy()->subControlRect(CC_GroupBox, opt, SC_GroupBoxLabel, widget);
+ QRect checkBoxRect = proxy()->subControlRect(CC_GroupBox, opt, SC_GroupBoxCheckBox, widget);
if (groupBox->subControls & QStyle::SC_GroupBoxFrame) {
QStyleOptionFrameV2 frame;
frame.QStyleOption::operator=(*groupBox);
frame.features = groupBox->features;
frame.lineWidth = groupBox->lineWidth;
frame.midLineWidth = groupBox->midLineWidth;
- frame.rect = subControlRect(CC_GroupBox, opt, SC_GroupBoxFrame, widget);
+ frame.rect = proxy()->subControlRect(CC_GroupBox, opt, SC_GroupBoxFrame, widget);
p->save();
QRegion region(groupBox->rect);
if (!groupBox->text.isEmpty()) {
@@ -3892,7 +3713,7 @@ void QCommonStyle::drawComplexControl(ComplexControl cc, const QStyleOptionCompl
region -= finalRect;
}
p->setClipRegion(region);
- drawPrimitive(PE_FrameGroupBox, &frame, p, widget);
+ proxy()->drawPrimitive(PE_FrameGroupBox, &frame, p, widget);
p->restore();
}
@@ -3902,10 +3723,10 @@ void QCommonStyle::drawComplexControl(ComplexControl cc, const QStyleOptionCompl
if (textColor.isValid())
p->setPen(textColor);
int alignment = int(groupBox->textAlignment);
- if (!styleHint(QStyle::SH_UnderlineShortcut, opt, widget))
+ if (!proxy()->styleHint(QStyle::SH_UnderlineShortcut, opt, widget))
alignment |= Qt::TextHideMnemonic;
- drawItemText(p, textRect, Qt::TextShowMnemonic | Qt::AlignHCenter | alignment,
+ proxy()->drawItemText(p, textRect, Qt::TextShowMnemonic | Qt::AlignHCenter | alignment,
groupBox->palette, groupBox->state & State_Enabled, groupBox->text,
textColor.isValid() ? QPalette::NoRole : QPalette::WindowText);
@@ -3913,7 +3734,7 @@ void QCommonStyle::drawComplexControl(ComplexControl cc, const QStyleOptionCompl
QStyleOptionFocusRect fropt;
fropt.QStyleOption::operator=(*groupBox);
fropt.rect = textRect;
- drawPrimitive(PE_FrameFocusRect, &fropt, p, widget);
+ proxy()->drawPrimitive(PE_FrameFocusRect, &fropt, p, widget);
}
}
@@ -3922,7 +3743,7 @@ void QCommonStyle::drawComplexControl(ComplexControl cc, const QStyleOptionCompl
QStyleOptionButton box;
box.QStyleOption::operator=(*groupBox);
box.rect = checkBoxRect;
- drawPrimitive(PE_IndicatorCheckBox, &box, p, widget);
+ proxy()->drawPrimitive(PE_IndicatorCheckBox, &box, p, widget);
}
}
break;
@@ -3939,52 +3760,52 @@ void QCommonStyle::drawComplexControl(ComplexControl cc, const QStyleOptionCompl
if (opt->activeSubControls & QStyle::SC_MdiCloseButton && (opt->state & State_Sunken)) {
btnOpt.state |= State_Sunken;
btnOpt.state &= ~State_Raised;
- bsx = pixelMetric(PM_ButtonShiftHorizontal);
- bsy = pixelMetric(PM_ButtonShiftVertical);
+ bsx = proxy()->pixelMetric(PM_ButtonShiftHorizontal);
+ bsy = proxy()->pixelMetric(PM_ButtonShiftVertical);
} else {
btnOpt.state |= State_Raised;
btnOpt.state &= ~State_Sunken;
bsx = 0;
bsy = 0;
}
- btnOpt.rect = subControlRect(CC_MdiControls, opt, SC_MdiCloseButton, widget);
- drawPrimitive(PE_PanelButtonCommand, &btnOpt, p, widget);
+ btnOpt.rect = proxy()->subControlRect(CC_MdiControls, opt, SC_MdiCloseButton, widget);
+ proxy()->drawPrimitive(PE_PanelButtonCommand, &btnOpt, p, widget);
QPixmap pm = standardIcon(SP_TitleBarCloseButton).pixmap(16, 16);
- drawItemPixmap(p, btnOpt.rect.translated(bsx, bsy), Qt::AlignCenter, pm);
+ proxy()->drawItemPixmap(p, btnOpt.rect.translated(bsx, bsy), Qt::AlignCenter, pm);
}
if (opt->subControls & QStyle::SC_MdiNormalButton) {
if (opt->activeSubControls & QStyle::SC_MdiNormalButton && (opt->state & State_Sunken)) {
btnOpt.state |= State_Sunken;
btnOpt.state &= ~State_Raised;
- bsx = pixelMetric(PM_ButtonShiftHorizontal);
- bsy = pixelMetric(PM_ButtonShiftVertical);
+ bsx = proxy()->pixelMetric(PM_ButtonShiftHorizontal);
+ bsy = proxy()->pixelMetric(PM_ButtonShiftVertical);
} else {
btnOpt.state |= State_Raised;
btnOpt.state &= ~State_Sunken;
bsx = 0;
bsy = 0;
}
- btnOpt.rect = subControlRect(CC_MdiControls, opt, SC_MdiNormalButton, widget);
- drawPrimitive(PE_PanelButtonCommand, &btnOpt, p, widget);
+ btnOpt.rect = proxy()->subControlRect(CC_MdiControls, opt, SC_MdiNormalButton, widget);
+ proxy()->drawPrimitive(PE_PanelButtonCommand, &btnOpt, p, widget);
QPixmap pm = standardIcon(SP_TitleBarNormalButton).pixmap(16, 16);
- drawItemPixmap(p, btnOpt.rect.translated(bsx, bsy), Qt::AlignCenter, pm);
+ proxy()->drawItemPixmap(p, btnOpt.rect.translated(bsx, bsy), Qt::AlignCenter, pm);
}
if (opt->subControls & QStyle::SC_MdiMinButton) {
if (opt->activeSubControls & QStyle::SC_MdiMinButton && (opt->state & State_Sunken)) {
btnOpt.state |= State_Sunken;
btnOpt.state &= ~State_Raised;
- bsx = pixelMetric(PM_ButtonShiftHorizontal);
- bsy = pixelMetric(PM_ButtonShiftVertical);
+ bsx = proxy()->pixelMetric(PM_ButtonShiftHorizontal);
+ bsy = proxy()->pixelMetric(PM_ButtonShiftVertical);
} else {
btnOpt.state |= State_Raised;
btnOpt.state &= ~State_Sunken;
bsx = 0;
bsy = 0;
}
- btnOpt.rect = subControlRect(CC_MdiControls, opt, SC_MdiMinButton, widget);
- drawPrimitive(PE_PanelButtonCommand, &btnOpt, p, widget);
+ btnOpt.rect = proxy()->subControlRect(CC_MdiControls, opt, SC_MdiMinButton, widget);
+ proxy()->drawPrimitive(PE_PanelButtonCommand, &btnOpt, p, widget);
QPixmap pm = standardIcon(SP_TitleBarMinButton).pixmap(16, 16);
- drawItemPixmap(p, btnOpt.rect.translated(bsx, bsy), Qt::AlignCenter, pm);
+ proxy()->drawItemPixmap(p, btnOpt.rect.translated(bsx, bsy), Qt::AlignCenter, pm);
}
}
break;
@@ -4006,11 +3827,11 @@ QStyle::SubControl QCommonStyle::hitTestComplexControl(ComplexControl cc, const
#ifndef QT_NO_SLIDER
case CC_Slider:
if (const QStyleOptionSlider *slider = qstyleoption_cast<const QStyleOptionSlider *>(opt)) {
- QRect r = subControlRect(cc, slider, SC_SliderHandle, widget);
+ QRect r = proxy()->subControlRect(cc, slider, SC_SliderHandle, widget);
if (r.isValid() && r.contains(pt)) {
sc = SC_SliderHandle;
} else {
- r = subControlRect(cc, slider, SC_SliderGroove ,widget);
+ r = proxy()->subControlRect(cc, slider, SC_SliderGroove ,widget);
if (r.isValid() && r.contains(pt))
sc = SC_SliderGroove;
}
@@ -4023,7 +3844,7 @@ QStyle::SubControl QCommonStyle::hitTestComplexControl(ComplexControl cc, const
QRect r;
uint ctrl = SC_ScrollBarAddLine;
while (ctrl <= SC_ScrollBarGroove) {
- r = subControlRect(cc, scrollbar, QStyle::SubControl(ctrl), widget);
+ r = proxy()->subControlRect(cc, scrollbar, QStyle::SubControl(ctrl), widget);
if (r.isValid() && r.contains(pt)) {
sc = QStyle::SubControl(ctrl);
break;
@@ -4039,7 +3860,7 @@ QStyle::SubControl QCommonStyle::hitTestComplexControl(ComplexControl cc, const
QRect r;
uint ctrl = SC_ToolButton;
while (ctrl <= SC_ToolButtonMenu) {
- r = subControlRect(cc, toolbutton, QStyle::SubControl(ctrl), widget);
+ r = proxy()->subControlRect(cc, toolbutton, QStyle::SubControl(ctrl), widget);
if (r.isValid() && r.contains(pt)) {
sc = QStyle::SubControl(ctrl);
break;
@@ -4063,7 +3884,7 @@ QStyle::SubControl QCommonStyle::hitTestComplexControl(ComplexControl cc, const
QRect r;
uint ctrl = SC_SpinBoxUp;
while (ctrl <= SC_SpinBoxEditField) {
- r = subControlRect(cc, spinbox, QStyle::SubControl(ctrl), widget);
+ r = proxy()->subControlRect(cc, spinbox, QStyle::SubControl(ctrl), widget);
if (r.isValid() && r.contains(pt)) {
sc = QStyle::SubControl(ctrl);
break;
@@ -4079,7 +3900,7 @@ QStyle::SubControl QCommonStyle::hitTestComplexControl(ComplexControl cc, const
uint ctrl = SC_TitleBarSysMenu;
while (ctrl <= SC_TitleBarLabel) {
- r = subControlRect(cc, tb, QStyle::SubControl(ctrl), widget);
+ r = proxy()->subControlRect(cc, tb, QStyle::SubControl(ctrl), widget);
if (r.isValid() && r.contains(pt)) {
sc = QStyle::SubControl(ctrl);
break;
@@ -4094,7 +3915,7 @@ QStyle::SubControl QCommonStyle::hitTestComplexControl(ComplexControl cc, const
QRect r;
uint ctrl = SC_ComboBoxArrow; // Start here and go down.
while (ctrl > 0) {
- r = subControlRect(cc, cb, QStyle::SubControl(ctrl), widget);
+ r = proxy()->subControlRect(cc, cb, QStyle::SubControl(ctrl), widget);
if (r.isValid() && r.contains(pt)) {
sc = QStyle::SubControl(ctrl);
break;
@@ -4110,7 +3931,7 @@ QStyle::SubControl QCommonStyle::hitTestComplexControl(ComplexControl cc, const
QRect r;
uint ctrl = SC_GroupBoxCheckBox;
while (ctrl <= SC_GroupBoxFrame) {
- r = subControlRect(cc, groupBox, QStyle::SubControl(ctrl), widget);
+ r = proxy()->subControlRect(cc, groupBox, QStyle::SubControl(ctrl), widget);
if (r.isValid() && r.contains(pt)) {
sc = QStyle::SubControl(ctrl);
break;
@@ -4125,7 +3946,7 @@ QStyle::SubControl QCommonStyle::hitTestComplexControl(ComplexControl cc, const
QRect r;
uint ctrl = SC_MdiMinButton;
while (ctrl <= SC_MdiCloseButton) {
- r = subControlRect(CC_MdiControls, opt, QStyle::SubControl(ctrl), widget);
+ r = proxy()->subControlRect(CC_MdiControls, opt, QStyle::SubControl(ctrl), widget);
if (r.isValid() && r.contains(pt) && (opt->subControls & ctrl)) {
sc = QStyle::SubControl(ctrl);
return sc;
@@ -4151,13 +3972,13 @@ QRect QCommonStyle::subControlRect(ComplexControl cc, const QStyleOptionComplex
#ifndef QT_NO_SLIDER
case CC_Slider:
if (const QStyleOptionSlider *slider = qstyleoption_cast<const QStyleOptionSlider *>(opt)) {
- int tickOffset = pixelMetric(PM_SliderTickmarkOffset, slider, widget);
- int thickness = pixelMetric(PM_SliderControlThickness, slider, widget);
+ int tickOffset = proxy()->pixelMetric(PM_SliderTickmarkOffset, slider, widget);
+ int thickness = proxy()->pixelMetric(PM_SliderControlThickness, slider, widget);
switch (sc) {
case SC_SliderHandle: {
int sliderPos = 0;
- int len = pixelMetric(PM_SliderLength, slider, widget);
+ int len = proxy()->pixelMetric(PM_SliderLength, slider, widget);
bool horizontal = slider->orientation == Qt::Horizontal;
sliderPos = sliderPositionFromValue(slider->minimum, slider->maximum,
slider->sliderPosition,
@@ -4188,7 +4009,7 @@ QRect QCommonStyle::subControlRect(ComplexControl cc, const QStyleOptionComplex
case CC_ScrollBar:
if (const QStyleOptionSlider *scrollbar = qstyleoption_cast<const QStyleOptionSlider *>(opt)) {
const QRect scrollBarRect = scrollbar->rect;
- int sbextent = pixelMetric(PM_ScrollBarExtent, scrollbar, widget);
+ int sbextent = proxy()->pixelMetric(PM_ScrollBarExtent, scrollbar, widget);
int maxlen = ((scrollbar->orientation == Qt::Horizontal) ?
scrollBarRect.width() : scrollBarRect.height()) - (sbextent * 2);
int sliderlen;
@@ -4198,7 +4019,7 @@ QRect QCommonStyle::subControlRect(ComplexControl cc, const QStyleOptionComplex
uint range = scrollbar->maximum - scrollbar->minimum;
sliderlen = (qint64(scrollbar->pageStep) * maxlen) / (range + scrollbar->pageStep);
- int slidermin = pixelMetric(PM_ScrollBarSliderMin, scrollbar, widget);
+ int slidermin = proxy()->pixelMetric(PM_ScrollBarSliderMin, scrollbar, widget);
if (sliderlen < slidermin || range > INT_MAX / 2)
sliderlen = slidermin;
if (sliderlen > maxlen)
@@ -4271,7 +4092,7 @@ QRect QCommonStyle::subControlRect(ComplexControl cc, const QStyleOptionComplex
case CC_SpinBox:
if (const QStyleOptionSpinBox *spinbox = qstyleoption_cast<const QStyleOptionSpinBox *>(opt)) {
QSize bs;
- int fw = spinbox->frame ? pixelMetric(PM_SpinBoxFrameWidth, spinbox, widget) : 0;
+ int fw = spinbox->frame ? proxy()->pixelMetric(PM_SpinBoxFrameWidth, spinbox, widget) : 0;
bs.setHeight(qMax(8, spinbox->rect.height()/2 - fw));
// 1.6 -approximate golden mean
bs.setWidth(qMax(16, qMin(bs.height() * 8 / 5, spinbox->rect.width() / 4)));
@@ -4312,7 +4133,7 @@ QRect QCommonStyle::subControlRect(ComplexControl cc, const QStyleOptionComplex
#ifndef QT_NO_TOOLBUTTON
case CC_ToolButton:
if (const QStyleOptionToolButton *tb = qstyleoption_cast<const QStyleOptionToolButton *>(opt)) {
- int mbi = pixelMetric(PM_MenuButtonIndicator, tb, widget);
+ int mbi = proxy()->pixelMetric(PM_MenuButtonIndicator, tb, widget);
ret = tb->rect;
switch (sc) {
case SC_ToolButton:
@@ -4452,7 +4273,7 @@ QRect QCommonStyle::subControlRect(ComplexControl cc, const QStyleOptionComplex
case SC_GroupBoxContents: {
int topMargin = 0;
int topHeight = 0;
- int verticalAlignment = styleHint(SH_GroupBox_TextLabelVerticalAlignment, groupBox, widget);
+ int verticalAlignment = proxy()->styleHint(SH_GroupBox_TextLabelVerticalAlignment, groupBox, widget);
if (groupBox->text.size() || (groupBox->subControls & QStyle::SC_GroupBoxCheckBox)) {
topHeight = groupBox->fontMetrics.height();
if (verticalAlignment & Qt::AlignVCenter)
@@ -4472,7 +4293,7 @@ QRect QCommonStyle::subControlRect(ComplexControl cc, const QStyleOptionComplex
int frameWidth = 0;
if (!(widget && widget->inherits("Q3GroupBox"))
&& ((groupBox->features & QStyleOptionFrameV2::Flat) == 0)) {
- frameWidth = pixelMetric(PM_DefaultFrameWidth, groupBox, widget);
+ frameWidth = proxy()->pixelMetric(PM_DefaultFrameWidth, groupBox, widget);
}
ret = frameRect.adjusted(frameWidth, frameWidth + topHeight - topMargin,
-frameWidth, -frameWidth);
@@ -4488,8 +4309,8 @@ QRect QCommonStyle::subControlRect(ComplexControl cc, const QStyleOptionComplex
ret = groupBox->rect.adjusted(marg, 0, -marg, 0);
ret.setHeight(h);
- int indicatorWidth = pixelMetric(PM_IndicatorWidth, opt, widget);
- int indicatorSpace = pixelMetric(PM_CheckBoxLabelSpacing, opt, widget) - 1;
+ int indicatorWidth = proxy()->pixelMetric(PM_IndicatorWidth, opt, widget);
+ int indicatorSpace = proxy()->pixelMetric(PM_CheckBoxLabelSpacing, opt, widget) - 1;
bool hasCheckBox = groupBox->subControls & QStyle::SC_GroupBoxCheckBox;
int checkBoxSize = hasCheckBox ? (indicatorWidth + indicatorSpace) : 0;
@@ -4503,7 +4324,7 @@ QRect QCommonStyle::subControlRect(ComplexControl cc, const QStyleOptionComplex
int left = 0;
// Adjust for check box
if (sc == SC_GroupBoxCheckBox) {
- int indicatorHeight = pixelMetric(PM_IndicatorHeight, opt, widget);
+ int indicatorHeight = proxy()->pixelMetric(PM_IndicatorHeight, opt, widget);
left = ltr ? totalRect.left() : (totalRect.right() - indicatorWidth);
int top = totalRect.top() + (fontMetrics.height() - indicatorHeight) / 2;
totalRect.setRect(left, top, indicatorWidth, indicatorHeight);
@@ -4589,17 +4410,17 @@ int QCommonStyle::pixelMetric(PixelMetric m, const QStyleOption *opt, const QWid
ret = 0;
break;
case PM_DialogButtonsSeparator:
- ret = 5;
+ ret = int(QStyleHelper::dpiScaled(5.));
break;
case PM_DialogButtonsButtonWidth:
- ret = 70;
+ ret = int(QStyleHelper::dpiScaled(70.));
break;
case PM_DialogButtonsButtonHeight:
- ret = 30;
+ ret = int(QStyleHelper::dpiScaled(30.));
break;
case PM_CheckListControllerSize:
case PM_CheckListButtonSize:
- ret = 16;
+ ret = int(QStyleHelper::dpiScaled(16.));
break;
case PM_TitleBarHeight: {
if (const QStyleOptionTitleBar *tb = qstyleoption_cast<const QStyleOptionTitleBar *>(opt)) {
@@ -4607,26 +4428,26 @@ int QCommonStyle::pixelMetric(PixelMetric m, const QStyleOption *opt, const QWid
ret = qMax(widget ? widget->fontMetrics().lineSpacing() : opt->fontMetrics.lineSpacing(), 16);
#ifndef QT_NO_DOCKWIDGET
} else if (qobject_cast<const QDockWidget*>(widget)) {
- ret = qMax(widget->fontMetrics().lineSpacing(), 13);
+ ret = qMax(widget->fontMetrics().lineSpacing(), int(QStyleHelper::dpiScaled(13)));
#endif
} else {
ret = qMax(widget ? widget->fontMetrics().lineSpacing() : opt->fontMetrics.lineSpacing(), 18);
}
} else {
- ret = 18;
+ ret = int(QStyleHelper::dpiScaled(18.));
}
break; }
case PM_ScrollBarSliderMin:
- ret = 9;
+ ret = int(QStyleHelper::dpiScaled(9.));
break;
case PM_ButtonMargin:
- ret = 6;
+ ret = int(QStyleHelper::dpiScaled(6.));
break;
case PM_DockWidgetTitleBarButtonMargin:
- ret = 2;
+ ret = int(QStyleHelper::dpiScaled(2.));
break;
case PM_ButtonDefaultIndicator:
@@ -4634,7 +4455,7 @@ int QCommonStyle::pixelMetric(PixelMetric m, const QStyleOption *opt, const QWid
break;
case PM_MenuButtonIndicator:
- ret = 12;
+ ret = int(QStyleHelper::dpiScaled(12.));
break;
case PM_ButtonShiftHorizontal:
@@ -4649,15 +4470,15 @@ int QCommonStyle::pixelMetric(PixelMetric m, const QStyleOption *opt, const QWid
case PM_MenuPanelWidth:
case PM_TabBarBaseOverlap:
case PM_TabBarBaseHeight:
- ret = pixelMetric(PM_DefaultFrameWidth, opt, widget);
+ ret = proxy()->pixelMetric(PM_DefaultFrameWidth, opt, widget);
break;
case PM_MdiSubWindowFrameWidth:
- ret = 4;
+ ret = int(QStyleHelper::dpiScaled(4.));
break;
case PM_MdiSubWindowMinimizedWidth:
- ret = 196;
+ ret = int(QStyleHelper::dpiScaled(196.));
break;
#ifndef QT_NO_SCROLLBAR
@@ -4668,7 +4489,7 @@ int QCommonStyle::pixelMetric(PixelMetric m, const QStyleOption *opt, const QWid
: QApplication::globalStrut().width();
ret = qMax(16, s);
} else {
- ret = 16;
+ ret = int(QStyleHelper::dpiScaled(16.));
}
break;
#endif
@@ -4678,14 +4499,14 @@ int QCommonStyle::pixelMetric(PixelMetric m, const QStyleOption *opt, const QWid
#ifndef QT_NO_SLIDER
case PM_SliderThickness:
- ret = 16;
+ ret = int(QStyleHelper::dpiScaled(16.));
break;
case PM_SliderTickmarkOffset:
if (const QStyleOptionSlider *sl = qstyleoption_cast<const QStyleOptionSlider *>(opt)) {
int space = (sl->orientation == Qt::Horizontal) ? sl->rect.height()
: sl->rect.width();
- int thickness = pixelMetric(PM_SliderControlThickness, sl, widget);
+ int thickness = proxy()->pixelMetric(PM_SliderControlThickness, sl, widget);
int ticks = sl->tickPosition;
if (ticks == QSlider::TicksBothSides)
@@ -4702,9 +4523,9 @@ int QCommonStyle::pixelMetric(PixelMetric m, const QStyleOption *opt, const QWid
case PM_SliderSpaceAvailable:
if (const QStyleOptionSlider *sl = qstyleoption_cast<const QStyleOptionSlider *>(opt)) {
if (sl->orientation == Qt::Horizontal)
- ret = sl->rect.width() - pixelMetric(PM_SliderLength, sl, widget);
+ ret = sl->rect.width() - proxy()->pixelMetric(PM_SliderLength, sl, widget);
else
- ret = sl->rect.height() - pixelMetric(PM_SliderLength, sl, widget);
+ ret = sl->rect.height() - proxy()->pixelMetric(PM_SliderLength, sl, widget);
} else {
ret = 0;
}
@@ -4712,11 +4533,11 @@ int QCommonStyle::pixelMetric(PixelMetric m, const QStyleOption *opt, const QWid
#endif // QT_NO_SLIDER
#ifndef QT_NO_DOCKWIDGET
case PM_DockWidgetSeparatorExtent:
- ret = 6;
+ ret = int(QStyleHelper::dpiScaled(6.));
break;
case PM_DockWidgetHandleExtent:
- ret = 8;
+ ret = int(QStyleHelper::dpiScaled(8.));
break;
case PM_DockWidgetTitleMargin:
ret = 0;
@@ -4745,19 +4566,19 @@ int QCommonStyle::pixelMetric(PixelMetric m, const QStyleOption *opt, const QWid
break;
case PM_ToolBarItemSpacing:
- ret = 4;
+ ret = int(QStyleHelper::dpiScaled(4.));
break;
case PM_ToolBarHandleExtent:
- ret = 8;
+ ret = int(QStyleHelper::dpiScaled(8.));
break;
case PM_ToolBarSeparatorExtent:
- ret = 6;
+ ret = int(QStyleHelper::dpiScaled(6.));
break;
case PM_ToolBarExtensionExtent:
- ret = 12;
+ ret = int(QStyleHelper::dpiScaled(12.));
break;
#endif // QT_NO_TOOLBAR
@@ -4767,7 +4588,7 @@ int QCommonStyle::pixelMetric(PixelMetric m, const QStyleOption *opt, const QWid
break;
case PM_TabBarTabHSpace:
- ret = 24;
+ ret = int(QStyleHelper::dpiScaled(24.));
break;
case PM_TabBarTabShiftHorizontal:
@@ -4796,27 +4617,27 @@ int QCommonStyle::pixelMetric(PixelMetric m, const QStyleOption *opt, const QWid
break;
case PM_IndicatorWidth:
- ret = 13;
+ ret = int(QStyleHelper::dpiScaled(13.));
break;
case PM_IndicatorHeight:
- ret = 13;
+ ret = int(QStyleHelper::dpiScaled(13.));
break;
case PM_ExclusiveIndicatorWidth:
- ret = 12;
+ ret = int(QStyleHelper::dpiScaled(12.));
break;
case PM_ExclusiveIndicatorHeight:
- ret = 12;
+ ret = int(QStyleHelper::dpiScaled(12.));
break;
case PM_MenuTearoffHeight:
- ret = 10;
+ ret = int(QStyleHelper::dpiScaled(10.));
break;
case PM_MenuScrollerHeight:
- ret = 10;
+ ret = int(QStyleHelper::dpiScaled(10.));
break;
case PM_MenuDesktopFrameWidth:
@@ -4826,16 +4647,16 @@ int QCommonStyle::pixelMetric(PixelMetric m, const QStyleOption *opt, const QWid
break;
case PM_HeaderMargin:
- ret = 4;
+ ret = int(QStyleHelper::dpiScaled(4.));
break;
case PM_HeaderMarkSize:
- ret = 32;
+ ret = int(QStyleHelper::dpiScaled(32.));
break;
case PM_HeaderGripMargin:
- ret = 4;
+ ret = int(QStyleHelper::dpiScaled(4.));
break;
case PM_TabBarScrollButtonWidth:
- ret = 16;
+ ret = int(QStyleHelper::dpiScaled(16.));
break;
case PM_LayoutLeftMargin:
case PM_LayoutTopMargin:
@@ -4848,40 +4669,56 @@ int QCommonStyle::pixelMetric(PixelMetric m, const QStyleOption *opt, const QWid
} else if (widget) {
isWindow = widget->isWindow();
}
- ret = pixelMetric(isWindow ? PM_DefaultTopLevelMargin : PM_DefaultChildMargin);
+ ret = proxy()->pixelMetric(isWindow ? PM_DefaultTopLevelMargin : PM_DefaultChildMargin);
}
break;
case PM_LayoutHorizontalSpacing:
case PM_LayoutVerticalSpacing:
- ret = pixelMetric(PM_DefaultLayoutSpacing);
+ ret = proxy()->pixelMetric(PM_DefaultLayoutSpacing);
break;
case PM_DefaultTopLevelMargin:
- ret = 11;
+ ret = int(QStyleHelper::dpiScaled(11.));
break;
case PM_DefaultChildMargin:
- ret = 9;
+ ret = int(QStyleHelper::dpiScaled(9.));
break;
case PM_DefaultLayoutSpacing:
- ret = 6;
+ ret = int(QStyleHelper::dpiScaled(6.));
break;
- case PM_TabBarIconSize:
case PM_ToolBarIconSize:
+#ifdef Q_WS_X11
+ if (X11->desktopVersion >= 4) {
+ static int iconSize = 0;
+ if (!iconSize) {
+ QSettings settings(QKde::kdeHome() +
+ QLatin1String("/share/config/kdeglobals"),
+ QSettings::IniFormat);
+ settings.beginGroup(QLatin1String("ToolbarIcons"));
+ iconSize = settings.value(QLatin1String("Size"), QLatin1String("22")).toInt();
+ }
+ ret = iconSize;
+ } else
+#endif
+ ret = proxy()->pixelMetric(PM_SmallIconSize, opt, widget);
+ break;
+
+ case PM_TabBarIconSize:
case PM_ListViewIconSize:
- ret = pixelMetric(PM_SmallIconSize, opt, widget);
+ ret = proxy()->pixelMetric(PM_SmallIconSize, opt, widget);
break;
case PM_ButtonIconSize:
case PM_SmallIconSize:
- ret = 16;
+ ret = int(QStyleHelper::dpiScaled(16.));
break;
case PM_IconViewIconSize:
- ret = pixelMetric(PM_LargeIconSize, opt, widget);
+ ret = proxy()->pixelMetric(PM_LargeIconSize, opt, widget);
break;
case PM_LargeIconSize:
- ret = 32;
+ ret = int(QStyleHelper::dpiScaled(32.));
break;
case PM_ToolTipLabelFrameWidth:
@@ -4889,13 +4726,20 @@ int QCommonStyle::pixelMetric(PixelMetric m, const QStyleOption *opt, const QWid
break;
case PM_CheckBoxLabelSpacing:
case PM_RadioButtonLabelSpacing:
- ret = 6;
+ ret = int(QStyleHelper::dpiScaled(6.));
break;
case PM_SizeGripSize:
- ret = 13;
+ ret = int(QStyleHelper::dpiScaled(13.));
break;
case PM_MessageBoxIconSize:
- ret = 32;
+#ifdef Q_WS_MAC
+ if (QApplication::desktopSettingsAware()) {
+ ret = 64; // No DPI scaling, it's handled elsewhere.
+ } else
+#endif
+ {
+ ret = int(QStyleHelper::dpiScaled(32.));
+ }
break;
case PM_TextCursorWidth:
ret = 1;
@@ -4905,13 +4749,13 @@ int QCommonStyle::pixelMetric(PixelMetric m, const QStyleOption *opt, const QWid
break;
case PM_TabCloseIndicatorWidth:
case PM_TabCloseIndicatorHeight:
- ret = 16;
+ ret = int(QStyleHelper::dpiScaled(16.));
break;
case PM_ScrollView_ScrollBarSpacing:
- ret = 2 * pixelMetric(PM_DefaultFrameWidth, opt, widget);
+ ret = 2 * proxy()->pixelMetric(PM_DefaultFrameWidth, opt, widget);
break;
case PM_SubMenuOverlap:
- ret = -pixelMetric(QStyle::PM_MenuPanelWidth, opt, widget);
+ ret = -proxy()->pixelMetric(QStyle::PM_MenuPanelWidth, opt, widget);
break;
default:
ret = 0;
@@ -4934,12 +4778,12 @@ QSize QCommonStyle::sizeFromContents(ContentsType ct, const QStyleOption *opt,
if (const QStyleOptionButton *btn = qstyleoption_cast<const QStyleOptionButton *>(opt)) {
int w = csz.width(),
h = csz.height(),
- bm = pixelMetric(PM_ButtonMargin, btn, widget),
- fw = pixelMetric(PM_DefaultFrameWidth, btn, widget) * 2;
+ bm = proxy()->pixelMetric(PM_ButtonMargin, btn, widget),
+ fw = proxy()->pixelMetric(PM_DefaultFrameWidth, btn, widget) * 2;
w += bm + fw;
h += bm + fw;
if (btn->features & QStyleOptionButton::AutoDefaultButton){
- int dbw = pixelMetric(PM_ButtonDefaultIndicator, btn, widget) * 2;
+ int dbw = proxy()->pixelMetric(PM_ButtonDefaultIndicator, btn, widget) * 2;
w += dbw;
h += dbw;
}
@@ -4951,15 +4795,15 @@ QSize QCommonStyle::sizeFromContents(ContentsType ct, const QStyleOption *opt,
if (const QStyleOptionButton *btn = qstyleoption_cast<const QStyleOptionButton *>(opt)) {
bool isRadio = (ct == CT_RadioButton);
- int w = pixelMetric(isRadio ? PM_ExclusiveIndicatorWidth
+ int w = proxy()->pixelMetric(isRadio ? PM_ExclusiveIndicatorWidth
: PM_IndicatorWidth, btn, widget);
- int h = pixelMetric(isRadio ? PM_ExclusiveIndicatorHeight
+ int h = proxy()->pixelMetric(isRadio ? PM_ExclusiveIndicatorHeight
: PM_IndicatorHeight, btn, widget);
int margins = 0;
// we add 4 pixels for label margins
if (btn->icon.isNull() || !btn->text.isEmpty())
- margins = 4 + pixelMetric(isRadio ? PM_RadioButtonLabelSpacing
+ margins = 4 + proxy()->pixelMetric(isRadio ? PM_RadioButtonLabelSpacing
: PM_CheckBoxLabelSpacing, opt, widget);
sz += QSize(w + margins, 4);
sz.setHeight(qMax(sz.height(), h));
@@ -4977,7 +4821,7 @@ QSize QCommonStyle::sizeFromContents(ContentsType ct, const QStyleOption *opt,
} else {
h = mi->fontMetrics.height() + 8;
if (!mi->icon.isNull()) {
- int iconExtent = pixelMetric(PM_SmallIconSize);
+ int iconExtent = proxy()->pixelMetric(PM_SmallIconSize);
h = qMax(h, mi->icon.actualSize(QSize(iconExtent, iconExtent)).height() + 4);
}
}
@@ -5002,10 +4846,10 @@ QSize QCommonStyle::sizeFromContents(ContentsType ct, const QStyleOption *opt,
#ifndef QT_NO_COMBOBOX
case CT_ComboBox:
if (const QStyleOptionComboBox *cmb = qstyleoption_cast<const QStyleOptionComboBox *>(opt)) {
- int fw = cmb->frame ? pixelMetric(PM_ComboBoxFrameWidth, opt, widget) * 2 : 0;
- const int textMargins = 2*(pixelMetric(PM_FocusFrameHMargin) + 1);
+ int fw = cmb->frame ? proxy()->pixelMetric(PM_ComboBoxFrameWidth, opt, widget) * 2 : 0;
+ const int textMargins = 2*(proxy()->pixelMetric(PM_FocusFrameHMargin) + 1);
// QItemDelegate::sizeHint expands the textMargins two times, thus the 2*textMargins...
- int other = qMax(23, 2*textMargins + pixelMetric(QStyle::PM_ScrollBarExtent, opt, widget));
+ int other = qMax(23, 2*textMargins + proxy()->pixelMetric(QStyle::PM_ScrollBarExtent, opt, widget));
sz = QSize(sz.width() + fw + other, sz.height() + fw);
}
break;
@@ -5013,8 +4857,8 @@ QSize QCommonStyle::sizeFromContents(ContentsType ct, const QStyleOption *opt,
case CT_HeaderSection:
if (const QStyleOptionHeader *hdr = qstyleoption_cast<const QStyleOptionHeader *>(opt)) {
bool nullIcon = hdr->icon.isNull();
- int margin = pixelMetric(QStyle::PM_HeaderMargin, hdr, widget);
- int iconSize = nullIcon ? 0 : pixelMetric(QStyle::PM_SmallIconSize, hdr, widget);
+ int margin = proxy()->pixelMetric(QStyle::PM_HeaderMargin, hdr, widget);
+ int iconSize = nullIcon ? 0 : proxy()->pixelMetric(QStyle::PM_SmallIconSize, hdr, widget);
QSize txt = hdr->fontMetrics.size(0, hdr->text);
sz.setHeight(margin + qMax(iconSize, txt.height()) + margin);
sz.setWidth((nullIcon ? 0 : margin) + iconSize
@@ -5212,8 +5056,8 @@ int QCommonStyle::styleHint(StyleHint sh, const QStyleOption *opt, const QWidget
if (widget) {
if(QStyleHintReturnMask *mask = qstyleoption_cast<QStyleHintReturnMask*>(hret)) {
mask->region = widget->rect();
- int vmargin = pixelMetric(QStyle::PM_FocusFrameVMargin),
- hmargin = pixelMetric(QStyle::PM_FocusFrameHMargin);
+ int vmargin = proxy()->pixelMetric(QStyle::PM_FocusFrameVMargin),
+ hmargin = proxy()->pixelMetric(QStyle::PM_FocusFrameHMargin);
mask->region -= QRect(widget->rect().adjusted(hmargin, vmargin, -hmargin, -vmargin));
}
}
@@ -5226,7 +5070,7 @@ int QCommonStyle::styleHint(StyleHint sh, const QStyleOption *opt, const QWidget
ret = true;
if(QStyleHintReturnMask *mask = qstyleoption_cast<QStyleHintReturnMask*>(hret)) {
mask->region = opt->rect;
- int margin = pixelMetric(PM_DefaultFrameWidth) * 2;
+ int margin = proxy()->pixelMetric(PM_DefaultFrameWidth) * 2;
mask->region -= opt->rect.adjusted(margin, margin, -margin, -margin);
}
}
@@ -5282,6 +5126,9 @@ int QCommonStyle::styleHint(StyleHint sh, const QStyleOption *opt, const QWidget
ret = Qt::LinksAccessibleByMouse;
break;
case SH_DialogButtonBox_ButtonsHaveIcons:
+#ifdef Q_WS_X11
+ return true;
+#endif
ret = 0;
break;
case SH_SpellCheckUnderlineStyle:
@@ -5344,6 +5191,18 @@ int QCommonStyle::styleHint(StyleHint sh, const QStyleOption *opt, const QWidget
case SH_DockWidget_ButtonsHaveFrame:
ret = true;
break;
+ case SH_ToolButtonStyle:
+ ret = Qt::ToolButtonIconOnly;
+#ifdef Q_WS_X11
+ {
+ static int buttonStyle = d_func()->lookupToolButtonStyle();
+ return buttonStyle;
+ }
+#endif
+ break;
+ case SH_RequestSoftwareInputPanel:
+ ret = RSIP_OnMouseClickAndAlreadyFocused;
+ break;
default:
ret = 0;
break;
@@ -5361,298 +5220,182 @@ QPixmap QCommonStyle::standardPixmap(StandardPixmap sp, const QStyleOption *opti
Q_UNUSED(widget);
Q_UNUSED(sp);
#else
-#ifdef Q_WS_X11
- Q_D(const QCommonStyle);
QPixmap pixmap;
- if (qApp->desktopSettingsAware()) {
- d->lookupIconTheme();
+ const bool rtl = (option && option->direction == Qt::RightToLeft) || (!option && QApplication::isRightToLeft());
+
+ if (QApplication::desktopSettingsAware() && !QIcon::themeName().isEmpty()) {
switch (sp) {
+ case SP_DialogYesButton:
+ case SP_DialogOkButton:
+ pixmap = QIcon::fromTheme(QLatin1String("dialog-ok")).pixmap(16);
+ break;
+ case SP_DialogApplyButton:
+ pixmap = QIcon::fromTheme(QLatin1String("dialog-ok-apply")).pixmap(16);
+ break;
+ case SP_DialogDiscardButton:
+ pixmap = QIcon::fromTheme(QLatin1String("edit-delete")).pixmap(16);
+ break;
+ case SP_DialogCloseButton:
+ pixmap = QIcon::fromTheme(QLatin1String("dialog-close")).pixmap(16);
+ break;
case SP_DirHomeIcon:
- {
- pixmap = d->findIcon(16, QLatin1String("folder_home.png"));
- if (!pixmap.isNull())
- return pixmap;
- break;
- }
+ pixmap = QIcon::fromTheme(QLatin1String("user-home")).pixmap(16);
+ break;
case SP_MessageBoxInformation:
- {
- pixmap = d->findIcon(32, QLatin1String("messagebox_info.png"));
- if (!pixmap.isNull())
- return pixmap;
- break;
- }
+ pixmap = QIcon::fromTheme(QLatin1String("messagebox_info")).pixmap(16);
+ break;
case SP_MessageBoxWarning:
- {
- pixmap = d->findIcon(32, QLatin1String("messagebox_warning.png"));
- if (!pixmap.isNull())
- return pixmap;
- break;
- }
+ pixmap = QIcon::fromTheme(QLatin1String("messagebox_warning")).pixmap(16);
+ break;
case SP_MessageBoxCritical:
- {
- pixmap = d->findIcon(32, QLatin1String("messagebox_critical.png"));
- if (!pixmap.isNull())
- return pixmap;
- break;
- }
+ pixmap = QIcon::fromTheme(QLatin1String("messagebox_critical")).pixmap(16);
+ break;
case SP_MessageBoxQuestion:
- {
- pixmap = d->findIcon(32, QLatin1String("help.png"));
- if (!pixmap.isNull())
- return pixmap;
- break;
- }
+ pixmap = QIcon::fromTheme(QLatin1String("help")).pixmap(16);
+ break;
case SP_DialogOpenButton:
case SP_DirOpenIcon:
- {
- pixmap = d->findIcon(16, QLatin1String("folder-open.png"));
- if (pixmap.isNull())
- pixmap = d->findIcon(16, QLatin1String("folder_open.png"));
- if (!pixmap.isNull())
- return pixmap;
- break;
- }
+ pixmap = QIcon::fromTheme(QLatin1String("folder-open")).pixmap(16);
+ break;
case SP_FileIcon:
- {
- pixmap = d->findIcon(16, QLatin1String("text-x-generic.png"));
- if (pixmap.isNull())
- pixmap = d->findIcon(16, QLatin1String("empty.png"));
- if (!pixmap.isNull())
- return pixmap;
- break;
- }
- case SP_FileLinkIcon:
- {
- pixmap = d->findIcon(16, QLatin1String("link_overlay.png"));
- if (!pixmap.isNull()) {
- QPixmap fileIcon = d->findIcon(16, QLatin1String("text-x-generic.png"));
- if (fileIcon.isNull())
- fileIcon = d->findIcon(16, QLatin1String("empty.png"));
- if (!fileIcon.isNull()) {
- QPainter painter(&fileIcon);
- painter.drawPixmap(0, 0, 16, 16, pixmap);
- return fileIcon;
- }
- }
- break;
- }
+ pixmap = QIcon::fromTheme(QLatin1String("text-x-generic"),
+ QIcon::fromTheme(QLatin1String("empty"))).pixmap(16);
+ break;
case SP_DirClosedIcon:
case SP_DirIcon:
- {
- pixmap = d->findIcon(16, QLatin1String("folder.png"));
- if (!pixmap.isNull())
- return pixmap;
- break;
- }
- case SP_DirLinkIcon:
- {
- pixmap = d->findIcon(16, QLatin1String("link_overlay.png"));
- if (!pixmap.isNull()) {
- QPixmap dirIcon = d->findIcon(16, QLatin1String("folder.png"));
- if (!dirIcon.isNull()) {
- QPainter painter(&dirIcon);
- painter.drawPixmap(0, 0, 16, 16, pixmap);
- return dirIcon;
- }
- }
+ pixmap = QIcon::fromTheme(QLatin1String("folder")).pixmap(16);
break;
- }
case SP_DriveFDIcon:
- {
- pixmap = d->findIcon(16, QLatin1String("media-floppy.png"));
- if (pixmap.isNull())
- pixmap = d->findIcon(16, QLatin1String("3floppy_unmount.png"));
- if (!pixmap.isNull())
- return pixmap;
+ pixmap = QIcon::fromTheme(QLatin1String("media-floppy"),
+ QIcon::fromTheme(QLatin1String("3floppy_unmount"))).pixmap(16);
break;
- }
case SP_ComputerIcon:
- {
- pixmap = d->findIcon(16, QLatin1String("computer.png"));
- if (pixmap.isNull())
- pixmap = d->findIcon(16, QLatin1String("system.png"));
- if (!pixmap.isNull())
- return pixmap;
+ pixmap = QIcon::fromTheme(QLatin1String("computer"),
+ QIcon::fromTheme(QLatin1String("system"))).pixmap(16);
break;
- }
case SP_DesktopIcon:
- {
- pixmap = d->findIcon(16, QLatin1String("user-desktop.png"));
- if (pixmap.isNull())
- pixmap = d->findIcon(16, QLatin1String("desktop.png"));
- if (!pixmap.isNull())
- return pixmap;
+ pixmap = QIcon::fromTheme(QLatin1String("user-desktop"),
+ QIcon::fromTheme(QLatin1String("desktop"))).pixmap(16);
break;
- }
case SP_TrashIcon:
- {
- pixmap = d->findIcon(16, QLatin1String("user-trash.png"));
- if (pixmap.isNull())
- pixmap = d->findIcon(16, QLatin1String("trashcan_empty.png"));
- if (!pixmap.isNull())
- return pixmap;
+ pixmap = QIcon::fromTheme(QLatin1String("user-trash"),
+ QIcon::fromTheme(QLatin1String("trashcan_empty"))).pixmap(16);
break;
- }
case SP_DriveCDIcon:
case SP_DriveDVDIcon:
- {
- pixmap = d->findIcon(16, QLatin1String("media-optical.png"));
- if (pixmap.isNull())
- pixmap = d->findIcon(16, QLatin1String("cdrom_unmount.png"));
- if (!pixmap.isNull())
- return pixmap;
+ pixmap = QIcon::fromTheme(QLatin1String("media-optical"),
+ QIcon::fromTheme(QLatin1String("cdrom_unmount"))).pixmap(16);
break;
- }
case SP_DriveHDIcon:
- {
- pixmap = d->findIcon(16, QLatin1String("drive-harddisk.png"));
- if (pixmap.isNull())
- pixmap = d->findIcon(16, QLatin1String("hdd_unmount.png"));
- if (!pixmap.isNull())
- return pixmap;
+ pixmap = QIcon::fromTheme(QLatin1String("drive-harddisk"),
+ QIcon::fromTheme(QLatin1String("hdd_unmount"))).pixmap(16);
break;
- }
case SP_FileDialogToParent:
- {
- pixmap = d->findIcon(32, QLatin1String("go-up.png"));
- if (pixmap.isNull())
- pixmap = d->findIcon(32, QLatin1String("up.png"));
- if (!pixmap.isNull())
- return pixmap;
+ pixmap = QIcon::fromTheme(QLatin1String("go-up"),
+ QIcon::fromTheme(QLatin1String("up"))).pixmap(16);
break;
- }
case SP_FileDialogNewFolder:
- {
- pixmap = d->findIcon(16, QLatin1String("folder_new.png"));
- if (!pixmap.isNull())
- return pixmap;
+ pixmap = QIcon::fromTheme(QLatin1String("folder_new")).pixmap(16);
break;
- }
case SP_ArrowUp:
- {
- pixmap = d->findIcon(32, QLatin1String("go-up.png"));
- if (pixmap.isNull())
- pixmap = d->findIcon(32, QLatin1String("up.png"));
- if (!pixmap.isNull())
- return pixmap;
+ pixmap = QIcon::fromTheme(QLatin1String("go-up"),
+ QIcon::fromTheme(QLatin1String("up"))).pixmap(16);
break;
- }
case SP_ArrowDown:
- {
- pixmap = d->findIcon(32, QLatin1String("go-down.png"));
- if (pixmap.isNull())
- pixmap = d->findIcon(32, QLatin1String("down.png"));
- if (!pixmap.isNull())
- return pixmap;
+ pixmap = QIcon::fromTheme(QLatin1String("go-down"),
+ QIcon::fromTheme(QLatin1String("down"))).pixmap(16);
break;
- }
case SP_ArrowRight:
- {
- pixmap = d->findIcon(32, QLatin1String("go-next.png"));
- if (pixmap.isNull())
- pixmap = d->findIcon(32, QLatin1String("forward.png"));
- if (!pixmap.isNull())
- return pixmap;
+ pixmap = QIcon::fromTheme(QLatin1String("go-next"),
+ QIcon::fromTheme(QLatin1String("forward"))).pixmap(16);
break;
- }
case SP_ArrowLeft:
- {
- pixmap = d->findIcon(32, QLatin1String("go-previous.png"));
- if (pixmap.isNull())
- pixmap = d->findIcon(32, QLatin1String("back.png"));
- if (!pixmap.isNull())
- return pixmap;
+ pixmap = QIcon::fromTheme(QLatin1String("go-previous"),
+ QIcon::fromTheme(QLatin1String("back"))).pixmap(16);
break;
- }
case SP_FileDialogDetailedView:
- {
- pixmap = d->findIcon(16, QLatin1String("view_detailed.png"));
- if (!pixmap.isNull())
- return pixmap;
+ pixmap = QIcon::fromTheme(QLatin1String("view_detailed")).pixmap(16);
break;
- }
-
case SP_FileDialogListView:
- {
- pixmap = d->findIcon(16, QLatin1String("view_icon.png"));
- if (!pixmap.isNull())
- return pixmap;
+ pixmap = QIcon::fromTheme(QLatin1String("view_icon")).pixmap(16);
break;
- }
case SP_BrowserReload:
- {
- pixmap = d->findIcon(32, QLatin1String("reload.png"));
- if (!pixmap.isNull())
- return pixmap;
+ pixmap = QIcon::fromTheme(QLatin1String("reload")).pixmap(16);
break;
- }
case SP_BrowserStop:
- {
- pixmap = d->findIcon(32, QLatin1String("stop.png"));
- if (!pixmap.isNull())
- return pixmap;
+ pixmap = QIcon::fromTheme(QLatin1String("process-stop")).pixmap(16);
break;
- }
case SP_MediaPlay:
- {
- pixmap = d->findIcon(16, QLatin1String("player_play.png"));
- if (!pixmap.isNull())
- return pixmap;
+ pixmap = QIcon::fromTheme(QLatin1String("media-playback-start")).pixmap(16);
break;
- }
case SP_MediaPause:
- {
- pixmap = d->findIcon(16, QLatin1String("player_pause.png"));
- if (!pixmap.isNull())
- return pixmap;
+ pixmap = QIcon::fromTheme(QLatin1String("media-playback-pause")).pixmap(16);
break;
- }
case SP_MediaStop:
- {
- pixmap = d->findIcon(16, QLatin1String("player_stop.png"));
- if (!pixmap.isNull())
- return pixmap;
+ pixmap = QIcon::fromTheme(QLatin1String("media-playback-stop")).pixmap(16);
break;
- }
case SP_MediaSeekForward:
- {
- pixmap = d->findIcon(16, QLatin1String("player_fwd.png"));
- if (!pixmap.isNull())
- return pixmap;
+ pixmap = QIcon::fromTheme(QLatin1String("media-seek-forward")).pixmap(16);
break;
- }
case SP_MediaSeekBackward:
- {
- pixmap = d->findIcon(16, QLatin1String("player_rew.png"));
- if (!pixmap.isNull())
- return pixmap;
+ pixmap = QIcon::fromTheme(QLatin1String("media-seek-backward")).pixmap(16);
break;
- }
case SP_MediaSkipForward:
- {
- pixmap = d->findIcon(16, QLatin1String("player_end.png"));
- if (!pixmap.isNull())
- return pixmap;
+ pixmap = QIcon::fromTheme(QLatin1String("media-skip-backward")).pixmap(16);
break;
- }
case SP_MediaSkipBackward:
- {
- pixmap = d->findIcon(16, QLatin1String("player_start.png"));
- if (!pixmap.isNull())
- return pixmap;
+ pixmap = QIcon::fromTheme(QLatin1String("media-skip-backward")).pixmap(16);
+ break;
+ case SP_DialogResetButton:
+ pixmap = QIcon::fromTheme(QLatin1String("edit-clear")).pixmap(24);
+ break;
+ case SP_DialogHelpButton:
+ pixmap = QIcon::fromTheme(QLatin1String("help-contents")).pixmap(24);
break;
+ case SP_DialogNoButton:
+ case SP_DialogCancelButton:
+ pixmap = QIcon::fromTheme(QLatin1String("dialog-cancel"),
+ QIcon::fromTheme(QLatin1String("process-stop"))).pixmap(24);
+ break;
+ case SP_DialogSaveButton:
+ pixmap = QIcon::fromTheme(QLatin1String("document-save")).pixmap(24);
+ break;
+ case SP_FileLinkIcon:
+ pixmap = QIcon::fromTheme(QLatin1String("emblem-symbolic-link")).pixmap(16);
+ if (!pixmap.isNull()) {
+ QPixmap fileIcon = QIcon::fromTheme(QLatin1String("text-x-generic")).pixmap(16);
+ if (fileIcon.isNull())
+ fileIcon = QIcon::fromTheme(QLatin1String("empty")).pixmap(16);
+ if (!fileIcon.isNull()) {
+ QPainter painter(&fileIcon);
+ painter.drawPixmap(0, 0, 16, 16, pixmap);
+ return fileIcon;
+ }
}
-
+ break;
+ case SP_DirLinkIcon:
+ pixmap = QIcon::fromTheme(QLatin1String("emblem-symbolic-link")).pixmap(16);
+ if (!pixmap.isNull()) {
+ QPixmap dirIcon = QIcon::fromTheme(QLatin1String("folder")).pixmap(16);
+ if (!dirIcon.isNull()) {
+ QPainter painter(&dirIcon);
+ painter.drawPixmap(0, 0, 16, 16, pixmap);
+ return dirIcon;
+ }
+ }
+ break;
default:
break;
}
}
-#endif //Q_WS_X11
+
+ if (!pixmap.isNull())
+ return pixmap;
#endif //QT_NO_IMAGEFORMAT_PNG
switch (sp) {
#ifndef QT_NO_IMAGEFORMAT_XPM
case SP_ToolBarHorizontalExtensionButton:
- if (QApplication::layoutDirection() == Qt::RightToLeft) {
+ if (rtl) {
QImage im(tb_extension_arrow_h_xpm);
im = im.convertToFormat(QImage::Format_ARGB32).mirrored(true, false);
return QPixmap::fromImage(im);
@@ -5668,13 +5411,13 @@ QPixmap QCommonStyle::standardPixmap(StandardPixmap sp, const QStyleOption *opti
#ifndef QT_NO_IMAGEFORMAT_PNG
case SP_CommandLink:
case SP_ArrowForward:
- if (QApplication::layoutDirection() == Qt::RightToLeft)
- return standardPixmap(SP_ArrowLeft, option, widget);
- return standardPixmap(SP_ArrowRight, option, widget);
+ if (rtl)
+ return proxy()->standardPixmap(SP_ArrowLeft, option, widget);
+ return proxy()->standardPixmap(SP_ArrowRight, option, widget);
case SP_ArrowBack:
- if (QApplication::layoutDirection() == Qt::RightToLeft)
- return standardPixmap(SP_ArrowRight, option, widget);
- return standardPixmap(SP_ArrowLeft, option, widget);
+ if (rtl)
+ return proxy()->standardPixmap(SP_ArrowRight, option, widget);
+ return proxy()->standardPixmap(SP_ArrowLeft, option, widget);
case SP_ArrowLeft:
return QPixmap(QLatin1String(":/trolltech/styles/commonstyle/images/left-16.png"));
case SP_ArrowRight:
@@ -5684,7 +5427,7 @@ QPixmap QCommonStyle::standardPixmap(StandardPixmap sp, const QStyleOption *opti
case SP_ArrowDown:
return QPixmap(QLatin1String(":/trolltech/styles/commonstyle/images/down-16.png"));
case SP_FileDialogToParent:
- return standardPixmap(SP_ArrowUp, option, widget);
+ return proxy()->standardPixmap(SP_ArrowUp, option, widget);
case SP_FileDialogNewFolder:
return QPixmap(QLatin1String(":/trolltech/styles/commonstyle/images/newdirectory-16.png"));
case SP_FileDialogDetailedView:
@@ -5696,7 +5439,7 @@ QPixmap QCommonStyle::standardPixmap(StandardPixmap sp, const QStyleOption *opti
case SP_FileDialogListView:
return QPixmap(QLatin1String(":/trolltech/styles/commonstyle/images/viewlist-16.png"));
case SP_FileDialogBack:
- return standardPixmap(SP_ArrowBack, option, widget);
+ return proxy()->standardPixmap(SP_ArrowBack, option, widget);
case SP_DriveHDIcon:
return QPixmap(QLatin1String(":/trolltech/styles/commonstyle/images/harddrive-16.png"));
case SP_TrashIcon:
@@ -5783,254 +5526,279 @@ QIcon QCommonStyle::standardIconImplementation(StandardPixmap standardIcon, cons
const QWidget *widget) const
{
QIcon icon;
-#ifdef Q_WS_X11
- Q_D(const QCommonStyle);
- if (qApp->desktopSettingsAware()) {
- d->lookupIconTheme();
- QPixmap pixmap;
+ const bool rtl = (option && option->direction == Qt::RightToLeft) || (!option && QApplication::isRightToLeft());
+ if (QApplication::desktopSettingsAware() && !QIcon::themeName().isEmpty()) {
switch (standardIcon) {
case SP_DirHomeIcon:
- {
- icon = d->createIcon(QLatin1String("folder_home.png"));
+ icon = QIcon::fromTheme(QLatin1String("user-home"));
break;
- }
case SP_MessageBoxInformation:
- {
- icon = d->createIcon(QLatin1String("dialog-information.png"));
- if (icon.isNull())
- icon = d->createIcon(QLatin1String("messagebox_info.png"));
+ icon = QIcon::fromTheme(QLatin1String("dialog-information"));
break;
- }
case SP_MessageBoxWarning:
- {
- icon = d->createIcon(QLatin1String("dialog-warning.png"));
- if (icon.isNull())
- icon = d->createIcon(QLatin1String("messagebox_warning.png"));
+ icon = QIcon::fromTheme(QLatin1String("dialog-warning"));
break;
- }
case SP_MessageBoxCritical:
- {
- icon = d->createIcon(QLatin1String("dialog-error.png"));
- if (icon.isNull())
- icon = d->createIcon(QLatin1String("messagebox_critical.png"));
+ icon = QIcon::fromTheme(QLatin1String("dialog-error"));
break;
- }
case SP_MessageBoxQuestion:
- {
- icon = d->createIcon(QLatin1String("help.png"));
+ icon = QIcon::fromTheme(QLatin1String("dialog-question"));
break;
- }
case SP_DialogOpenButton:
case SP_DirOpenIcon:
- {
- icon = d->createIcon(QLatin1String("folder-open.png"));
- if (icon.isNull())
- icon = d->createIcon(QLatin1String("folder_open.png"));
+ icon = QIcon::fromTheme(QLatin1String("folder-open"));
+ break;
+ case SP_DialogSaveButton:
+ icon = QIcon::fromTheme(QLatin1String("document-save"));
+ break;
+ case SP_DialogApplyButton:
+ icon = QIcon::fromTheme(QLatin1String("dialog-ok-apply"));
+ break;
+ case SP_DialogYesButton:
+ case SP_DialogOkButton:
+ icon = QIcon::fromTheme(QLatin1String("dialog-ok"));
+ break;
+ case SP_DialogDiscardButton:
+ icon = QIcon::fromTheme(QLatin1String("edit-delete"));
+ break;
+ case SP_DialogResetButton:
+ icon = QIcon::fromTheme(QLatin1String("edit-clear"));
+ break;
+ case SP_DialogHelpButton:
+ icon = QIcon::fromTheme(QLatin1String("help-contents"));
break;
- }
case SP_FileIcon:
- {
- icon = d->createIcon(QLatin1String("text-x-generic.png"));
- if (icon.isNull())
- icon = d->createIcon(QLatin1String("empty.png"));
+ icon = QIcon::fromTheme(QLatin1String("text-x-generic"));
break;
- }
case SP_DirClosedIcon:
case SP_DirIcon:
- {
- icon = d->createIcon(QLatin1String("folder.png"));
+ icon = QIcon::fromTheme(QLatin1String("folder"));
break;
- }
case SP_DriveFDIcon:
- {
- icon = d->createIcon(QLatin1String("floppy_unmount.png"));
+ icon = QIcon::fromTheme(QLatin1String("floppy_unmount"));
break;
- }
case SP_ComputerIcon:
- {
- icon = d->createIcon(QLatin1String("computer.png"));
- if (icon.isNull())
- icon = d->createIcon(QLatin1String("system.png"));
+ icon = QIcon::fromTheme(QLatin1String("computer"),
+ QIcon::fromTheme(QLatin1String("system")));
break;
- }
case SP_DesktopIcon:
- {
- icon = d->createIcon(QLatin1String("user-desktop.png"));
+ icon = QIcon::fromTheme(QLatin1String("user-desktop"));
break;
- }
case SP_TrashIcon:
- {
- icon = d->createIcon(QLatin1String("user-trash.png"));
+ icon = QIcon::fromTheme(QLatin1String("user-trash"));
break;
- }
case SP_DriveCDIcon:
case SP_DriveDVDIcon:
- {
- icon = d->createIcon(QLatin1String("media-optical.png"));
- if (icon.isNull())
- icon = d->createIcon(QLatin1String("cdrom_unmount.png"));
+ icon = QIcon::fromTheme(QLatin1String("media-optical"));
break;
- }
case SP_DriveHDIcon:
- {
- icon = d->createIcon(QLatin1String("drive-harddisk.png"));
- if (icon.isNull())
- icon = d->createIcon(QLatin1String("hdd_unmount.png"));
+ icon = QIcon::fromTheme(QLatin1String("drive-harddisk"));
break;
- }
case SP_FileDialogToParent:
- {
- icon = d->createIcon(QLatin1String("go-up.png"));
- if (icon.isNull())
- icon = d->createIcon(QLatin1String("up.png"));
+ icon = QIcon::fromTheme(QLatin1String("go-up"));
break;
- }
case SP_FileDialogNewFolder:
- {
- icon = d->createIcon(QLatin1String("folder_new.png"));
+ icon = QIcon::fromTheme(QLatin1String("folder-new"));
break;
- }
case SP_ArrowUp:
- {
- icon = d->createIcon(QLatin1String("go-up.png"));
- if (icon.isNull())
- icon = d->createIcon(QLatin1String("up.png"));
+ icon = QIcon::fromTheme(QLatin1String("go-up"));
break;
- }
case SP_ArrowDown:
- {
- icon = d->createIcon(QLatin1String("go-down.png"));
- if (icon.isNull())
- icon = d->createIcon(QLatin1String("down.png"));
+ icon = QIcon::fromTheme(QLatin1String("go-down"));
break;
- }
case SP_ArrowRight:
- {
- icon = d->createIcon(QLatin1String("go-next.png"));
- if (icon.isNull())
- icon = d->createIcon(QLatin1String("forward.png"));
+ icon = QIcon::fromTheme(QLatin1String("go-next"));
break;
- }
case SP_ArrowLeft:
- {
- icon = d->createIcon(QLatin1String("go-previous.png"));
- if (icon.isNull())
- icon = d->createIcon(QLatin1String("back.png"));
+ icon = QIcon::fromTheme(QLatin1String("go-previous"));
+ break;
+ case SP_DialogCancelButton:
+ icon = QIcon::fromTheme(QLatin1String("dialog-cancel"),
+ QIcon::fromTheme(QLatin1String("process-stop")));
+ break;
+ case SP_DialogCloseButton:
+ icon = QIcon::fromTheme(QLatin1String("window-close"));
break;
- }
case SP_FileDialogDetailedView:
- {
- icon = d->createIcon(QLatin1String("view-list-details.png"));
- if (icon.isNull())
- icon = d->createIcon(QLatin1String("view_detailed.png"));
+ icon = QIcon::fromTheme(QLatin1String("view-list-details"));
break;
- }
case SP_FileDialogListView:
- {
- icon = d->createIcon(QLatin1String("view-list-icons.png"));
- if (icon.isNull())
- icon = d->createIcon(QLatin1String("view_icon.png"));
+ icon = QIcon::fromTheme(QLatin1String("view-list-icons"));
break;
- }
case SP_BrowserReload:
- {
- icon = d->createIcon(QLatin1String("view-refresh.png"));
- if (icon.isNull())
- icon = d->createIcon(QLatin1String("reload.png"));
+ icon = QIcon::fromTheme(QLatin1String("view-refresh"));
break;
- }
case SP_BrowserStop:
- {
- icon = d->createIcon(QLatin1String("process-stop.png"));
- if (icon.isNull())
- icon = d->createIcon(QLatin1String("stop.png"));
+ icon = QIcon::fromTheme(QLatin1String("process-stop"));
break;
- }
case SP_MediaPlay:
- {
- icon = d->createIcon(QLatin1String("media-playback-start.png"));
- if (icon.isNull())
- icon = d->createIcon(QLatin1String("player_play.png"));
+ icon = QIcon::fromTheme(QLatin1String("media-playback-start"));
break;
- }
case SP_MediaPause:
- {
- icon = d->createIcon(QLatin1String("media-playback-pause.png"));
- if (icon.isNull())
- icon = d->createIcon(QLatin1String("player_pause.png"));
+ icon = QIcon::fromTheme(QLatin1String("media-playback-pause"));
break;
- }
case SP_MediaStop:
- {
- icon = d->createIcon(QLatin1String("media-playback-stop.png"));
- if (icon.isNull())
- icon = d->createIcon(QLatin1String("player_stop.png"));
+ icon = QIcon::fromTheme(QLatin1String("media-playback-stop"));
break;
- }
case SP_MediaSeekForward:
- {
- icon = d->createIcon(QLatin1String("media-skip-forward.png"));
- if (icon.isNull())
- icon = d->createIcon(QLatin1String("player_fwd.png"));
+ icon = QIcon::fromTheme(QLatin1String("media-seek-forward"));
break;
- }
case SP_MediaSeekBackward:
- {
- icon = d->createIcon(QLatin1String("media-skip-backward.png"));
- if (icon.isNull())
- icon = d->createIcon(QLatin1String("player_rew.png"));
+ icon = QIcon::fromTheme(QLatin1String("media-seek-backward"));
break;
- }
case SP_MediaSkipForward:
- {
- icon = d->createIcon(QLatin1String("media-skip-forward.png"));
- if (icon.isNull())
- icon = d->createIcon(QLatin1String("player_end.png"));
+ icon = QIcon::fromTheme(QLatin1String("media-skip-forward"));
break;
- }
case SP_MediaSkipBackward:
- {
- icon = d->createIcon(QLatin1String("media-skip-backward.png"));
- if (icon.isNull())
- icon = d->createIcon(QLatin1String("player_start.png"));
+ icon = QIcon::fromTheme(QLatin1String("media-skip-backward"));
break;
- }
-
- case SP_FileLinkIcon: {
- icon = QIcon(standardPixmap(standardIcon, option, widget));
- QPixmap pixmap = d->findIcon(32, QLatin1String("link_overlay.png"));
- if (!pixmap.isNull()) {
- QPixmap fileIcon = d->findIcon(32, QLatin1String("text-x-generic.png"));
- if (fileIcon.isNull())
- fileIcon = d->findIcon(32, QLatin1String("empty.png"));
- if (!fileIcon.isNull()) {
- QPainter painter(&fileIcon);
- painter.drawPixmap(0, 0, 32, 32, pixmap);
- icon.addPixmap(fileIcon);
+ case SP_MediaVolume:
+ icon = QIcon::fromTheme(QLatin1String("audio-volume-medium"));
+ break;
+ case SP_MediaVolumeMuted:
+ icon = QIcon::fromTheme(QLatin1String("audio-volume-muted"));
+ break;
+ case SP_ArrowForward:
+ if (rtl)
+ return standardIconImplementation(SP_ArrowLeft, option, widget);
+ return standardIconImplementation(SP_ArrowRight, option, widget);
+ case SP_ArrowBack:
+ if (rtl)
+ return standardIconImplementation(SP_ArrowRight, option, widget);
+ return standardIconImplementation(SP_ArrowLeft, option, widget);
+ case SP_FileLinkIcon:
+ {
+ QIcon linkIcon = QIcon::fromTheme(QLatin1String("emblem-symbolic-link"));
+ if (!linkIcon.isNull()) {
+ QIcon baseIcon = standardIconImplementation(SP_FileIcon, option, widget);
+ const QList<QSize> sizes = baseIcon.availableSizes(QIcon::Normal, QIcon::Off);
+ for (int i = 0 ; i < sizes.size() ; ++i) {
+ int size = sizes[i].width();
+ QPixmap basePixmap = baseIcon.pixmap(size);
+ QPixmap linkPixmap = linkIcon.pixmap(size/2);
+ QPainter painter(&basePixmap);
+ painter.drawPixmap(size/2, size/2, linkPixmap);
+ icon.addPixmap(basePixmap);
+ }
}
}
- }
- break;
- case SP_DirLinkIcon: {
- icon = QIcon(standardPixmap(standardIcon, option, widget));
- QPixmap pixmap = d->findIcon(32, QLatin1String("link_overlay.png"));
- if (!pixmap.isNull()) {
- QPixmap fileIcon = d->findIcon(32, QLatin1String("folder.png"));
- if (!fileIcon.isNull()) {
- QPainter painter(&fileIcon);
- painter.drawPixmap(0, 0, 32, 32, pixmap);
- icon.addPixmap(fileIcon);
+ break;
+ case SP_DirLinkIcon:
+ {
+ QIcon linkIcon = QIcon::fromTheme(QLatin1String("emblem-symbolic-link"));
+ if (!linkIcon.isNull()) {
+ QIcon baseIcon = standardIconImplementation(SP_DirIcon, option, widget);
+ const QList<QSize> sizes = baseIcon.availableSizes(QIcon::Normal, QIcon::Off);
+ for (int i = 0 ; i < sizes.size() ; ++i) {
+ int size = sizes[i].width();
+ QPixmap basePixmap = baseIcon.pixmap(size);
+ QPixmap linkPixmap = linkIcon.pixmap(size/2);
+ QPainter painter(&basePixmap);
+ painter.drawPixmap(size/2, size/2, linkPixmap);
+ icon.addPixmap(basePixmap);
+ }
}
- }
}
break;
default:
break;
}
+
if (!icon.isNull())
return icon;
+#if defined(Q_WS_MAC)
+ OSType iconType = 0;
+ switch (standardIcon) {
+ case QStyle::SP_MessageBoxQuestion:
+ case QStyle::SP_MessageBoxInformation:
+ case QStyle::SP_MessageBoxWarning:
+ case QStyle::SP_MessageBoxCritical:
+ iconType = kGenericApplicationIcon;
+ break;
+ case SP_DesktopIcon:
+ iconType = kDesktopIcon;
+ break;
+ case SP_TrashIcon:
+ iconType = kTrashIcon;
+ break;
+ case SP_ComputerIcon:
+ iconType = kComputerIcon;
+ break;
+ case SP_DriveFDIcon:
+ iconType = kGenericFloppyIcon;
+ break;
+ case SP_DriveHDIcon:
+ iconType = kGenericHardDiskIcon;
+ break;
+ case SP_DriveCDIcon:
+ case SP_DriveDVDIcon:
+ iconType = kGenericCDROMIcon;
+ break;
+ case SP_DriveNetIcon:
+ iconType = kGenericNetworkIcon;
+ break;
+ case SP_DirOpenIcon:
+ iconType = kOpenFolderIcon;
+ break;
+ case SP_DirClosedIcon:
+ case SP_DirLinkIcon:
+ iconType = kGenericFolderIcon;
+ break;
+ case SP_FileLinkIcon:
+ case SP_FileIcon:
+ iconType = kGenericDocumentIcon;
+ break;
+ case SP_DirIcon: {
+ // A rather special case
+ QIcon closeIcon = QStyle::standardIcon(SP_DirClosedIcon, option, widget);
+ QIcon openIcon = QStyle::standardIcon(SP_DirOpenIcon, option, widget);
+ closeIcon.addPixmap(openIcon.pixmap(16, 16), QIcon::Normal, QIcon::On);
+ closeIcon.addPixmap(openIcon.pixmap(32, 32), QIcon::Normal, QIcon::On);
+ closeIcon.addPixmap(openIcon.pixmap(64, 64), QIcon::Normal, QIcon::On);
+ closeIcon.addPixmap(openIcon.pixmap(128, 128), QIcon::Normal, QIcon::On);
+ return closeIcon;
+ }
+ case SP_TitleBarNormalButton:
+ case SP_TitleBarCloseButton: {
+ QIcon titleBarIcon;
+ if (standardIcon == SP_TitleBarCloseButton) {
+ titleBarIcon.addFile(QLatin1String(":/trolltech/styles/macstyle/images/closedock-16.png"));
+ titleBarIcon.addFile(QLatin1String(":/trolltech/styles/macstyle/images/closedock-down-16.png"), QSize(16, 16), QIcon::Normal, QIcon::On);
+ } else {
+ titleBarIcon.addFile(QLatin1String(":/trolltech/styles/macstyle/images/dockdock-16.png"));
+ titleBarIcon.addFile(QLatin1String(":/trolltech/styles/macstyle/images/dockdock-down-16.png"), QSize(16, 16), QIcon::Normal, QIcon::On);
+ }
+ return titleBarIcon;
+ }
+ default:
+ break;
+ }
+ if (iconType != 0) {
+ QIcon retIcon;
+ IconRef icon;
+ IconRef overlayIcon = 0;
+ if (iconType != kGenericApplicationIcon) {
+ GetIconRef(kOnSystemDisk, kSystemIconsCreator, iconType, &icon);
+ } else {
+ FSRef fsRef;
+ ProcessSerialNumber psn = { 0, kCurrentProcess };
+ GetProcessBundleLocation(&psn, &fsRef);
+ GetIconRefFromFileInfo(&fsRef, 0, 0, 0, 0, kIconServicesNormalUsageFlag, &icon, 0);
+ if (standardIcon == SP_MessageBoxCritical) {
+ overlayIcon = icon;
+ GetIconRef(kOnSystemDisk, kSystemIconsCreator, kAlertCautionIcon, &icon);
+ }
+ }
+ if (icon) {
+ qt_mac_constructQIconFromIconRef(icon, overlayIcon, &retIcon, standardIcon);
+ ReleaseIconRef(icon);
+ }
+ if (overlayIcon)
+ ReleaseIconRef(overlayIcon);
+ return retIcon;
+ }
+#endif // Q_WS_MAC
}
-#endif//Q_WS_X11
switch (standardIcon) {
#ifndef QT_NO_IMAGEFORMAT_PNG
@@ -6119,11 +5887,11 @@ QIcon QCommonStyle::standardIconImplementation(StandardPixmap standardIcon, cons
icon.addFile(QLatin1String(":/trolltech/styles/commonstyle/images/standardbutton-no-128.png"));
break;
case SP_ArrowForward:
- if (QApplication::layoutDirection() == Qt::RightToLeft)
+ if (rtl)
return standardIconImplementation(SP_ArrowLeft, option, widget);
return standardIconImplementation(SP_ArrowRight, option, widget);
case SP_ArrowBack:
- if (QApplication::layoutDirection() == Qt::RightToLeft)
+ if (rtl)
return standardIconImplementation(SP_ArrowRight, option, widget);
return standardIconImplementation(SP_ArrowLeft, option, widget);
case SP_ArrowLeft:
@@ -6230,7 +5998,7 @@ QIcon QCommonStyle::standardIconImplementation(StandardPixmap standardIcon, cons
break;
#endif // QT_NO_IMAGEFORMAT_PNG
default:
- icon.addPixmap(standardPixmap(standardIcon, option, widget));
+ icon.addPixmap(proxy()->standardPixmap(standardIcon, option, widget));
break;
}
return icon;
diff --git a/src/gui/styles/qcommonstyle.h b/src/gui/styles/qcommonstyle.h
index af848ec..1c34dd1 100644
--- a/src/gui/styles/qcommonstyle.h
+++ b/src/gui/styles/qcommonstyle.h
@@ -1,7 +1,6 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the QtGui module of the Qt Toolkit.
@@ -21,9 +20,10 @@
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.1, included in the file LGPL_EXCEPTION.txt in this
+** package.
**
** If you have questions regarding the use of this file, please contact
** Nokia at qt-info@nokia.com.
diff --git a/src/gui/styles/qcommonstyle_p.h b/src/gui/styles/qcommonstyle_p.h
index 8913a4e..ffc1324 100644
--- a/src/gui/styles/qcommonstyle_p.h
+++ b/src/gui/styles/qcommonstyle_p.h
@@ -1,7 +1,6 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the QtGui module of the Qt Toolkit.
@@ -21,9 +20,10 @@
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.1, included in the file LGPL_EXCEPTION.txt in this
+** package.
**
** If you have questions regarding the use of this file, please contact
** Nokia at qt-info@nokia.com.
@@ -122,19 +122,10 @@ public:
}
#endif
mutable QIcon tabBarcloseButtonIcon;
-
-//icon detection on X11
-#ifdef Q_WS_X11
- void lookupIconTheme() const;
- QIcon createIcon(const QString &) const;
- QPixmap findIcon(int size, const QString &) const;
- QPixmap findIconHelper(int size, const QString &, const QString &, QStringList &visited) const;
- QIconTheme parseIndexFile(const QString &themeName) const;
- mutable QString themeName;
- mutable QStringList iconDirs;
- mutable QHash <QString, QIconTheme> themeList;
+ int lookupToolButtonStyle() const;
+#ifndef QT_NO_TABBAR
+ void tabLayout(const QStyleOptionTabV3 *opt, const QWidget *widget, QRect *textRect, QRect *pixmapRect) const;
#endif
-
};
QT_END_NAMESPACE
diff --git a/src/gui/styles/qcommonstylepixmaps_p.h b/src/gui/styles/qcommonstylepixmaps_p.h
index b6c7f89..187f4f5 100644
--- a/src/gui/styles/qcommonstylepixmaps_p.h
+++ b/src/gui/styles/qcommonstylepixmaps_p.h
@@ -1,7 +1,6 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the QtGui module of the Qt Toolkit.
@@ -21,9 +20,10 @@
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.1, included in the file LGPL_EXCEPTION.txt in this
+** package.
**
** If you have questions regarding the use of this file, please contact
** Nokia at qt-info@nokia.com.
diff --git a/src/gui/styles/qgtkpainter.cpp b/src/gui/styles/qgtkpainter.cpp
index 05c5804..ee4fb58 100644
--- a/src/gui/styles/qgtkpainter.cpp
+++ b/src/gui/styles/qgtkpainter.cpp
@@ -1,7 +1,6 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the QtGui module of the Qt Toolkit.
@@ -21,9 +20,10 @@
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.1, included in the file LGPL_EXCEPTION.txt in this
+** package.
**
** If you have questions regarding the use of this file, please contact
** Nokia at qt-info@nokia.com.
diff --git a/src/gui/styles/qgtkpainter_p.h b/src/gui/styles/qgtkpainter_p.h
index 0e8ffe2..1c6d1d9 100644
--- a/src/gui/styles/qgtkpainter_p.h
+++ b/src/gui/styles/qgtkpainter_p.h
@@ -1,7 +1,6 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the QtGui module of the Qt Toolkit.
@@ -21,9 +20,10 @@
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.1, included in the file LGPL_EXCEPTION.txt in this
+** package.
**
** If you have questions regarding the use of this file, please contact
** Nokia at qt-info@nokia.com.
diff --git a/src/gui/styles/qgtkstyle.cpp b/src/gui/styles/qgtkstyle.cpp
index ec58063..0ccf219 100644
--- a/src/gui/styles/qgtkstyle.cpp
+++ b/src/gui/styles/qgtkstyle.cpp
@@ -1,7 +1,6 @@
-/******* *********************************************************************
+/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the QtGui module of the Qt Toolkit.
@@ -21,9 +20,10 @@
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.1, included in the file LGPL_EXCEPTION.txt in this
+** package.
**
** If you have questions regarding the use of this file, please contact
** Nokia at qt-info@nokia.com.
@@ -70,6 +70,7 @@
#include <qpixmapcache.h>
#undef signals // Collides with GTK stymbols
#include "qgtkpainter_p.h"
+#include "qstylehelper_p.h"
#include <private/qcleanlooksstyle_p.h>
@@ -150,7 +151,6 @@ bool QGtkStyleFilter::eventFilter(QObject *obj, QEvent *e)
if (e->type() == QEvent::ApplicationPaletteChange) {
// Only do this the first time since this will also
// generate applicationPaletteChange events
- extern QHash<QByteArray, QPalette> *qt_app_palettes_hash(); //qapplication.cpp
if (!qt_app_palettes_hash() || qt_app_palettes_hash()->isEmpty()) {
QGtk::applyCustomPaletteHash();
}
@@ -176,7 +176,6 @@ public:
static const int groupBoxBottomMargin = 2; // space below the groupbox
static const int groupBoxTitleMargin = 6; // space between contents and title
static const int groupBoxTopMargin = 2;
-static bool UsePixmapCache = true;
// Get size of the arrow controls in a GtkSpinButton
static int spinboxArrowSize()
@@ -210,17 +209,6 @@ static GdkColor fromQColor(const QColor &color)
return retval;
}
-// Note this is different from uniqueName as used in QGtkPainter
-static QString uniqueName(const QString &key, const QStyleOption *option, const QSize &size)
-{
- QString tmp;
- const QStyleOptionComplex *complexOption = qstyleoption_cast<const QStyleOptionComplex *>(option);
- tmp.sprintf("%s-%d-%d-%d-%lld-%dx%d", key.toLatin1().constData(), uint(option->state),
- option->direction, complexOption ? uint(complexOption->activeSubControls) : uint(0),
- option->palette.cacheKey(), size.width(), size.height());
- return tmp;
-}
-
/*!
\class QGtkStyle
\brief The QGtkStyle class provides a widget style rendered by GTK+
@@ -611,6 +599,26 @@ int QGtkStyle::styleHint(StyleHint hint, const QStyleOption *option, const QWidg
break;
+ case SH_ToolButtonStyle:
+ {
+ if (QGtk::isKDE4Session())
+ return QCleanlooksStyle::styleHint(hint, option, widget, returnData);
+ GtkWidget *gtkToolbar = QGtk::gtkWidget(QLS("GtkToolbar"));
+ GtkToolbarStyle toolbar_style = GTK_TOOLBAR_ICONS;
+ g_object_get(gtkToolbar, "toolbar-style", &toolbar_style, NULL);
+ switch (toolbar_style) {
+ case GTK_TOOLBAR_TEXT:
+ return Qt::ToolButtonTextOnly;
+ case GTK_TOOLBAR_BOTH:
+ return Qt::ToolButtonTextUnderIcon;
+ case GTK_TOOLBAR_BOTH_HORIZ:
+ return Qt::ToolButtonTextBesideIcon;
+ case GTK_TOOLBAR_ICONS:
+ default:
+ return Qt::ToolButtonIconOnly;
+ }
+ }
+ break;
case SH_SpinControls_DisableOnBounds:
return int(true);
@@ -648,6 +656,11 @@ int QGtkStyle::styleHint(StyleHint hint, const QStyleOption *option, const QWidg
return !scrollbars_within_bevel;
}
+ case SH_DialogButtonBox_ButtonsHaveIcons: {
+ static bool buttonsHaveIcons = QGtk::getGConfBool(QLS("/desktop/gnome/interface/buttons_have_icons"));
+ return buttonsHaveIcons;
+ }
+
default:
return QCleanlooksStyle::styleHint(hint, option, widget, returnData);
}
@@ -675,14 +688,14 @@ void QGtkStyle::drawPrimitive(PrimitiveElement element,
if (widget && widget->inherits("QComboBoxPrivateContainer")){
QStyleOption copy = *option;
copy.state |= State_Raised;
- drawPrimitive(PE_PanelMenu, &copy, painter, widget);
+ proxy()->drawPrimitive(PE_PanelMenu, &copy, painter, widget);
break;
}
// Drawing the entire itemview frame is very expensive, especially on the native X11 engine
// Instead we cheat a bit and draw a border image without the center part, hence only scaling
// thin rectangular images
const int pmSize = 64;
- const int border = pixelMetric(PM_DefaultFrameWidth, option, widget);
+ const int border = proxy()->pixelMetric(PM_DefaultFrameWidth, option, widget);
const QString pmKey = QString(QLS("windowframe %0")).arg(option->state);
QPixmap pixmap;
@@ -889,8 +902,8 @@ void QGtkStyle::drawPrimitive(PrimitiveElement element,
int border = (size > 9) ? (size/4) : 0; //Allow small arrows to have exact dimensions
int bsx = 0, bsy = 0;
if (option->state & State_Sunken) {
- bsx = pixelMetric(PM_ButtonShiftHorizontal);
- bsy = pixelMetric(PM_ButtonShiftVertical);
+ bsx = proxy()->pixelMetric(PM_ButtonShiftHorizontal);
+ bsy = proxy()->pixelMetric(PM_ButtonShiftVertical);
}
QRect arrowRect = option->rect.adjusted(border + bsx, border + bsy, -border + bsx, -border + bsy);
GtkShadowType shadow = option->state & State_Sunken ? GTK_SHADOW_IN : GTK_SHADOW_OUT;
@@ -970,7 +983,7 @@ void QGtkStyle::drawPrimitive(PrimitiveElement element,
if (const QStyleOptionFrame *panel = qstyleoption_cast<const QStyleOptionFrame *>(option)) {
GtkWidget *gtkEntry = QGtk::gtkWidget(QLS("GtkEntry"));
if (panel->lineWidth > 0)
- drawPrimitive(PE_FrameLineEdit, option, painter, widget);
+ proxy()->drawPrimitive(PE_FrameLineEdit, option, painter, widget);
uint resolve_mask = option->palette.resolve();
QRect textRect = option->rect.adjusted(gtkEntry->style->xthickness, gtkEntry->style->ythickness,
-gtkEntry->style->xthickness, -gtkEntry->style->ythickness);
@@ -1241,8 +1254,8 @@ void QGtkStyle::drawComplexControl(ComplexControl control, const QStyleOptionCom
painter->save();
if (const QStyleOptionGroupBox *groupBox = qstyleoption_cast<const QStyleOptionGroupBox *>(option)) {
- QRect textRect = subControlRect(CC_GroupBox, groupBox, SC_GroupBoxLabel, widget);
- QRect checkBoxRect = subControlRect(CC_GroupBox, groupBox, SC_GroupBoxCheckBox, widget);
+ QRect textRect = proxy()->subControlRect(CC_GroupBox, groupBox, SC_GroupBoxLabel, widget);
+ QRect checkBoxRect = proxy()->subControlRect(CC_GroupBox, groupBox, SC_GroupBoxCheckBox, widget);
// Draw title
if ((groupBox->subControls & QStyle::SC_GroupBoxLabel) && !groupBox->text.isEmpty()) {
@@ -1257,7 +1270,7 @@ void QGtkStyle::drawComplexControl(ComplexControl control, const QStyleOptionCom
if (!groupBox->text.isEmpty()) {
int alignment = int(groupBox->textAlignment);
- if (!styleHint(QStyle::SH_UnderlineShortcut, option, widget))
+ if (!proxy()->styleHint(QStyle::SH_UnderlineShortcut, option, widget))
alignment |= Qt::TextHideMnemonic;
QColor textColor = groupBox->textColor; // Note: custom textColor is currently ignored
int labelState = GTK_STATE_INSENSITIVE;
@@ -1282,7 +1295,7 @@ void QGtkStyle::drawComplexControl(ComplexControl control, const QStyleOptionCom
QStyleOptionButton box;
box.QStyleOption::operator=(*groupBox);
box.rect = checkBoxRect;
- drawPrimitive(PE_IndicatorCheckBox, &box, painter, widget);
+ proxy()->drawPrimitive(PE_IndicatorCheckBox, &box, painter, widget);
}
}
@@ -1305,7 +1318,7 @@ void QGtkStyle::drawComplexControl(ComplexControl control, const QStyleOptionCom
bool focus = isEnabled && (comboBox->state & State_HasFocus);
QColor buttonShadow = option->palette.dark().color();
GtkStateType state = gtkPainter.gtkState(option);
- int appears_as_list = !styleHint(QStyle::SH_ComboBox_Popup, comboBox, widget);
+ int appears_as_list = !proxy()->styleHint(QStyle::SH_ComboBox_Popup, comboBox, widget);
QPixmap cache;
QString pixmapName;
QStyleOptionComboBox comboBoxCopy = *comboBox;
@@ -1313,9 +1326,9 @@ void QGtkStyle::drawComplexControl(ComplexControl control, const QStyleOptionCom
bool reverse = (option->direction == Qt::RightToLeft);
QRect rect = option->rect;
- QRect arrowButtonRect = subControlRect(CC_ComboBox, &comboBoxCopy,
+ QRect arrowButtonRect = proxy()->subControlRect(CC_ComboBox, &comboBoxCopy,
SC_ComboBoxArrow, widget);
- QRect editRect = subControlRect(CC_ComboBox, &comboBoxCopy,
+ QRect editRect = proxy()->subControlRect(CC_ComboBox, &comboBoxCopy,
SC_ComboBoxEditField, widget);
GtkShadowType shadow = (option->state & State_Sunken || option->state & State_On ) ?
@@ -1423,7 +1436,7 @@ void QGtkStyle::drawComplexControl(ComplexControl control, const QStyleOptionCom
QGtk::gtk_widget_style_get(gtkToggleButton, "interior-focus", &interiorFocus, NULL);
int xt = interiorFocus ? gtkToggleButton->style->xthickness : 0;
int yt = interiorFocus ? gtkToggleButton->style->ythickness : 0;
- if ((focus && (option->state & State_KeyboardFocusChange)))
+ if (focus && ((option->state & State_KeyboardFocusChange) || styleHint(SH_UnderlineShortcut, option, widget)))
gtkCachedPainter.paintFocus(gtkToggleButton, "button",
option->rect.adjusted(xt, yt, -xt, -yt),
option->state & State_Sunken ? GTK_STATE_ACTIVE : GTK_STATE_NORMAL,
@@ -1494,8 +1507,8 @@ void QGtkStyle::drawComplexControl(ComplexControl control, const QStyleOptionCom
if (const QStyleOptionToolButton *toolbutton
= qstyleoption_cast<const QStyleOptionToolButton *>(option)) {
QRect button, menuarea;
- button = subControlRect(control, toolbutton, SC_ToolButton, widget);
- menuarea = subControlRect(control, toolbutton, SC_ToolButtonMenu, widget);
+ button = proxy()->subControlRect(control, toolbutton, SC_ToolButton, widget);
+ menuarea = proxy()->subControlRect(control, toolbutton, SC_ToolButtonMenu, widget);
State bflags = toolbutton->state & ~(State_Sunken | State_MouseOver);
if (bflags & State_AutoRaise)
@@ -1524,7 +1537,7 @@ void QGtkStyle::drawComplexControl(ComplexControl control, const QStyleOptionCom
if (bflags & (State_Sunken | State_On | State_Raised | State_MouseOver)) {
tool.rect = button;
tool.state = bflags;
- drawPrimitive(PE_PanelButtonTool, &tool, painter, widget);
+ proxy()->drawPrimitive(PE_PanelButtonTool, &tool, painter, widget);
}
}
@@ -1535,9 +1548,9 @@ void QGtkStyle::drawComplexControl(ComplexControl control, const QStyleOptionCom
if (toolbutton->state & State_HasFocus) {
QStyleOptionFocusRect fr;
fr.QStyleOption::operator=(*toolbutton);
- fr.rect = subControlRect(CC_ToolButton, toolbutton, SC_ToolButton, widget);
+ fr.rect = proxy()->subControlRect(CC_ToolButton, toolbutton, SC_ToolButton, widget);
fr.rect.adjust(1, 1, -1, -1);
- drawPrimitive(PE_FrameFocusRect, &fr, painter, widget);
+ proxy()->drawPrimitive(PE_FrameFocusRect, &fr, painter, widget);
}
QStyleOptionToolButton label = *toolbutton;
@@ -1553,21 +1566,21 @@ void QGtkStyle::drawComplexControl(ComplexControl control, const QStyleOptionCom
}
label.rect = button.adjusted(style->xthickness, style->ythickness,
-style->xthickness - popupArrowSize, -style->ythickness);
- drawControl(CE_ToolButtonLabel, &label, painter, widget);
+ proxy()->drawControl(CE_ToolButtonLabel, &label, painter, widget);
if (toolbutton->subControls & SC_ToolButtonMenu) {
tool.rect = menuarea;
tool.state = mflags;
if ((mflags & State_Enabled && (mflags & (State_Sunken | State_Raised | State_MouseOver))) || !(mflags & State_AutoRaise))
- drawPrimitive(PE_IndicatorButtonDropDown, &tool, painter, widget);
+ proxy()->drawPrimitive(PE_IndicatorButtonDropDown, &tool, painter, widget);
- drawPrimitive(PE_IndicatorArrowDown, &tool, painter, widget);
+ proxy()->drawPrimitive(PE_IndicatorArrowDown, &tool, painter, widget);
} else if (drawMenuArrow) {
QRect ir = toolbutton->rect;
QStyleOptionToolButton newBtn = *toolbutton;
newBtn.rect = QRect(ir.right() - popupArrowSize - style->xthickness - 3, ir.height()/2 - 1, popupArrowSize, popupArrowSize);
- drawPrimitive(PE_IndicatorArrowDown, &newBtn, painter, widget);
+ proxy()->drawPrimitive(PE_IndicatorArrowDown, &newBtn, painter, widget);
}
}
break;
@@ -1584,10 +1597,10 @@ void QGtkStyle::drawComplexControl(ComplexControl control, const QStyleOptionCom
painter->fillRect(option->rect, option->palette.background());
QRect rect = scrollBar->rect;
- QRect scrollBarSubLine = subControlRect(control, scrollBar, SC_ScrollBarSubLine, widget);
- QRect scrollBarAddLine = subControlRect(control, scrollBar, SC_ScrollBarAddLine, widget);
- QRect scrollBarSlider = subControlRect(control, scrollBar, SC_ScrollBarSlider, widget);
- QRect grooveRect = subControlRect(control, scrollBar, SC_ScrollBarGroove, widget);
+ QRect scrollBarSubLine = proxy()->subControlRect(control, scrollBar, SC_ScrollBarSubLine, widget);
+ QRect scrollBarAddLine = proxy()->subControlRect(control, scrollBar, SC_ScrollBarAddLine, widget);
+ QRect scrollBarSlider = proxy()->subControlRect(control, scrollBar, SC_ScrollBarSlider, widget);
+ QRect grooveRect = proxy()->subControlRect(control, scrollBar, SC_ScrollBarGroove, widget);
bool horizontal = scrollBar->orientation == Qt::Horizontal;
GtkWidget * scrollbarWidget = horizontal ? gtkHScrollBar : gtkVScrollBar;
style = scrollbarWidget->style;
@@ -1731,7 +1744,7 @@ void QGtkStyle::drawComplexControl(ComplexControl control, const QStyleOptionCom
bool reverse = (spinBox->direction == Qt::RightToLeft);
//### Move this to subControlRect
- QRect upRect = subControlRect(CC_SpinBox, option, SC_SpinBoxUp, widget);
+ QRect upRect = proxy()->subControlRect(CC_SpinBox, option, SC_SpinBoxUp, widget);
upRect.setTop(option->rect.top());
if (reverse)
@@ -1739,8 +1752,8 @@ void QGtkStyle::drawComplexControl(ComplexControl control, const QStyleOptionCom
else
upRect.setRight(option->rect.right());
- QRect editRect = subControlRect(CC_SpinBox, option, SC_SpinBoxEditField, widget);
- QRect downRect = subControlRect(CC_SpinBox, option, SC_SpinBoxDown, widget);
+ QRect editRect = proxy()->subControlRect(CC_SpinBox, option, SC_SpinBoxEditField, widget);
+ QRect downRect = proxy()->subControlRect(CC_SpinBox, option, SC_SpinBoxDown, widget);
downRect.setBottom(option->rect.bottom());
if (reverse)
@@ -1772,8 +1785,9 @@ void QGtkStyle::drawComplexControl(ComplexControl control, const QStyleOptionCom
QString key;
+
if (option->state & State_HasFocus) {
- key = QLS("f");
+ key += QLatin1Char('f');
GTK_WIDGET_SET_FLAGS(gtkSpinButton, GTK_HAS_FOCUS);
}
@@ -1871,9 +1885,9 @@ void QGtkStyle::drawComplexControl(ComplexControl control, const QStyleOptionCom
GtkWidget *hScaleWidget = QGtk::gtkWidget(QLS("GtkHScale"));
GtkWidget *vScaleWidget = QGtk::gtkWidget(QLS("GtkVScale"));
- QRect groove = subControlRect(CC_Slider, option, SC_SliderGroove, widget);
- QRect handle = subControlRect(CC_Slider, option, SC_SliderHandle, widget);
- QRect ticks = subControlRect(CC_Slider, option, SC_SliderTickmarks, widget);
+ QRect groove = proxy()->subControlRect(CC_Slider, option, SC_SliderGroove, widget);
+ QRect handle = proxy()->subControlRect(CC_Slider, option, SC_SliderHandle, widget);
+ QRect ticks = proxy()->subControlRect(CC_Slider, option, SC_SliderTickmarks, widget);
bool horizontal = slider->orientation == Qt::Horizontal;
bool ticksAbove = slider->tickPosition & QSlider::TicksAbove;
@@ -1928,8 +1942,8 @@ void QGtkStyle::drawComplexControl(ComplexControl control, const QStyleOptionCom
if (option->subControls & SC_SliderTickmarks) {
painter->setPen(darkOutline);
- int tickSize = pixelMetric(PM_SliderTickmarkOffset, option, widget);
- int available = pixelMetric(PM_SliderSpaceAvailable, slider, widget);
+ int tickSize = proxy()->pixelMetric(PM_SliderTickmarkOffset, option, widget);
+ int available = proxy()->pixelMetric(PM_SliderSpaceAvailable, slider, widget);
int interval = slider->tickInterval;
if (interval <= 0) {
@@ -1946,7 +1960,7 @@ void QGtkStyle::drawComplexControl(ComplexControl control, const QStyleOptionCom
interval = 1;
int v = slider->minimum;
- int len = pixelMetric(PM_SliderLength, slider, widget);
+ int len = proxy()->pixelMetric(PM_SliderLength, slider, widget);
while (v <= slider->maximum + 1) {
if (v == slider->maximum + 1 && interval == 1)
break;
@@ -2007,7 +2021,7 @@ void QGtkStyle::drawComplexControl(ComplexControl control, const QStyleOptionCom
fropt.rect.setLeft(handle.left() - 3);
fropt.rect.setRight(handle.right() + 3);
}
- drawPrimitive(PE_FrameFocusRect, &fropt, painter, widget);
+ proxy()->drawPrimitive(PE_FrameFocusRect, &fropt, painter, widget);
}
gtkPainter.paintSlider( scaleWidget, horizontal ? "hscale" : "vscale", handle, state, shadow, style,
@@ -2066,8 +2080,8 @@ void QGtkStyle::drawControl(ControlElement element,
}
if (vertical)
rect = QRect(rect.left(), rect.top(), rect.height(), rect.width()); // flip width and height
- const int progressIndicatorPos = static_cast<int>((bar->progress - qint64(bar->minimum)) /
- qMax(double(1.0), double(qint64(bar->maximum) - qint64(bar->minimum))) * rect.width());
+ const int progressIndicatorPos = (bar->progress - qreal(bar->minimum)) * rect.width() /
+ qMax(qreal(1.0), qreal(bar->maximum) - bar->minimum);
if (progressIndicatorPos >= 0 && progressIndicatorPos <= rect.width())
leftRect = QRect(rect.left(), rect.top(), progressIndicatorPos, rect.height());
if (vertical)
@@ -2097,9 +2111,9 @@ void QGtkStyle::drawControl(ControlElement element,
if (option->state & State_Sunken)
buttonShift = QPoint(pixelMetric(PM_ButtonShiftHorizontal, option, widget),
- pixelMetric(PM_ButtonShiftVertical, option, widget));
+ proxy()->pixelMetric(PM_ButtonShiftVertical, option, widget));
- if (styleHint(SH_UnderlineShortcut, button, widget))
+ if (proxy()->styleHint(SH_UnderlineShortcut, button, widget))
tf |= Qt::TextShowMnemonic;
else
tf |= Qt::TextHideMnemonic;
@@ -2160,7 +2174,7 @@ void QGtkStyle::drawControl(ControlElement element,
GdkColor gdkText = gtkButton->style->fg[labelState];
QColor textColor = QColor(gdkText.red>>8, gdkText.green>>8, gdkText.blue>>8);
pal.setBrush(QPalette::ButtonText, textColor);
- drawItemText(painter, ir, tf, pal, (button->state & State_Enabled),
+ proxy()->drawItemText(painter, ir, tf, pal, (button->state & State_Enabled),
button->text, QPalette::ButtonText);
}
break;
@@ -2181,7 +2195,7 @@ void QGtkStyle::drawControl(ControlElement element,
QStyleOptionButton subopt = *btn;
subopt.rect = subElementRect(isRadio ? SE_RadioButtonIndicator
: SE_CheckBoxIndicator, btn, widget);
- drawPrimitive(isRadio ? PE_IndicatorRadioButton : PE_IndicatorCheckBox,
+ proxy()->drawPrimitive(isRadio ? PE_IndicatorRadioButton : PE_IndicatorCheckBox,
&subopt, painter, widget);
subopt.rect = subElementRect(isRadio ? SE_RadioButtonContents
: SE_CheckBoxContents, btn, widget);
@@ -2195,14 +2209,14 @@ void QGtkStyle::drawControl(ControlElement element,
QColor textColor = QColor(gdkText.red>>8, gdkText.green>>8, gdkText.blue>>8);
pal.setBrush(QPalette::WindowText, textColor);
subopt.palette = pal;
- drawControl(isRadio ? CE_RadioButtonLabel : CE_CheckBoxLabel, &subopt, painter, widget);
+ proxy()->drawControl(isRadio ? CE_RadioButtonLabel : CE_CheckBoxLabel, &subopt, painter, widget);
if (btn->state & State_HasFocus) {
QStyleOptionFocusRect fropt;
fropt.QStyleOption::operator=(*btn);
fropt.rect = subElementRect(isRadio ? SE_RadioButtonFocusRect
: SE_CheckBoxFocusRect, btn, widget);
- drawPrimitive(PE_FrameFocusRect, &fropt, painter, widget);
+ proxy()->drawPrimitive(PE_FrameFocusRect, &fropt, painter, widget);
}
}
break;
@@ -2211,8 +2225,8 @@ void QGtkStyle::drawControl(ControlElement element,
case CE_ComboBoxLabel:
if (const QStyleOptionComboBox *cb = qstyleoption_cast<const QStyleOptionComboBox *>(option)) {
- QRect editRect = subControlRect(CC_ComboBox, cb, SC_ComboBoxEditField, widget);
- bool appearsAsList = !styleHint(QStyle::SH_ComboBox_Popup, cb, widget);
+ QRect editRect = proxy()->subControlRect(CC_ComboBox, cb, SC_ComboBoxEditField, widget);
+ bool appearsAsList = !proxy()->styleHint(QStyle::SH_ComboBox_Popup, cb, widget);
painter->save();
painter->setClipRect(editRect);
@@ -2230,7 +2244,7 @@ void QGtkStyle::drawControl(ControlElement element,
if (cb->editable)
painter->fillRect(iconRect, option->palette.brush(QPalette::Base));
- drawItemPixmap(painter, iconRect, Qt::AlignCenter, pixmap);
+ proxy()->drawItemPixmap(painter, iconRect, Qt::AlignCenter, pixmap);
if (cb->direction == Qt::RightToLeft)
editRect.translate(-4 - cb->iconSize.width(), 0);
@@ -2252,7 +2266,7 @@ void QGtkStyle::drawControl(ControlElement element,
pal.setBrush(QPalette::ButtonText, textColor);
- drawItemText(painter, editRect.adjusted(1, 0, -1, 0),
+ proxy()->drawItemText(painter, editRect.adjusted(1, 0, -1, 0),
visualAlignment(cb->direction, Qt::AlignLeft | Qt::AlignVCenter),
pal, cb->state & State_Enabled, cb->currentText, QPalette::ButtonText);
}
@@ -2298,7 +2312,7 @@ void QGtkStyle::drawControl(ControlElement element,
QString titleText
= painter->fontMetrics().elidedText(dwOpt->title,
Qt::ElideRight, titleRect.width());
- drawItemText(painter,
+ proxy()->drawItemText(painter,
titleRect,
Qt::AlignLeft | Qt::AlignVCenter | Qt::TextShowMnemonic, dwOpt->palette,
dwOpt->state & State_Enabled, titleText,
@@ -2419,10 +2433,10 @@ void QGtkStyle::drawControl(ControlElement element,
QPalette::ColorRole textRole = dis ? QPalette::Text : QPalette::HighlightedText;
uint alignment = Qt::AlignCenter | Qt::TextShowMnemonic | Qt::TextDontClip | Qt::TextSingleLine;
- if (!QCleanlooksStyle::styleHint(SH_UnderlineShortcut, mbi, widget))
+ if (!proxy()->styleHint(SH_UnderlineShortcut, mbi, widget))
alignment |= Qt::TextHideMnemonic;
- drawItemText(painter, item.rect, alignment, item.palette, mbi->state & State_Enabled, mbi->text, textRole);
+ proxy()->drawItemText(painter, item.rect, alignment, item.palette, mbi->state & State_Enabled, mbi->text, textRole);
}
}
painter->restore();
@@ -2594,7 +2608,7 @@ void QGtkStyle::drawControl(ControlElement element,
mode = QIcon::Active;
QPixmap pixmap;
- int smallIconSize = pixelMetric(PM_SmallIconSize, option, widget);
+ int smallIconSize = proxy()->pixelMetric(PM_SmallIconSize, option, widget);
QSize iconSize(smallIconSize, smallIconSize);
#ifndef QT_NO_COMBOBOX
@@ -2622,7 +2636,7 @@ void QGtkStyle::drawControl(ControlElement element,
}
opt.state |= State_Sunken;
opt.rect = vCheckRect;
- drawPrimitive(PE_PanelButtonCommand, &opt, painter, widget);
+ proxy()->drawPrimitive(PE_PanelButtonCommand, &opt, painter, widget);
}
painter->drawPixmap(pmr.topLeft(), pixmap);
}
@@ -2662,7 +2676,7 @@ void QGtkStyle::drawControl(ControlElement element,
int t = s.indexOf(QLatin1Char('\t'));
int text_flags = Qt::AlignVCenter | Qt::TextShowMnemonic | Qt::TextDontClip | Qt::TextSingleLine;
- if (!styleHint(SH_UnderlineShortcut, menuitem, widget))
+ if (!proxy()->styleHint(SH_UnderlineShortcut, menuitem, widget))
text_flags |= Qt::TextHideMnemonic;
// Draw shortcut right aligned
@@ -2695,7 +2709,7 @@ void QGtkStyle::drawControl(ControlElement element,
// Arrow
if (menuItem->menuItemType == QStyleOptionMenuItem::SubMenu) {// draw sub menu arrow
QPoint buttonShift(pixelMetric(PM_ButtonShiftHorizontal, option, widget),
- pixelMetric(PM_ButtonShiftVertical, option, widget));
+ proxy()->pixelMetric(PM_ButtonShiftVertical, option, widget));
QFontMetrics fm(menuitem->font);
int arrow_size = fm.ascent() + fm.descent() - 2 * gtkMenuItem->style->ythickness;
@@ -2723,7 +2737,7 @@ void QGtkStyle::drawControl(ControlElement element,
case CE_PushButton:
if (const QStyleOptionButton *btn = qstyleoption_cast<const QStyleOptionButton *>(option)) {
GtkWidget *gtkButton = QGtk::gtkWidget(QLS("GtkButton"));
- drawControl(CE_PushButtonBevel, btn, painter, widget);
+ proxy()->drawControl(CE_PushButtonBevel, btn, painter, widget);
QStyleOptionButton subopt = *btn;
subopt.rect = subElementRect(SE_PushButtonContents, btn, widget);
gint interiorFocus = true;
@@ -2733,14 +2747,14 @@ void QGtkStyle::drawControl(ControlElement element,
if (btn->features & QStyleOptionButton::Flat && btn->state & State_HasFocus)
// The normal button focus rect does not work well for flat buttons in Clearlooks
- drawPrimitive(PE_FrameFocusRect, option, painter, widget);
+ proxy()->drawPrimitive(PE_FrameFocusRect, option, painter, widget);
else if (btn->state & State_HasFocus)
gtkPainter.paintFocus(gtkButton, "button",
option->rect.adjusted(xt, yt, -xt, -yt),
btn->state & State_Sunken ? GTK_STATE_ACTIVE : GTK_STATE_NORMAL,
gtkButton->style);
- drawControl(CE_PushButtonLabel, &subopt, painter, widget);
+ proxy()->drawControl(CE_PushButtonLabel, &subopt, painter, widget);
}
break;
@@ -2847,8 +2861,7 @@ void QGtkStyle::drawControl(ControlElement element,
if (vertical) {
rect.translate(xt, -yt * 2);
rect = QRect(rect.left(), rect.top(), rect.height(), rect.width()); // Flip width and height
- QTransform m;
- m.translate(rect.height(), 0);
+ QTransform m = QTransform::fromTranslate(rect.height(), 0);
m.rotate(90.0);
painter->setTransform(m);
}
@@ -2958,8 +2971,8 @@ QRect QGtkStyle::subControlRect(ComplexControl control, const QStyleOptionComple
font.setBold(true);
QFontMetrics fontMetrics(font);
QSize textRect = fontMetrics.boundingRect(groupBoxWidget->title()).size() + QSize(4, 4);
- int indicatorWidth = pixelMetric(PM_IndicatorWidth, option, widget);
- int indicatorHeight = pixelMetric(PM_IndicatorHeight, option, widget);
+ int indicatorWidth = proxy()->pixelMetric(PM_IndicatorWidth, option, widget);
+ int indicatorHeight = proxy()->pixelMetric(PM_IndicatorHeight, option, widget);
if (subControl == SC_GroupBoxCheckBox) {
rect.setWidth(indicatorWidth);
@@ -3040,7 +3053,7 @@ QRect QGtkStyle::subControlRect(ComplexControl control, const QStyleOptionComple
QGtk::gtk_widget_set_direction(gtkCombo, (option->direction == Qt::RightToLeft) ? GTK_TEXT_DIR_RTL : GTK_TEXT_DIR_LTR);
GtkAllocation geometry = {0, 0, qMax(0, option->rect.width()), qMax(0, option->rect.height())};
QGtk::gtk_widget_size_allocate(gtkCombo, &geometry);
- int appears_as_list = !styleHint(QStyle::SH_ComboBox_Popup, option, widget);
+ int appears_as_list = !proxy()->styleHint(QStyle::SH_ComboBox_Popup, option, widget);
QString arrowPath = comboBoxPath + QLS(".GtkToggleButton");
if (!box->editable && !appears_as_list)
@@ -3204,7 +3217,7 @@ QSize QGtkStyle::sizeFromContents(ContentsType type, const QStyleOption *option,
case CT_ComboBox:
if (const QStyleOptionComboBox *combo = qstyleoption_cast<const QStyleOptionComboBox *>(option)) {
GtkWidget *gtkCombo = QGtk::gtkWidget(QLS("GtkComboBox"));
- QRect arrowButtonRect = subControlRect(CC_ComboBox, combo, SC_ComboBoxArrow, widget);
+ QRect arrowButtonRect = proxy()->subControlRect(CC_ComboBox, combo, SC_ComboBoxArrow, widget);
newSize = size + QSize(12 + arrowButtonRect.width() + 2*gtkCombo->style->xthickness, 4 + 2*gtkCombo->style->ythickness);
if (!(widget && qobject_cast<QToolBar *>(widget->parentWidget())))
@@ -3231,6 +3244,7 @@ QSize QGtkStyle::sizeFromContents(ContentsType type, const QStyleOption *option,
return newSize;
}
+
/*! \reimp */
QPixmap QGtkStyle::standardPixmap(StandardPixmap sp, const QStyleOption *option,
const QWidget *widget) const
@@ -3263,65 +3277,80 @@ QPixmap QGtkStyle::standardPixmap(StandardPixmap sp, const QStyleOption *option,
}
break;
- case SP_DialogDiscardButton: {
+ case SP_DialogDiscardButton:
return QGtkPainter::getIcon(GTK_STOCK_DELETE);
- }
-
- case SP_DialogOkButton: {
+ case SP_DialogOkButton:
return QGtkPainter::getIcon(GTK_STOCK_OK);
- }
-
- case SP_DialogCancelButton: {
+ case SP_DialogCancelButton:
return QGtkPainter::getIcon(GTK_STOCK_CANCEL);
- }
-
- case SP_DialogYesButton: {
+ case SP_DialogYesButton:
return QGtkPainter::getIcon(GTK_STOCK_YES);
- }
-
- case SP_DialogNoButton: {
+ case SP_DialogNoButton:
return QGtkPainter::getIcon(GTK_STOCK_NO);
- }
-
- case SP_DialogOpenButton: {
+ case SP_DialogOpenButton:
return QGtkPainter::getIcon(GTK_STOCK_OPEN);
- }
-
- case SP_DialogCloseButton: {
+ case SP_DialogCloseButton:
return QGtkPainter::getIcon(GTK_STOCK_CLOSE);
- }
-
- case SP_DialogApplyButton: {
+ case SP_DialogApplyButton:
return QGtkPainter::getIcon(GTK_STOCK_APPLY);
- }
-
- case SP_DialogSaveButton: {
+ case SP_DialogSaveButton:
return QGtkPainter::getIcon(GTK_STOCK_SAVE);
- }
-
- case SP_MessageBoxWarning: {
+ case SP_MessageBoxWarning:
return QGtkPainter::getIcon(GTK_STOCK_DIALOG_WARNING, GTK_ICON_SIZE_DIALOG);
- }
-
- case SP_MessageBoxQuestion: {
+ case SP_MessageBoxQuestion:
return QGtkPainter::getIcon(GTK_STOCK_DIALOG_QUESTION, GTK_ICON_SIZE_DIALOG);
- }
-
- case SP_MessageBoxInformation: {
+ case SP_MessageBoxInformation:
return QGtkPainter::getIcon(GTK_STOCK_DIALOG_INFO, GTK_ICON_SIZE_DIALOG);
- }
-
- case SP_MessageBoxCritical: {
+ case SP_MessageBoxCritical:
return QGtkPainter::getIcon(GTK_STOCK_DIALOG_ERROR, GTK_ICON_SIZE_DIALOG);
- }
-
default:
return QCleanlooksStyle::standardPixmap(sp, option, widget);
}
+ return pixmap;
+}
- return QPixmap();
+/*!
+ \internal
+*/
+QIcon QGtkStyle::standardIconImplementation(StandardPixmap standardIcon,
+ const QStyleOption *option,
+ const QWidget *widget) const
+{
+ if (!QGtk::isThemeAvailable())
+ return QCleanlooksStyle::standardIconImplementation(standardIcon, option, widget);
+ switch (standardIcon) {
+ case SP_DialogDiscardButton:
+ return QGtkPainter::getIcon(GTK_STOCK_DELETE);
+ case SP_DialogOkButton:
+ return QGtkPainter::getIcon(GTK_STOCK_OK);
+ case SP_DialogCancelButton:
+ return QGtkPainter::getIcon(GTK_STOCK_CANCEL);
+ case SP_DialogYesButton:
+ return QGtkPainter::getIcon(GTK_STOCK_YES);
+ case SP_DialogNoButton:
+ return QGtkPainter::getIcon(GTK_STOCK_NO);
+ case SP_DialogOpenButton:
+ return QGtkPainter::getIcon(GTK_STOCK_OPEN);
+ case SP_DialogCloseButton:
+ return QGtkPainter::getIcon(GTK_STOCK_CLOSE);
+ case SP_DialogApplyButton:
+ return QGtkPainter::getIcon(GTK_STOCK_APPLY);
+ case SP_DialogSaveButton:
+ return QGtkPainter::getIcon(GTK_STOCK_SAVE);
+ case SP_MessageBoxWarning:
+ return QGtkPainter::getIcon(GTK_STOCK_DIALOG_WARNING, GTK_ICON_SIZE_DIALOG);
+ case SP_MessageBoxQuestion:
+ return QGtkPainter::getIcon(GTK_STOCK_DIALOG_QUESTION, GTK_ICON_SIZE_DIALOG);
+ case SP_MessageBoxInformation:
+ return QGtkPainter::getIcon(GTK_STOCK_DIALOG_INFO, GTK_ICON_SIZE_DIALOG);
+ case SP_MessageBoxCritical:
+ return QGtkPainter::getIcon(GTK_STOCK_DIALOG_ERROR, GTK_ICON_SIZE_DIALOG);
+ default:
+ return QCleanlooksStyle::standardIconImplementation(standardIcon, option, widget);
+ }
}
+
/*! \reimp */
QRect QGtkStyle::subElementRect(SubElement element, const QStyleOption *option, const QWidget *widget) const
{
diff --git a/src/gui/styles/qgtkstyle.h b/src/gui/styles/qgtkstyle.h
index bceab9d..cd81e3b 100644
--- a/src/gui/styles/qgtkstyle.h
+++ b/src/gui/styles/qgtkstyle.h
@@ -1,7 +1,6 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the QtGui module of the Qt Toolkit.
@@ -21,9 +20,10 @@
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.1, included in the file LGPL_EXCEPTION.txt in this
+** package.
**
** If you have questions regarding the use of this file, please contact
** Nokia at qt-info@nokia.com.
@@ -106,6 +106,10 @@ public:
void unpolish(QWidget *widget);
void unpolish(QApplication *app);
+
+protected Q_SLOTS:
+ QIcon standardIconImplementation(StandardPixmap standardIcon, const QStyleOption *option,
+ const QWidget *widget = 0) const;
};
diff --git a/src/gui/styles/qmacstyle.qdoc b/src/gui/styles/qmacstyle.qdoc
new file mode 100644
index 0000000..943f7c8
--- /dev/null
+++ b/src/gui/styles/qmacstyle.qdoc
@@ -0,0 +1,261 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.1, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+
+/*!
+ \class QMacStyle
+ \brief The QMacStyle class provides a Mac OS X style using the Apple Appearance Manager.
+
+ \ingroup appearance
+
+ This class is implemented as a wrapper to the HITheme
+ APIs, allowing applications to be styled according to the current
+ theme in use on Mac OS X. This is done by having primitives
+ in QStyle implemented in terms of what Mac OS X would normally theme.
+
+ \warning This style is only available on Mac OS X because it relies on the
+ HITheme APIs.
+
+ There are additional issues that should be taken
+ into consideration to make an application compatible with the
+ \link http://developer.apple.com/documentation/UserExperience/Conceptual/OSXHIGuidelines/index.html
+ Apple Human Interface Guidelines \endlink. Some of these issues are outlined
+ below.
+
+ \list
+
+ \i Layout - The restrictions on window layout are such that some
+ aspects of layout that are style-dependent cannot be achieved
+ using QLayout. Changes are being considered (and feedback would be
+ appreciated) to make layouts QStyle-able. Some of the restrictions
+ involve horizontal and vertical widget alignment and widget size
+ (covered below).
+
+ \i Widget size - Mac OS X allows widgets to have specific fixed sizes. Qt
+ does not fully implement this behavior so as to maintain cross-platform
+ compatibility. As a result some widgets sizes may be inappropriate (and
+ subsequently not rendered correctly by the HITheme APIs).The
+ QWidget::sizeHint() will return the appropriate size for many
+ managed widgets (widgets enumerated in \l QStyle::ContentsType).
+
+ \i Effects - QMacStyle uses HITheme for performing most of the drawing, but
+ also uses emulation in a few cases where HITheme does not provide the
+ required functionality (for example, tab bars on Panther, the toolbar
+ separator, etc). We tried to make the emulation as close to the original as
+ possible. Please report any issues you see in effects or non-standard
+ widgets.
+
+ \endlist
+
+ There are other issues that need to be considered in the feel of
+ your application (including the general color scheme to match the
+ Aqua colors). The Guidelines mentioned above will remain current
+ with new advances and design suggestions for Mac OS X.
+
+ Note that the functions provided by QMacStyle are
+ reimplementations of QStyle functions; see QStyle for their
+ documentation.
+
+ \img qmacstyle.png
+ \sa QWindowsXPStyle, QWindowsStyle, QPlastiqueStyle, QCDEStyle, QMotifStyle
+*/
+
+
+/*!
+ \enum QMacStyle::WidgetSizePolicy
+
+ \value SizeSmall
+ \value SizeLarge
+ \value SizeMini
+ \value SizeDefault
+ \omitvalue SizeNone
+*/
+
+/*! \fn QMacStyle::QMacStyle()
+ Constructs a QMacStyle object.
+*/
+
+/*! \fn QMacStyle::~QMacStyle()
+ Destructs a QMacStyle object.
+*/
+
+/*! \fn void QMacStyle::polish(QPalette &pal)
+ \reimp
+*/
+
+/*! \fn void QMacStyle::polish(QApplication *)
+ \reimp
+*/
+
+/*! \fn void QMacStyle::unpolish(QApplication *)
+ \reimp
+*/
+
+/*! \fn void QMacStyle::polish(QWidget* w)
+ \reimp
+*/
+
+/*! \fn void QMacStyle::unpolish(QWidget* w)
+ \reimp
+*/
+
+/*! \fn int QMacStyle::pixelMetric(PixelMetric metric, const QStyleOption *opt, const QWidget *widget) const
+ \reimp
+*/
+
+/*! \fn QPalette QMacStyle::standardPalette() const
+ \reimp
+*/
+
+/*! \fn int QMacStyle::styleHint(StyleHint sh, const QStyleOption *opt, const QWidget *w, QStyleHintReturn *hret) const
+ \reimp
+*/
+
+/*! \fn QPixmap QMacStyle::generatedIconPixmap(QIcon::Mode iconMode, const QPixmap &pixmap, const QStyleOption *opt) const
+ \reimp
+*/
+
+/*! \fn QPixmap QMacStyle::standardPixmap(StandardPixmap standardPixmap, const QStyleOption *opt, const QWidget *widget) const
+ \reimp
+*/
+
+/*!
+ \enum QMacStyle::FocusRectPolicy
+
+ This type is used to signify a widget's focus rectangle policy.
+
+ \value FocusEnabled show a focus rectangle when the widget has focus.
+ \value FocusDisabled never show a focus rectangle for the widget.
+ \value FocusDefault show a focus rectangle when the widget has
+ focus and the widget is a QSpinWidget, QDateTimeEdit, QLineEdit,
+ QListBox, QListView, editable QTextEdit, or one of their
+ subclasses.
+*/
+
+/*! \fn void QMacStyle::setFocusRectPolicy(QWidget *w, FocusRectPolicy policy)
+ \obsolete
+ Sets the focus rectangle policy of \a w. The \a policy can be one of
+ \l{QMacStyle::FocusRectPolicy}.
+
+ This is now simply an interface to the Qt::WA_MacShowFocusRect attribute and the
+ FocusDefault value does nothing anymore. If you want to set a widget back
+ to its default value, you must save the old value of the attribute before
+ you change it.
+
+ \sa focusRectPolicy() QWidget::setAttribute()
+*/
+
+/*! \fn QMacStyle::FocusRectPolicy QMacStyle::focusRectPolicy(const QWidget *w)
+ \obsolete
+ Returns the focus rectangle policy for the widget \a w.
+
+ The focus rectangle policy can be one of \l{QMacStyle::FocusRectPolicy}.
+
+ In 4.3 and up this function will simply test for the
+ Qt::WA_MacShowFocusRect attribute and will never return
+ QMacStyle::FocusDefault.
+
+ \sa setFocusRectPolicy(), QWidget::testAttribute()
+*/
+
+/*! \fn void QMacStyle::setWidgetSizePolicy(const QWidget *widget, WidgetSizePolicy policy)
+
+ \obsolete
+
+ Call QWidget::setAttribute() with Qt::WA_MacMiniSize, Qt::WA_MacSmallSize,
+ or Qt::WA_MacNormalSize instead.
+*/
+
+/*! \fn QMacStyle::WidgetSizePolicy QMacStyle::widgetSizePolicy(const QWidget *widget)
+ \obsolete
+
+ Call QWidget::testAttribute() with Qt::WA_MacMiniSize, Qt::WA_MacSmallSize,
+ or Qt::WA_MacNormalSize instead.
+*/
+
+/*! \fn void QMacStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, QPainter *p, const QWidget *w) const
+
+ \reimp
+*/
+
+/*! \fn void QMacStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPainter *p, const QWidget *w) const
+
+ \reimp
+*/
+
+/*! \fn QRect QMacStyle::subElementRect(SubElement sr, const QStyleOption *opt, const QWidget *widget) const
+
+ \reimp
+*/
+
+/*! \fn void QMacStyle::drawComplexControl(ComplexControl cc, const QStyleOptionComplex *opt, QPainter *p, const QWidget *widget) const
+ \reimp
+*/
+
+/*! \fn QStyle::SubControl QMacStyle::hitTestComplexControl(ComplexControl cc, const QStyleOptionComplex *opt, const QPoint &pt, const QWidget *widget) const
+ \reimp
+*/
+
+/*! \fn QRect QMacStyle::subControlRect(ComplexControl cc, const QStyleOptionComplex *opt, SubControl sc, const QWidget *widget) const
+ \reimp
+*/
+
+/*! \fn QSize QMacStyle::sizeFromContents(ContentsType ct, const QStyleOption *opt, const QSize &csz, const QWidget *widget) const
+ \reimp
+*/
+
+/*! \fn void QMacStyle::drawItemText(QPainter *p, const QRect &r, int flags, const QPalette &pal, bool enabled, const QString &text, QPalette::ColorRole textRole) const
+ \reimp
+*/
+
+/*! \fn bool QMacStyle::event(QEvent *e)
+ \reimp
+*/
+
+/*! \fn QIcon QMacStyle::standardIconImplementation(StandardPixmap standardIcon, const QStyleOption *opt, const QWidget *widget) const
+ \internal
+*/
+
+/*! \fn int QMacStyle::layoutSpacingImplementation(QSizePolicy::ControlType control1, QSizePolicy::ControlType control2, Qt::Orientation orientation, const QStyleOption *option, const QWidget *widget) const
+
+ \internal
+*/
+
diff --git a/src/gui/styles/qmacstyle_mac.h b/src/gui/styles/qmacstyle_mac.h
index 73875c2..6d26a66 100644
--- a/src/gui/styles/qmacstyle_mac.h
+++ b/src/gui/styles/qmacstyle_mac.h
@@ -1,7 +1,6 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the QtGui module of the Qt Toolkit.
@@ -21,9 +20,10 @@
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.1, included in the file LGPL_EXCEPTION.txt in this
+** package.
**
** If you have questions regarding the use of this file, please contact
** Nokia at qt-info@nokia.com.
diff --git a/src/gui/styles/qmacstyle_mac.mm b/src/gui/styles/qmacstyle_mac.mm
index ee106eb..e7ef51a 100644
--- a/src/gui/styles/qmacstyle_mac.mm
+++ b/src/gui/styles/qmacstyle_mac.mm
@@ -1,7 +1,6 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the QtGui module of the Qt Toolkit.
@@ -21,9 +20,10 @@
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.1, included in the file LGPL_EXCEPTION.txt in this
+** package.
**
** If you have questions regarding the use of this file, please contact
** Nokia at qt-info@nokia.com.
@@ -50,11 +50,13 @@
#define QMAC_QAQUASTYLE_SIZE_CONSTRAIN
//#define DEBUG_SIZE_CONSTRAINT
+#include <private/qapplication_p.h>
#include <private/qcombobox_p.h>
#include <private/qmacstylepixmaps_mac_p.h>
#include <private/qpaintengine_mac_p.h>
#include <private/qpainter_p.h>
#include <private/qprintengine_mac_p.h>
+#include <private/qstylehelper_p.h>
#include <qapplication.h>
#include <qbitmap.h>
#include <qcheckbox.h>
@@ -102,7 +104,6 @@
QT_BEGIN_NAMESPACE
extern QRegion qt_mac_convert_mac_region(RgnHandle); //qregion_mac.cpp
-extern QHash<QByteArray, QFont> *qt_app_fonts_hash(); // qapplication.cpp
// The following constants are used for adjusting the size
// of push buttons so that they are drawn inside their bounds.
@@ -130,6 +131,20 @@ static const QColor titlebarSeparatorLineInactive(131, 131, 131);
static const QColor mainWindowGradientBegin(240, 240, 240);
static const QColor mainWindowGradientEnd(200, 200, 200);
+#if (MAC_OS_X_VERSION_MAX_ALLOWED <= MAC_OS_X_VERSION_10_5)
+enum {
+ kThemePushButtonTextured = 31,
+ kThemePushButtonTexturedSmall = 32,
+ kThemePushButtonTexturedMini = 33
+};
+
+/* Search fields */
+enum {
+ kHIThemeFrameTextFieldRound = 1000,
+ kHIThemeFrameTextFieldRoundSmall = 1001,
+ kHIThemeFrameTextFieldRoundMini = 1002
+};
+#endif
// Resolve these at run-time, since the functions was moved in Leopard.
typedef HIRect * (*PtrHIShapeGetBounds)(HIShapeRef, HIRect *);
@@ -488,11 +503,9 @@ public:
inline int animateSpeed(Animates) const { return 33; }
// Utility functions
- void drawColorlessButton(const QRect &macRect, HIThemeButtonDrawInfo *bdi,
+ void drawColorlessButton(const HIRect &macRect, HIThemeButtonDrawInfo *bdi,
QPainter *p, const QStyleOption *opt) const;
- void drawPantherTab(const QStyleOptionTab *tab, QPainter *p, const QWidget *w = 0) const;
-
QSize pushButtonSizeFromContents(const QStyleOptionButton *btn) const;
HIRect pushButtonContentBounds(const QStyleOptionButton *btn,
@@ -505,7 +518,7 @@ public:
static QRect comboboxEditBounds(const QRect &outerBounds, const HIThemeButtonDrawInfo &bdi);
- static void drawCombobox(const QRect &outerBounds, const HIThemeButtonDrawInfo &bdi, QPainter *p);
+ static void drawCombobox(const HIRect &outerBounds, const HIThemeButtonDrawInfo &bdi, QPainter *p);
static void drawTableHeader(const HIRect &outerBounds, bool drawTopBorder, bool drawLeftBorder,
const HIThemeButtonDrawInfo &bdi, QPainter *p);
bool contentFitsInPushButton(const QStyleOptionButton *btn, HIThemeButtonDrawInfo *bdi,
@@ -545,7 +558,6 @@ QT_END_INCLUDE_NAMESPACE
External functions
*****************************************************************************/
extern CGContextRef qt_mac_cg_context(const QPaintDevice *); //qpaintdevice_mac.cpp
-extern QPixmap qt_mac_convert_iconref(const IconRef, int, int); //qpixmap_mac.cpp
extern QRegion qt_mac_convert_mac_region(HIShapeRef); //qregion_mac.cpp
void qt_mac_dispose_rgn(RgnHandle r); //qregion_mac.cpp
extern QPaintDevice *qt_mac_safe_pdev; //qapplication_mac.cpp
@@ -566,11 +578,7 @@ QPixmap *qt_mac_backgroundPattern = 0; // stores the standard widget background.
*****************************************************************************/
static inline int qt_mac_hitheme_tab_version()
{
-#if (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4)
- if (QSysInfo::MacintoshVersion >= QSysInfo::MV_10_4)
- return 1;
-#endif
- return 0;
+ return 1;
}
static inline HIRect qt_hirectForQRect(const QRect &convertRect, const QRect &rect = QRect())
@@ -836,7 +844,7 @@ static QSize qt_aqua_get_known_size(QStyle::ContentsType ct, const QWidget *widg
}
break;
case QStyle::CT_HeaderSection:
- if (sz == QAquaSizeLarge && isTreeView(widg))
+ if (isTreeView(widg))
ret = QSize(-1, qt_mac_aqua_get_metric(kThemeMetricListHeaderHeight));
break;
case QStyle::CT_MenuBar:
@@ -1020,13 +1028,6 @@ HIRect QMacStylePrivate::pushButtonContentBounds(const QStyleOptionButton *btn,
HIRect contentBounds;
HIThemeGetButtonContentBounds(&outerBounds, bdi, &contentBounds);
-
- // Return the button rect if the rect returned by HIThemeGetButtonContentBounds
- // is invalid. This avoids passing around bad rects to code that does not expect it.
- if (contentBounds.size.height == 0 && contentBounds.size.width == 0) {
- return qt_hirectForQRect(btn->rect);
- }
-
return contentBounds;
}
@@ -1043,7 +1044,7 @@ QSize QMacStylePrivate::pushButtonSizeFromContents(const QStyleOptionButton *btn
: btn->fontMetrics.boundingRect(QRect(), Qt::AlignCenter, btn->text);
csz.setWidth(iconSize.width() + textRect.width()
+ ((btn->features & QStyleOptionButton::HasMenu)
- ? q->pixelMetric(QStyle::PM_MenuButtonIndicator, btn, 0) : 0));
+ ? q->proxy()->pixelMetric(QStyle::PM_MenuButtonIndicator, btn, 0) : 0));
csz.setHeight(qMax(iconSize.height(), textRect.height()));
return csz;
}
@@ -1287,12 +1288,11 @@ QRect QMacStylePrivate::comboboxEditBounds(const QRect &outerBounds, const HIThe
create it manually by drawing a small Carbon combo onto a pixmap (use pixmap cache), chop
it up, and copy it back onto the widget. Othervise, draw the combobox supplied by Carbon directly.
*/
-void QMacStylePrivate::drawCombobox(const QRect &outerBounds, const HIThemeButtonDrawInfo &bdi, QPainter *p)
+void QMacStylePrivate::drawCombobox(const HIRect &outerBounds, const HIThemeButtonDrawInfo &bdi, QPainter *p)
{
- if (!(bdi.kind == kThemeComboBox && outerBounds.height() > 28)){
+ if (!(bdi.kind == kThemeComboBox && outerBounds.size.height > 28)){
// We have an unscaled combobox, or popup-button; use Carbon directly.
- const HIRect hiOuterBounds = qt_hirectForQRect(outerBounds);
- HIRect innerBounds = QMacStylePrivate::comboboxInnerBounds(hiOuterBounds, bdi.kind);
+ HIRect innerBounds = QMacStylePrivate::comboboxInnerBounds(outerBounds, bdi.kind);
HIThemeDrawButton(&innerBounds, &bdi, QMacCGContext(p), kHIThemeOrientationNormal, 0);
} else {
QPixmap buffer;
@@ -1307,50 +1307,31 @@ void QMacStylePrivate::drawCombobox(const QRect &outerBounds, const HIThemeButto
QPixmapCache::insert(key, buffer);
}
- const int widgetX = outerBounds.x();
- const int widgetY = outerBounds.y();
- const int widgetWidth = outerBounds.width();
- const int widgetHeight = outerBounds.height();
-
- const int buttonWidth = 20;
- const int frameWidth = 10;
- const int frameHeight = 10; // frame height
- const int bstart = widgetWidth - buttonWidth;
- const int flower = widgetHeight - frameHeight;
+ const int bwidth = 20;
+ const int fwidth = 10;
+ const int fheight = 10;
+ int w = qRound(outerBounds.size.width);
+ int h = qRound(outerBounds.size.height);
+ int bstart = w - bwidth;
+ int blower = fheight + 1;
+ int flower = h - fheight;
+ int sheight = flower - fheight;
+ int center = qRound(outerBounds.size.height + outerBounds.origin.y) / 2;
// Draw upper and lower gap
- p->drawPixmap(widgetX + frameWidth, widgetY, bstart - frameWidth, frameHeight,
- buffer, frameWidth, 0, 1, frameHeight); // upper
- p->drawPixmap(widgetX + frameWidth, widgetY + flower, bstart - frameWidth, frameHeight,
- buffer, frameWidth, buffer.height() - frameHeight, 1, frameHeight); // lower
-
- const int center = widgetY + widgetHeight / 2;
- const int sheight = flower - frameHeight;
-
+ p->drawPixmap(fwidth, 0, bstart - fwidth, fheight, buffer, fwidth, 0, 1, fheight);
+ p->drawPixmap(fwidth, flower, bstart - fwidth, fheight, buffer, fwidth, buffer.height() - fheight, 1, fheight);
// Draw left and right gap. Right gap is drawn top and bottom separatly
- p->drawPixmap(widgetX, widgetY + frameHeight, frameWidth, sheight,
- buffer, 0, frameHeight, frameWidth, 1); // right
- p->drawPixmap(widgetX + bstart, widgetY + frameHeight, buttonWidth, widgetHeight / 2 - frameHeight,
- buffer, buffer.width() - buttonWidth, frameHeight - 1, buttonWidth, 1); // top left
- p->drawPixmap(widgetX + bstart, center, buttonWidth, sheight / 2,
- buffer, buffer.width() - buttonWidth, frameHeight + 6, buttonWidth, 1); // bottom left
-
+ p->drawPixmap(0, fheight, fwidth, sheight, buffer, 0, fheight, fwidth, 1);
+ p->drawPixmap(bstart, fheight, bwidth, center - fheight, buffer, buffer.width() - bwidth, fheight - 1, bwidth, 1);
+ p->drawPixmap(bstart, center, bwidth, sheight / 2, buffer, buffer.width() - bwidth, fheight + 6, bwidth, 1);
// Draw arrow
- p->drawPixmap(widgetX + bstart, center - 4, buttonWidth - 3, 6,
- buffer, buffer.width() - buttonWidth, frameHeight, buttonWidth - 3, 6);
-
+ p->drawPixmap(bstart, center - 4, bwidth - 3, 6, buffer, buffer.width() - bwidth, fheight, bwidth - 3, 6);
// Draw corners
- p->drawPixmap(widgetX, widgetY, frameWidth, frameHeight,
- buffer, 0, 0, frameWidth, frameHeight); // top left
- p->drawPixmap(widgetX + bstart, widgetY, buttonWidth, frameHeight,
- buffer, buffer.width() - buttonWidth, 0, buttonWidth, frameHeight); // top right
- p->drawPixmap(widgetX, widgetY + flower, frameWidth, frameHeight,
- buffer, 0, buffer.height() - frameHeight, frameWidth, frameHeight); // bottom left
-
- const int blower = frameHeight + 1;
- p->drawPixmap(widgetX + bstart, widgetY + widgetHeight - blower, buttonWidth, blower,
- buffer,
- buffer.width() - buttonWidth, buffer.height() - blower, buttonWidth, blower); // bottom right
+ p->drawPixmap(0, 0, fwidth, fheight, buffer, 0, 0, fwidth, fheight);
+ p->drawPixmap(bstart, 0, bwidth, fheight, buffer, buffer.width() - bwidth, 0, bwidth, fheight);
+ p->drawPixmap(0, flower, fwidth, fheight, buffer, 0, buffer.height() - fheight, fwidth, fheight);
+ p->drawPixmap(bstart, h - blower, bwidth, blower, buffer, buffer.width() - bwidth, buffer.height() - blower, bwidth, blower);
}
}
@@ -1483,8 +1464,7 @@ void QMacStylePrivate::getSliderInfo(QStyle::ComplexControl cc, const QStyleOpti
}
// Tiger broke reverse scroll bars so put them back and "fake it"
- if (isScrollbar && (tdi->attributes & kThemeTrackRightToLeft)
- && QSysInfo::MacintoshVersion >= QSysInfo::MV_10_4) {
+ if (isScrollbar && (tdi->attributes & kThemeTrackRightToLeft)) {
tdi->attributes &= ~kThemeTrackRightToLeft;
tdi->value = tdi->max - slider->sliderPosition;
}
@@ -1567,166 +1547,6 @@ void QMacStylePrivate::startAnimationTimer()
timerID = startTimer(animateSpeed(AquaListViewItemOpen));
}
-enum { TabNormalLeft, TabNormalMid, TabNormalRight, TabSelectedActiveLeft,
- TabSelectedActiveMid, TabSelectedActiveRight, TabSelectedInactiveLeft,
- TabSelectedInactiveMid, TabSelectedInactiveRight, TabSelectedActiveGraphiteLeft,
- TabSelectedActiveGraphiteMid, TabSelectedActiveGraphiteRight,
- TabPressedLeft, TabPressedMid, TabPressedRight };
-
-static const char * const * const PantherTabXpms[] = {
- qt_mac_tabnrm_left,
- qt_mac_tabnrm_mid,
- qt_mac_tabnrm_right,
- qt_mac_tabselected_active_left,
- qt_mac_tabselected_active_mid,
- qt_mac_tabselected_active_right,
- qt_mac_tabselected_inactive_left,
- qt_mac_tabselected_inactive_mid,
- qt_mac_tabselected_inactive_right,
- qt_mac_tab_selected_active_graph_left,
- qt_mac_tab_selected_active_graph_mid,
- qt_mac_tab_selected_active_graph_right,
- qt_mac_tab_press_left,
- qt_mac_tab_press_mid,
- qt_mac_tab_press_right};
-
-void QMacStylePrivate::drawPantherTab(const QStyleOptionTab *tabOpt, QPainter *p,
- const QWidget *) const
-{
- QString tabKey = QLatin1String("$qt_mac_style_tab_");
- int pantherTabStart;
- int pantherTabMid;
- int pantherTabEnd;
-
- ThemeTabDirection ttd = getTabDirection(tabOpt->shape);
-
- if (tabOpt->state & QStyle::State_Selected) {
- if (!(tabOpt->state & QStyle::State_Active)) {
- pantherTabStart = TabSelectedInactiveLeft;
- } else {
- // Draw into a pixmap to determine which version we use, Aqua or Graphite.
- QPixmap tabPix(20, 20);
- QPainter pixPainter(&tabPix);
- HIThemeTabDrawInfo tdi;
- tdi.version = 0;
- tdi.style = kThemeTabFront;
- tdi.direction = kThemeTabNorth;
- tdi.size = kHIThemeTabSizeNormal;
- tdi.adornment = kHIThemeTabAdornmentNone;
- HIRect inRect = CGRectMake(0.0f, 0.0f, 20.0f, 20.0f);
- HIThemeDrawTab(&inRect, &tdi, QMacCGContext(&pixPainter), kHIThemeOrientationNormal, 0);
- pixPainter.end();
- const QRgb GraphiteColor = 0xffa7b0ba;
- QRgb pmColor = tabPix.toImage().pixel(10, 10);
- if (qAbs(qRed(pmColor) - qRed(GraphiteColor)) < 3 &&
- qAbs(qGreen(pmColor) - qGreen(GraphiteColor)) < 3
- && qAbs(qBlue(pmColor) - qBlue(GraphiteColor)) < 3)
- pantherTabStart = TabSelectedActiveGraphiteLeft;
- else
- pantherTabStart = TabSelectedActiveLeft;
- }
- } else if (tabOpt->state & QStyle::State_Sunken) {
- pantherTabStart = TabPressedLeft;
- } else {
- pantherTabStart = TabNormalLeft;
- }
-
-
- bool doLine;
- bool verticalTabs = ttd == kThemeTabWest || ttd == kThemeTabEast;
-
- QStyleOptionTab::TabPosition tp = tabOpt->position;
- if (ttd == kThemeTabWest
- || ((ttd == kThemeTabNorth || ttd == kThemeTabSouth)
- && tabOpt->direction == Qt::RightToLeft)) {
- if (tp == QStyleOptionTab::Beginning)
- tp = QStyleOptionTab::End;
- else if (tp == QStyleOptionTab::End)
- tp = QStyleOptionTab::Beginning;
- }
-
- switch (tp) {
- default: // Stupid GCC, being overly pedantic
- case QStyleOptionTab::Beginning:
- doLine = false;
- pantherTabMid = pantherTabEnd = pantherTabStart + 1;
- break;
- case QStyleOptionTab::Middle:
- doLine = true;
- pantherTabMid = pantherTabEnd = ++pantherTabStart;
- break;
- case QStyleOptionTab::End:
- doLine = true;
- pantherTabMid = ++pantherTabStart;
- pantherTabEnd = pantherTabMid + 1;
- break;
- case QStyleOptionTab::OnlyOneTab:
- doLine = false;
- pantherTabMid = pantherTabStart + 1;
- pantherTabEnd = pantherTabMid + 1;
- break;
- }
-
- QPixmap pmStart;
- if (!QPixmapCache::find(tabKey + QString::number(pantherTabStart), pmStart)) {
- pmStart = QPixmap(PantherTabXpms[pantherTabStart]);
- QPixmapCache::insert(tabKey + QString::number(pantherTabStart), pmStart);
- }
-
- QPixmap pmMid;
- if (!QPixmapCache::find(tabKey + QString::number(pantherTabMid), pmMid)) {
- pmMid = QPixmap(PantherTabXpms[pantherTabMid]);
- QPixmapCache::insert(tabKey + QString::number(pantherTabMid), pmMid);
- }
-
- QPixmap pmEnd;
- if (!QPixmapCache::find(tabKey + QString::number(pantherTabEnd), pmEnd)) {
- pmEnd = QPixmap(PantherTabXpms[pantherTabEnd]);
- QPixmapCache::insert(tabKey + QString::number(pantherTabEnd), pmEnd);
- }
- QRect tr = tabOpt->rect;
- if (verticalTabs) {
- p->save();
- int newX, newY, newRot;
- if (tabOpt->shape == QTabBar::RoundedEast || tabOpt->shape == QTabBar::TriangularEast) {
- newX = tr.width();
- newY = tr.y();
- newRot = 90;
- } else {
- newX = 0;
- newY = tr.y() + tr.height();
- newRot = -90;
- }
- tr.setRect(0, 0, tr.height(), tr.width());
- QMatrix m;
- if (ttd == kThemeTabEast) {
- // It's lame but Apple inverts these on the East side.
- m.scale(-1, 1);
- m.translate(-tabOpt->rect.width(), 0);
- }
- m.translate(newX, newY);
- m.rotate(newRot);
- p->setMatrix(m, true);
- }
-
- int x = tr.x();
- int y = tr.y();
- int endX = x + tr.width() - pmEnd.width();
-
- p->drawPixmap(x, y, pmStart.width(), tr.height(), pmStart);
- if (doLine) {
- QPen oldPen = p->pen();
- p->setPen(QColor(0, 0, 0, 0x35));
- p->drawLine(x, y + (verticalTabs ? 0 : 1), x, tr.height() - 2);
- }
-
- for (x = x + pmStart.width(); x < endX; x += pmMid.width())
- p->drawPixmap(x, y, pmMid.width(), tr.height(), pmMid);
- p->drawPixmap(endX, y, pmEnd.width(), tr.height(), pmEnd);
- if (verticalTabs)
- p->restore();
-}
-
bool QMacStylePrivate::addWidget(QWidget *w)
{
//already knew of it
@@ -1915,7 +1735,7 @@ bool QMacStylePrivate::doAnimate(QMacStylePrivate::Animates as)
return true;
}
-void QMacStylePrivate::drawColorlessButton(const QRect &outerBounds, HIThemeButtonDrawInfo *bdi,
+void QMacStylePrivate::drawColorlessButton(const HIRect &macRect, HIThemeButtonDrawInfo *bdi,
QPainter *p, const QStyleOption *opt) const
{
int xoff = 0,
@@ -1925,8 +1745,8 @@ void QMacStylePrivate::drawColorlessButton(const QRect &outerBounds, HIThemeButt
finalyoff = 0;
const QStyleOptionComboBox *combo = qstyleoption_cast<const QStyleOptionComboBox *>(opt);
- const int width = outerBounds.width() + extraWidth;
- const int height = outerBounds.height() + extraHeight;
+ int width = int(macRect.size.width) + extraWidth;
+ int height = int(macRect.size.height) + extraHeight;
if (width <= 0 || height <= 0)
return; // nothing to draw
@@ -1943,11 +1763,11 @@ void QMacStylePrivate::drawColorlessButton(const QRect &outerBounds, HIThemeButt
// Carbon combos don't scale. Therefore we draw it
// ourselves, if a scaled version is needed.
QPainter tmpPainter(&activePixmap);
- QMacStylePrivate::drawCombobox(outerBounds, *bdi, &tmpPainter);
+ QMacStylePrivate::drawCombobox(macRect, *bdi, &tmpPainter);
}
else {
QMacCGContext cg(&activePixmap);
- HIRect newRect = CGRectMake(xoff, yoff, outerBounds.width(), outerBounds.height());
+ HIRect newRect = CGRectMake(xoff, yoff, macRect.size.width, macRect.size.height);
HIThemeDrawButton(&newRect, bdi, cg, kHIThemeOrientationNormal, 0);
}
}
@@ -1987,7 +1807,7 @@ void QMacStylePrivate::drawColorlessButton(const QRect &outerBounds, HIThemeButt
colorlessPixmap.fill(Qt::transparent);
QMacCGContext cg(&colorlessPixmap);
- HIRect newRect = CGRectMake(xoff, yoff, outerBounds.width(), outerBounds.height());
+ HIRect newRect = CGRectMake(xoff, yoff, macRect.size.width, macRect.size.height);
int oldValue = bdi->value;
bdi->value = kThemeButtonOff;
HIThemeDrawButton(&newRect, bdi, cg, kHIThemeOrientationNormal, 0);
@@ -2017,7 +1837,7 @@ void QMacStylePrivate::drawColorlessButton(const QRect &outerBounds, HIThemeButt
}
QPixmapCache::insert(key, pm);
}
- p->drawPixmap(outerBounds.x(), outerBounds.y() + finalyoff, width, height, pm);
+ p->drawPixmap(int(macRect.origin.x), int(macRect.origin.y) + finalyoff, width, height, pm);
}
QMacStyle::QMacStyle()
@@ -2039,22 +1859,10 @@ QMacStyle::~QMacStyle()
QPixmap QMacStylePrivate::generateBackgroundPattern() const
{
QPixmap px(4, 4);
-#if (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4)
- if (QSysInfo::MacintoshVersion >= QSysInfo::MV_10_4) {
- QMacCGContext cg(&px);
- HIThemeSetFill(kThemeBrushDialogBackgroundActive, 0, cg, kHIThemeOrientationNormal);
- const CGRect cgRect = CGRectMake(0, 0, px.width(), px.height());
- CGContextFillRect(cg, cgRect);
- } else
-#endif
- {
-#ifndef QT_MAC_NO_QUICKDRAW
- QMacSavedPortInfo port(&px);
- SetThemeBackground(kThemeBrushDialogBackgroundActive, px.depth(), true);
- const Rect qdRect = { 0, 0, px.width(), px.height() };
- EraseRect(&qdRect);
-#endif
- }
+ QMacCGContext cg(&px);
+ HIThemeSetFill(kThemeBrushDialogBackgroundActive, 0, cg, kHIThemeOrientationNormal);
+ const CGRect cgRect = CGRectMake(0, 0, px.width(), px.height());
+ CGContextFillRect(cg, cgRect);
return px;
}
@@ -2062,25 +1870,23 @@ QPixmap QMacStylePrivate::generateBackgroundPattern() const
Fills the given \a rect with the pattern stored in \a brush. As an optimization,
HIThemeSetFill us used directly if we are filling with the standard background.
*/
-void qt_mac_fill_background(QPainter *painter, const QRegion &rgn, const QPoint &offset, const QBrush &brush)
+void qt_mac_fill_background(QPainter *painter, const QRegion &rgn, const QBrush &brush)
{
-#if (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4)
QPoint dummy;
const QPaintDevice *target = painter->device();
const QPaintDevice *redirected = QPainter::redirected(target, &dummy);
const bool usePainter = redirected && redirected != target;
- const QRegion translated = rgn.translated(offset);
- if (!usePainter && QSysInfo::MacintoshVersion >= QSysInfo::MV_10_4 && qt_mac_backgroundPattern
+ if (!usePainter && qt_mac_backgroundPattern
&& qt_mac_backgroundPattern->cacheKey() == brush.texture().cacheKey()) {
- painter->setClipRegion(translated);
+ painter->setClipRegion(rgn);
CGContextRef cg = qt_mac_cg_context(target);
CGContextSaveGState(cg);
HIThemeSetFill(kThemeBrushDialogBackgroundActive, 0, cg, kHIThemeOrientationInverted);
- const QVector<QRect> &rects = translated.rects();
+ const QVector<QRect> &rects = rgn.rects();
for (int i = 0; i < rects.size(); ++i) {
const QRect rect(rects.at(i));
// Anchor the pattern to the top so it stays put when the window is resized.
@@ -2090,11 +1896,9 @@ void qt_mac_fill_background(QPainter *painter, const QRegion &rgn, const QPoint
}
CGContextRestoreGState(cg);
- } else
-#endif
- {
- const QRect rect(translated.boundingRect());
- painter->setClipRegion(translated);
+ } else {
+ const QRect rect(rgn.boundingRect());
+ painter->setClipRegion(rgn);
painter->drawTiledPixmap(rect, brush.texture(), rect.topLeft());
}
}
@@ -2163,18 +1967,6 @@ void QMacStyle::polish(QWidget* w)
}
}
- // Adjust the lineedit of the editable combo box
- if (QSysInfo::MacintoshVersion == QSysInfo::MV_10_3) {
- if (QLineEdit *lineEdit = qobject_cast<QLineEdit *>(w)) {
- if (qobject_cast<QComboBox *>(lineEdit->parentWidget())
- && !lineEdit->testAttribute(Qt::WA_SetFont)) {
- QFont font = lineEdit->font();
- font.setPointSize(font.pointSize() - 1);
- lineEdit->setFont(font);
- }
- }
- }
-
if (QTabBar *tb = qobject_cast<QTabBar*>(w)) {
if (tb->documentMode()) {
w->setAttribute(Qt::WA_Hover);
@@ -2235,7 +2027,7 @@ int QMacStyle::pixelMetric(PixelMetric metric, const QStyleOption *opt, const QW
ret = closeButtonSize;
break;
case PM_ToolBarIconSize:
- ret = pixelMetric(PM_LargeIconSize);
+ ret = proxy()->pixelMetric(PM_LargeIconSize);
break;
case PM_FocusFrameVMargin:
case PM_FocusFrameHMargin:
@@ -2409,12 +2201,6 @@ int QMacStyle::pixelMetric(PixelMetric metric, const QStyleOption *opt, const QW
GetThemeMetric(kThemeMetricScrollBarWidth, &ret);
break;
case QAquaSizeMini:
-#if (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_3) && 0
- if (QSysInfo::MacintoshVersion >= QSysInfo::MV_10_3) {
- GetThemeMetric(kThemeMetricMiniScrollBarWidth, &ret);
- break;
- }
-#endif
case QAquaSizeSmall:
GetThemeMetric(kThemeMetricSmallScrollBarWidth, &ret);
break;
@@ -2517,9 +2303,6 @@ int QMacStyle::pixelMetric(PixelMetric metric, const QStyleOption *opt, const QW
case PM_ToolBarItemSpacing:
ret = 4;
break;
- case PM_MessageBoxIconSize:
- ret = 64;
- break;
case PM_SplitterWidth:
ret = qMax(7, QApplication::globalStrut().width());
break;
@@ -2595,6 +2378,9 @@ int QMacStyle::pixelMetric(PixelMetric metric, const QStyleOption *opt, const QW
case PM_MenuHMargin:
ret = 0;
break;
+ case PM_ToolBarFrameWidth:
+ ret = 0;
+ break;
default:
ret = QWindowsStyle::pixelMetric(metric, opt, widget);
break;
@@ -2756,7 +2542,7 @@ int QMacStyle::styleHint(StyleHint sh, const QStyleOption *opt, const QWidget *w
QPixmap pix(pixmapSize);
pix.fill(QColor(fillR, fillG, fillB));
QPainter pix_paint(&pix);
- drawControl(CE_FocusFrame, opt, &pix_paint, w);
+ proxy()->drawControl(CE_FocusFrame, opt, &pix_paint, w);
pix_paint.end();
img = pix.toImage();
}
@@ -3071,7 +2857,7 @@ void QMacStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, QPai
twf.rect = twf.rect.adjusted(0, -10, 0, 0);
break;
}
- drawPrimitive(PE_FrameTabWidget, &twf, p, w);
+ proxy()->drawPrimitive(PE_FrameTabWidget, &twf, p, w);
p->restore();
}
break;
@@ -3169,7 +2955,7 @@ void QMacStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, QPai
if (const QStyleOptionHeader *header = qstyleoption_cast<const QStyleOptionHeader *>(opt)) {
// In HITheme, up is down, down is up and hamburgers eat people.
if (header->sortIndicator != QStyleOptionHeader::None)
- drawPrimitive(
+ proxy()->drawPrimitive(
(header->sortIndicator == QStyleOptionHeader::SortDown) ?
PE_IndicatorArrowUp : PE_IndicatorArrowDown, header, p, w);
}
@@ -3242,13 +3028,15 @@ void QMacStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, QPai
bdi.value = kThemeButtonOn;
else
bdi.value = kThemeButtonOff;
-
- if (!drawColorless) {
- const HIRect macRect = qt_hirectForQRect(opt->rect);
+ HIRect macRect;
+ if (pe == PE_Q3CheckListExclusiveIndicator || pe == PE_Q3CheckListIndicator)
+ macRect = qt_hirectForQRect(opt->rect);
+ else
+ macRect = qt_hirectForQRect(opt->rect);
+ if (!drawColorless)
HIThemeDrawButton(&macRect, &bdi, cg, kHIThemeOrientationNormal, 0);
- } else {
- d->drawColorlessButton(opt->rect, &bdi, p, opt);
- }
+ else
+ d->drawColorlessButton(macRect, &bdi, p, opt);
break; }
case PE_FrameFocusRect:
// Use the our own focus widget stuff.
@@ -3301,7 +3089,7 @@ void QMacStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, QPai
fdi.isFocused = (frame->state & State_HasFocus);
int lw = frame->lineWidth;
if (lw <= 0)
- lw = pixelMetric(PM_DefaultFrameWidth, frame, w);
+ lw = proxy()->pixelMetric(PM_DefaultFrameWidth, frame, w);
{ //clear to base color
p->save();
p->setPen(QPen(baseColor, lw));
@@ -3326,27 +3114,14 @@ void QMacStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, QPai
if (const QStyleOptionTabWidgetFrame *twf
= qstyleoption_cast<const QStyleOptionTabWidgetFrame *>(opt)) {
HIRect hirect = qt_hirectForQRect(twf->rect);
-#if (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4)
- if (QSysInfo::MacintoshVersion >= QSysInfo::MV_10_4) {
- HIThemeTabPaneDrawInfo tpdi;
- tpdi.version = qt_mac_hitheme_tab_version();
- tpdi.state = tds;
- tpdi.direction = getTabDirection(twf->shape);
- tpdi.size = kHIThemeTabSizeNormal;
- if (tpdi.version == 1) {
- tpdi.kind = kHIThemeTabKindNormal;
- tpdi.adornment = kHIThemeTabPaneAdornmentNormal;
- }
- HIThemeDrawTabPane(&hirect, &tpdi, cg, kHIThemeOrientationNormal);
- } else
-#endif
- {
- HIThemeGroupBoxDrawInfo gdi;
- gdi.version = qt_mac_hitheme_version;
- gdi.state = tds;
- gdi.kind = kHIThemeGroupBoxKindSecondary;
- HIThemeDrawGroupBox(&hirect, &gdi, cg, kHIThemeOrientationNormal);
- }
+ HIThemeTabPaneDrawInfo tpdi;
+ tpdi.version = qt_mac_hitheme_tab_version();
+ tpdi.state = tds;
+ tpdi.direction = getTabDirection(twf->shape);
+ tpdi.size = kHIThemeTabSizeNormal;
+ tpdi.kind = kHIThemeTabKindNormal;
+ tpdi.adornment = kHIThemeTabPaneAdornmentNormal;
+ HIThemeDrawTabPane(&hirect, &tpdi, cg, kHIThemeOrientationNormal);
}
break;
case PE_PanelScrollAreaCorner: {
@@ -3370,7 +3145,6 @@ void QMacStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, QPai
QWindowsStyle::drawPrimitive(pe, opt, p, w);
break;
}
-
// Use the Leopard style only if the status bar is the status bar for a
// QMainWindow with a unifed toolbar.
if (w == 0 || w->parent() == 0 || qobject_cast<QMainWindow *>(w->parent()) == 0 ||
@@ -3514,16 +3288,16 @@ void QMacStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPainter
QIcon::Mode mode = QIcon::Disabled;
if (opt->state & State_Enabled)
mode = QIcon::Normal;
- QPixmap pixmap = header->icon.pixmap(pixelMetric(PM_SmallIconSize), mode);
+ QPixmap pixmap = header->icon.pixmap(proxy()->pixelMetric(PM_SmallIconSize), mode);
QRect pixr = header->rect;
pixr.setY(header->rect.center().y() - (pixmap.height() - 1) / 2);
- drawItemPixmap(p, pixr, Qt::AlignVCenter, pixmap);
+ proxy()->drawItemPixmap(p, pixr, Qt::AlignVCenter, pixmap);
textr.translate(pixmap.width() + 2, 0);
}
- drawItemText(p, textr, header->textAlignment | Qt::AlignVCenter, header->palette,
- header->state & State_Enabled, header->text, QPalette::ButtonText);
+ proxy()->drawItemText(p, textr, header->textAlignment | Qt::AlignVCenter, header->palette,
+ header->state & State_Enabled, header->text, QPalette::ButtonText);
}
break;
case CE_ToolButtonLabel:
@@ -3534,58 +3308,89 @@ void QMacStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPainter
QRect cr = tb->rect;
int shiftX = 0;
int shiftY = 0;
- if (tb->state & (State_Sunken | State_On)) {
- shiftX = pixelMetric(PM_ButtonShiftHorizontal, tb, w);
- shiftY = pixelMetric(PM_ButtonShiftVertical, tb, w);
+ bool needText = false;
+ int alignment = 0;
+ bool down = tb->state & (State_Sunken | State_On);
+ if (down) {
+ shiftX = proxy()->pixelMetric(PM_ButtonShiftHorizontal, tb, w);
+ shiftY = proxy()->pixelMetric(PM_ButtonShiftVertical, tb, w);
}
// The down state is special for QToolButtons in a toolbar on the Mac
// The text is a bit bolder and gets a drop shadow and the icons are also darkened.
// This doesn't really fit into any particular case in QIcon, so we
// do the majority of the work ourselves.
- if (tb->state & State_Sunken
- && !(tb->features & QStyleOptionToolButton::Arrow)) {
+ if (!(tb->features & QStyleOptionToolButton::Arrow)) {
Qt::ToolButtonStyle tbstyle = tb->toolButtonStyle;
if (tb->icon.isNull() && !tb->text.isEmpty())
tbstyle = Qt::ToolButtonTextOnly;
switch (tbstyle) {
- case Qt::ToolButtonTextOnly:
- drawItemText(p, cr, Qt::AlignCenter, tb->palette,
- tb->state & State_Enabled, tb->text);
- break;
+ case Qt::ToolButtonTextOnly: {
+ needText = true;
+ alignment = Qt::AlignCenter;
+ break; }
case Qt::ToolButtonIconOnly:
case Qt::ToolButtonTextBesideIcon:
case Qt::ToolButtonTextUnderIcon: {
QRect pr = cr;
QIcon::Mode iconMode = (tb->state & State_Enabled) ? QIcon::Normal
- : QIcon::Disabled;
+ : QIcon::Disabled;
QIcon::State iconState = (tb->state & State_On) ? QIcon::On
- : QIcon::Off;
+ : QIcon::Off;
QPixmap pixmap = tb->icon.pixmap(tb->rect.size().boundedTo(tb->iconSize), iconMode, iconState);
// Draw the text if it's needed.
if (tb->toolButtonStyle != Qt::ToolButtonIconOnly) {
- int alignment = 0;
+ needText = true;
if (tb->toolButtonStyle == Qt::ToolButtonTextUnderIcon) {
- pr.setHeight(pixmap.size().height() + 6);
- cr.adjust(0, pr.bottom(), 0, -3);
+ pr.setHeight(pixmap.size().height());
+ cr.adjust(0, pr.bottom() + 1, 0, 1);
alignment |= Qt::AlignCenter;
} else {
pr.setWidth(pixmap.width() + 8);
cr.adjust(pr.right(), 0, 0, 0);
alignment |= Qt::AlignLeft | Qt::AlignVCenter;
}
- cr.translate(shiftX, shiftY);
- drawItemText(p, cr, alignment, tb->palette,
- tb->state & State_Enabled, tb->text);
- cr.adjust(0, 3, 0, -3); // the drop shadow
- drawItemText(p, cr, alignment, tb->palette,
- tb->state & State_Enabled, tb->text);
}
- pr.translate(shiftX, shiftY);
- pixmap = darkenPixmap(pixmap);
- drawItemPixmap(p, pr, Qt::AlignCenter, pixmap);
+ if (opt->state & State_Sunken) {
+ pr.translate(shiftX, shiftY);
+ pixmap = darkenPixmap(pixmap);
+ }
+ proxy()->drawItemPixmap(p, pr, Qt::AlignCenter, pixmap);
break; }
+ default:
+ Q_ASSERT(false);
+ break;
+ }
+
+ if (needText) {
+ QPalette pal = tb->palette;
+ QPalette::ColorRole role = QPalette::NoRole;
+ if (down)
+ cr.translate(shiftX, shiftY);
+ if (QSysInfo::MacintoshVersion >= QSysInfo::MV_10_5
+ && (tbstyle == Qt::ToolButtonTextOnly
+ || (tbstyle != Qt::ToolButtonTextOnly && !down))) {
+ QPen pen = p->pen();
+ QColor light = down ? Qt::black : Qt::white;
+ light.setAlphaF(0.375f);
+ p->setPen(light);
+ p->drawText(cr.adjusted(0, 1, 0, 1), alignment, tb->text);
+ p->setPen(pen);
+ if (down && tbstyle == Qt::ToolButtonTextOnly) {
+ pal = QApplication::palette("QMenu");
+ pal.setCurrentColorGroup(tb->palette.currentColorGroup());
+ role = QPalette::HighlightedText;
+ }
+ }
+ drawItemText(p, cr, alignment, pal,
+ tb->state & State_Enabled, tb->text, role);
+ if (QSysInfo::MacintoshVersion < QSysInfo::MV_10_5 &&
+ (tb->state & State_Sunken)) {
+ // Draw a "drop shadow" in earlier versions.
+ drawItemText(p, cr.adjusted(0, 1, 0, 1), alignment,
+ tb->palette, tb->state & State_Enabled, tb->text);
+ }
}
} else {
QWindowsStyle::drawControl(ce, &myTb, p, w);
@@ -3635,7 +3440,7 @@ void QMacStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPainter
HIThemeDrawButton(&newRect, &bdi, cg, kHIThemeOrientationNormal, 0);
if (btn->features & QStyleOptionButton::HasMenu) {
- int mbi = pixelMetric(QStyle::PM_MenuButtonIndicator, btn, w);
+ int mbi = proxy()->pixelMetric(QStyle::PM_MenuButtonIndicator, btn, w);
QRect ir = btn->rect;
HIRect arrowRect = CGRectMake(ir.right() - mbi - PushButtonRightOffset,
ir.height() / 2 - 4, mbi, ir.height() / 2);
@@ -3722,7 +3527,7 @@ void QMacStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPainter
if (hasIcon) {
int contentW = textRect.width();
if (hasMenu)
- contentW += pixelMetric(PM_MenuButtonIndicator) + 4;
+ contentW += proxy()->pixelMetric(PM_MenuButtonIndicator) + 4;
QIcon::Mode mode = btn->state & State_Enabled ? QIcon::Normal : QIcon::Disabled;
if (mode == QIcon::Normal && btn->state & State_HasFocus)
mode = QIcon::Active;
@@ -3736,7 +3541,7 @@ void QMacStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPainter
int iconTopOffset = freeContentRect.y() + (freeContentRect.height() - pixmap.height()) / 2;
QRect iconDestRect(iconLeftOffset, iconTopOffset, pixmap.width(), pixmap.height());
QRect visualIconDestRect = visualRect(btn->direction, freeContentRect, iconDestRect);
- drawItemPixmap(p, visualIconDestRect, Qt::AlignLeft | Qt::AlignVCenter, pixmap);
+ proxy()->drawItemPixmap(p, visualIconDestRect, Qt::AlignLeft | Qt::AlignVCenter, pixmap);
int newOffset = iconDestRect.x() + iconDestRect.width()
+ PushButtonContentPadding - textRect.x();
textRect.adjust(newOffset, 0, newOffset, 0);
@@ -3744,8 +3549,8 @@ void QMacStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPainter
// Draw the text:
if (hasText) {
textRect = visualRect(btn->direction, freeContentRect, textRect);
- drawItemText(p, textRect, Qt::AlignLeft | Qt::AlignVCenter | Qt::TextShowMnemonic, btn->palette,
- (btn->state & State_Enabled), btn->text, QPalette::ButtonText);
+ proxy()->drawItemText(p, textRect, Qt::AlignLeft | Qt::AlignVCenter | Qt::TextShowMnemonic, btn->palette,
+ (btn->state & State_Enabled), btn->text, QPalette::ButtonText);
}
}
}
@@ -3770,104 +3575,104 @@ void QMacStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPainter
return;
}
}
-
-#if (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4)
- if (QSysInfo::MacintoshVersion > QSysInfo::MV_10_3) {
- HIThemeTabDrawInfo tdi;
- tdi.version = 1;
- tdi.style = kThemeTabNonFront;
- tdi.direction = getTabDirection(tabOpt->shape);
- switch (d->aquaSizeConstrain(opt, w)) {
- default:
- case QAquaSizeUnknown:
- case QAquaSizeLarge:
- tdi.size = kHIThemeTabSizeNormal;
- break;
- case QAquaSizeSmall:
- tdi.size = kHIThemeTabSizeSmall;
+ HIThemeTabDrawInfo tdi;
+ tdi.version = 1;
+ tdi.style = kThemeTabNonFront;
+ tdi.direction = getTabDirection(tabOpt->shape);
+ switch (d->aquaSizeConstrain(opt, w)) {
+ default:
+ case QAquaSizeUnknown:
+ case QAquaSizeLarge:
+ tdi.size = kHIThemeTabSizeNormal;
+ break;
+ case QAquaSizeSmall:
+ tdi.size = kHIThemeTabSizeSmall;
+ break;
+ case QAquaSizeMini:
+ tdi.size = kHIThemeTabSizeMini;
+ break;
+ }
+ bool verticalTabs = tdi.direction == kThemeTabWest || tdi.direction == kThemeTabEast;
+ QRect tabRect = tabOpt->rect;
+
+ bool selected = tabOpt->state & State_Selected;
+ if (selected) {
+ if (!(tabOpt->state & State_Active))
+ tdi.style = kThemeTabFrontUnavailable;
+ else if (!(tabOpt->state & State_Enabled))
+ tdi.style = kThemeTabFrontInactive;
+ else
+ tdi.style = kThemeTabFront;
+ } else if (!(tabOpt->state & State_Active)) {
+ tdi.style = kThemeTabNonFrontUnavailable;
+ } else if (!(tabOpt->state & State_Enabled)) {
+ tdi.style = kThemeTabNonFrontInactive;
+ } else if (tabOpt->state & State_Sunken) {
+ tdi.style = kThemeTabFrontInactive; // (should be kThemeTabNonFrontPressed)
+ }
+ if (tabOpt->state & State_HasFocus)
+ tdi.adornment = kHIThemeTabAdornmentFocus;
+ else
+ tdi.adornment = kHIThemeTabAdornmentNone;
+ tdi.kind = kHIThemeTabKindNormal;
+ if (!verticalTabs)
+ tabRect.setY(tabRect.y() - 1);
+ else
+ tabRect.setX(tabRect.x() - 1);
+ QStyleOptionTab::TabPosition tp = tabOpt->position;
+ QStyleOptionTab::SelectedPosition sp = tabOpt->selectedPosition;
+ if (tabOpt->direction == Qt::RightToLeft && !verticalTabs) {
+ if (sp == QStyleOptionTab::NextIsSelected)
+ sp = QStyleOptionTab::PreviousIsSelected;
+ else if (sp == QStyleOptionTab::PreviousIsSelected)
+ sp = QStyleOptionTab::NextIsSelected;
+ switch (tp) {
+ case QStyleOptionTab::Beginning:
+ tp = QStyleOptionTab::End;
break;
- case QAquaSizeMini:
- tdi.size = kHIThemeTabSizeMini;
+ case QStyleOptionTab::End:
+ tp = QStyleOptionTab::Beginning;
break;
- }
- bool verticalTabs = tdi.direction == kThemeTabWest || tdi.direction == kThemeTabEast;
- QRect tabRect = tabOpt->rect;
-
- if ((!verticalTabs && tabRect.height() > 21 || verticalTabs && tabRect.width() > 21)) {
- d->drawPantherTab(tabOpt, p, w);
+ default:
break;
}
+ }
+ switch (tp) {
+ case QStyleOptionTab::Beginning:
+ tdi.position = kHIThemeTabPositionFirst;
+ if (sp != QStyleOptionTab::NextIsSelected)
+ tdi.adornment |= kHIThemeTabAdornmentTrailingSeparator;
+ break;
+ case QStyleOptionTab::Middle:
+ tdi.position = kHIThemeTabPositionMiddle;
+ if (selected)
+ tdi.adornment |= kHIThemeTabAdornmentLeadingSeparator;
+ if (sp != QStyleOptionTab::NextIsSelected) // Also when we're selected.
+ tdi.adornment |= kHIThemeTabAdornmentTrailingSeparator;
+ break;
+ case QStyleOptionTab::End:
+ tdi.position = kHIThemeTabPositionLast;
+ if (selected)
+ tdi.adornment |= kHIThemeTabAdornmentLeadingSeparator;
+ break;
+ case QStyleOptionTab::OnlyOneTab:
+ tdi.position = kHIThemeTabPositionOnly;
+ break;
+ }
- bool selected = tabOpt->state & State_Selected;
- if (selected) {
- if (!(tabOpt->state & State_Active))
- tdi.style = kThemeTabFrontUnavailable;
- else if (!(tabOpt->state & State_Enabled))
- tdi.style = kThemeTabFrontInactive;
- else
- tdi.style = kThemeTabFront;
- } else if (!(tabOpt->state & State_Active)) {
- tdi.style = kThemeTabNonFrontUnavailable;
- } else if (!(tabOpt->state & State_Enabled)) {
- tdi.style = kThemeTabNonFrontInactive;
- } else if (tabOpt->state & State_Sunken) {
- tdi.style = kThemeTabFrontInactive; // (should be kThemeTabNonFrontPressed)
- }
- if (tabOpt->state & State_HasFocus)
- tdi.adornment = kHIThemeTabAdornmentFocus;
- else
- tdi.adornment = kHIThemeTabAdornmentNone;
- tdi.kind = kHIThemeTabKindNormal;
- if (!verticalTabs)
- tabRect.setY(tabRect.y() - 1);
- else
- tabRect.setX(tabRect.x() - 1);
- QStyleOptionTab::TabPosition tp = tabOpt->position;
- QStyleOptionTab::SelectedPosition sp = tabOpt->selectedPosition;
- if (tabOpt->direction == Qt::RightToLeft && !verticalTabs) {
- if (sp == QStyleOptionTab::NextIsSelected)
- sp = QStyleOptionTab::PreviousIsSelected;
- else if (sp == QStyleOptionTab::PreviousIsSelected)
- sp = QStyleOptionTab::NextIsSelected;
- switch (tp) {
- case QStyleOptionTab::Beginning:
- tp = QStyleOptionTab::End;
- break;
- case QStyleOptionTab::End:
- tp = QStyleOptionTab::Beginning;
- break;
- default:
- break;
- }
- }
- switch (tp) {
- case QStyleOptionTab::Beginning:
- tdi.position = kHIThemeTabPositionFirst;
- if (sp != QStyleOptionTab::NextIsSelected)
- tdi.adornment |= kHIThemeTabAdornmentTrailingSeparator;
- break;
- case QStyleOptionTab::Middle:
- tdi.position = kHIThemeTabPositionMiddle;
- if (selected)
- tdi.adornment |= kHIThemeTabAdornmentLeadingSeparator;
- if (sp != QStyleOptionTab::NextIsSelected) // Also when we're selected.
- tdi.adornment |= kHIThemeTabAdornmentTrailingSeparator;
- break;
- case QStyleOptionTab::End:
- tdi.position = kHIThemeTabPositionLast;
- if (selected)
- tdi.adornment |= kHIThemeTabAdornmentLeadingSeparator;
- break;
- case QStyleOptionTab::OnlyOneTab:
- tdi.position = kHIThemeTabPositionOnly;
- break;
+ // HITheme doesn't stretch its tabs. Therefore we have to cheat and do the job ourselves.
+ if ((!verticalTabs && tabRect.height() > 21 || verticalTabs && tabRect.width() > 21)) {
+ HIRect hirect = CGRectMake(0, 0, 23, 23);
+ QPixmap pm(23, 23);
+ pm.fill(Qt::transparent);
+ {
+ QMacCGContext pmcg(&pm);
+ HIThemeDrawTab(&hirect, &tdi, pmcg, kHIThemeOrientationNormal, 0);
}
+ QStyleHelper::drawBorderPixmap(pm, p, tabRect, 7, 7, 7, 7);
+ } else {
HIRect hirect = qt_hirectForQRect(tabRect);
HIThemeDrawTab(&hirect, &tdi, cg, kHIThemeOrientationNormal, 0);
- } else
-#endif
- {
- d->drawPantherTab(tabOpt, p, w);
}
}
break;
@@ -3902,7 +3707,8 @@ void QMacStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPainter
QRect nr = subElementRect(SE_TabBarTabText, opt, w);
nr.moveTop(+1);
int alignment = Qt::AlignCenter | Qt::TextShowMnemonic | Qt::TextHideMnemonic;
- drawItemText(p, nr, alignment, np, tab->state & State_Enabled, tab->text, QPalette::WindowText);
+ proxy()->drawItemText(p, nr, alignment, np, tab->state & State_Enabled,
+ tab->text, QPalette::WindowText);
p->restore();
}
@@ -4025,8 +3831,8 @@ void QMacStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPainter
}
break;
case CE_FocusFrame: {
- int xOff = pixelMetric(PM_FocusFrameHMargin, opt, w) + 1;
- int yOff = pixelMetric(PM_FocusFrameVMargin, opt, w) + 1;
+ int xOff = proxy()->pixelMetric(PM_FocusFrameHMargin, opt, w) + 1;
+ int yOff = proxy()->pixelMetric(PM_FocusFrameVMargin, opt, w) + 1;
HIRect hirect = CGRectMake(xOff+opt->rect.x(), yOff+opt->rect.y(), opt->rect.width() - 2 * xOff,
opt->rect.height() - 2 * yOff);
HIThemeDrawFocusRect(&hirect, true, QMacCGContext(p), kHIThemeOrientationNormal);
@@ -4149,7 +3955,7 @@ void QMacStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPainter
QIcon::Mode mode = (mi->state & State_Enabled) ? QIcon::Normal
: QIcon::Disabled;
// Always be normal or disabled to follow the Mac style.
- int smallIconSize = pixelMetric(PM_SmallIconSize);
+ int smallIconSize = proxy()->pixelMetric(PM_SmallIconSize);
QSize iconSize(smallIconSize, smallIconSize);
if (const QComboBox *comboBox = qobject_cast<const QComboBox *>(w)) {
iconSize = comboBox->iconSize();
@@ -4184,8 +3990,12 @@ void QMacStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPainter
const int xm = macItemFrame + maxpmw + macItemHMargin;
QFont myFont = mi->font;
- if (mi->state & QStyle::State_Mini)
- myFont.setPointSize(mi->font.pointSize());
+ // myFont may not have any "hard" flags set. We override
+ // the point size so that when it is resolved against the device, this font will win.
+ // This is mainly to handle cases where someone sets the font on the window
+ // and then the combo inherits it and passes it onward. At that point the resolve mask
+ // is very, very weak. This makes it stonger.
+ myFont.setPointSizeF(mi->font.pointSizeF());
p->setFont(myFont);
p->drawText(xpos, yPos, contentRect.width() - xm - tabwidth + 1,
contentRect.height(), text_flags ^ Qt::AlignRight, s);
@@ -4259,7 +4069,7 @@ void QMacStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPainter
drawItemPixmap(p, mi->rect,
Qt::AlignCenter | Qt::TextHideMnemonic | Qt::TextDontClip
| Qt::TextSingleLine,
- mi->icon.pixmap(pixelMetric(PM_SmallIconSize),
+ mi->icon.pixmap(proxy()->pixelMetric(PM_SmallIconSize),
(mi->state & State_Enabled) ? QIcon::Normal : QIcon::Disabled));
} else {
drawItemText(p, mi->rect,
@@ -4319,7 +4129,19 @@ void QMacStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPainter
tdi.enableState = kThemeTrackDisabled;
else
tdi.enableState = kThemeTrackActive;
- HIThemeDrawTrack(&tdi, 0, cg, kHIThemeOrientationNormal);
+ HIThemeOrientation drawOrientation = kHIThemeOrientationNormal;
+ if (reverse) {
+ if (vertical) {
+ drawOrientation = kHIThemeOrientationInverted;
+ } else {
+ CGContextSaveGState(cg);
+ CGContextTranslateCTM(cg, pb->rect.width(), 0);
+ CGContextScaleCTM(cg, -1, 1);
+ }
+ }
+ HIThemeDrawTrack(&tdi, 0, cg, drawOrientation);
+ if (reverse && !vertical)
+ CGContextRestoreGState(cg);
}
break;
case CE_ProgressBarLabel:
@@ -4407,9 +4229,10 @@ void QMacStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPainter
case CE_ToolBar: {
// For unified tool bars, draw nothing.
if (w) {
- if (QMainWindow * mainWindow = qobject_cast<QMainWindow *>(w->window()))
+ if (QMainWindow * mainWindow = qobject_cast<QMainWindow *>(w->window())) {
if (mainWindow->unifiedTitleAndToolBarOnMac())
break;
+ }
}
// draw background gradient
@@ -4778,10 +4601,7 @@ void QMacStyle::drawComplexControl(ComplexControl cc, const QStyleOptionComplex
// similar when I have an upside down scroll bar
// because on Tiger I only "fake" the reverse stuff.
bool reverseHorizontal = (slider->direction == Qt::RightToLeft
- && slider->orientation == Qt::Horizontal
- && (!slider->upsideDown
- || (QSysInfo::MacintoshVersion >= QSysInfo::MV_10_4
- && slider->upsideDown)));
+ && slider->orientation == Qt::Horizontal);
if ((reverseHorizontal
&& slider->activeSubControls == SC_ScrollBarAddLine)
|| (!reverseHorizontal
@@ -4816,12 +4636,12 @@ void QMacStyle::drawComplexControl(ComplexControl cc, const QStyleOptionComplex
// no longer possible to move it, second the up/down buttons are removed when
// there is not enough space for them.
if (cc == CC_ScrollBar) {
- const int scrollBarLenght = (slider->orientation == Qt::Horizontal)
+ const int scrollBarLength = (slider->orientation == Qt::Horizontal)
? slider->rect.width() : slider->rect.height();
const QMacStyle::WidgetSizePolicy sizePolicy = widgetSizePolicy(widget);
- if (scrollBarLenght < scrollButtonsCutoffSize(thumbIndicatorCutoff, sizePolicy))
+ if (scrollBarLength < scrollButtonsCutoffSize(thumbIndicatorCutoff, sizePolicy))
tdi.attributes &= ~kThemeTrackShowThumb;
- if (scrollBarLenght < scrollButtonsCutoffSize(scrollButtonsCutoff, sizePolicy))
+ if (scrollBarLength < scrollButtonsCutoffSize(scrollButtonsCutoff, sizePolicy))
tdi.enableState = kThemeTrackNothingToScroll;
}
@@ -4883,7 +4703,7 @@ void QMacStyle::drawComplexControl(ComplexControl cc, const QStyleOptionComplex
treeOpt.state |= State_Children;
if (item.state & State_Open)
treeOpt.state |= State_Open;
- drawPrimitive(PE_IndicatorBranch, &treeOpt, p, widget);
+ proxy()->drawPrimitive(PE_IndicatorBranch, &treeOpt, p, widget);
}
y += item.totalHeight;
}
@@ -4897,7 +4717,7 @@ void QMacStyle::drawComplexControl(ComplexControl cc, const QStyleOptionComplex
SInt32 frame_size;
GetThemeMetric(kThemeMetricEditTextFrameOutset, &frame_size);
- QRect lineeditRect = subControlRect(CC_SpinBox, sb, SC_SpinBoxEditField, widget);
+ QRect lineeditRect = proxy()->subControlRect(CC_SpinBox, sb, SC_SpinBoxEditField, widget);
lineeditRect.adjust(-frame_size, -frame_size, +frame_size, +frame_size);
HIThemeFrameDrawInfo fdi;
@@ -4941,9 +4761,9 @@ void QMacStyle::drawComplexControl(ComplexControl cc, const QStyleOptionComplex
bdi.value = kThemeButtonOff;
bdi.adornment = kThemeAdornmentNone;
- QRect updown = subControlRect(CC_SpinBox, sb, SC_SpinBoxUp, widget);
+ QRect updown = proxy()->subControlRect(CC_SpinBox, sb, SC_SpinBoxUp, widget);
- updown |= subControlRect(CC_SpinBox, sb, SC_SpinBoxDown, widget);
+ updown |= proxy()->subControlRect(CC_SpinBox, sb, SC_SpinBoxDown, widget);
HIRect newRect = qt_hirectForQRect(updown);
QRect off_rct;
HIRect outRect;
@@ -4964,9 +4784,9 @@ void QMacStyle::drawComplexControl(ComplexControl cc, const QStyleOptionComplex
d->initComboboxBdi(combo, &bdi, widget, d->getDrawState(opt->state));
bool drawColorless = combo->palette.currentColorGroup() == QPalette::Active && tds == kThemeStateInactive;
if (!drawColorless)
- QMacStylePrivate::drawCombobox(combo->rect, bdi, p);
+ QMacStylePrivate::drawCombobox(qt_hirectForQRect(combo->rect), bdi, p);
else
- d->drawColorlessButton(combo->rect, &bdi, p, opt);
+ d->drawColorlessButton(qt_hirectForQRect(combo->rect), &bdi, p, opt);
}
break;
case CC_TitleBar:
@@ -5056,7 +4876,7 @@ void QMacStyle::drawComplexControl(ComplexControl cc, const QStyleOptionComplex
&titleRegion2);
ptrHIShapeGetBounds(titleRegion2, &tmpRect);
if (tmpRect.size.width != 1) {
- int iconExtent = pixelMetric(PM_SmallIconSize);
+ int iconExtent = proxy()->pixelMetric(PM_SmallIconSize);
iw = titlebar->icon.actualSize(QSize(iconExtent, iconExtent)).width();
}
}
@@ -5074,7 +4894,8 @@ void QMacStyle::drawComplexControl(ComplexControl cc, const QStyleOptionComplex
else
x += br.width() / 2 - p->fontMetrics().width(titlebar->text) / 2;
if (iw)
- p->drawPixmap(x - iw, y, titlebar->icon.pixmap(pixelMetric(PM_SmallIconSize), QIcon::Normal));
+ p->drawPixmap(x - iw, y,
+ titlebar->icon.pixmap(proxy()->pixelMetric(PM_SmallIconSize), QIcon::Normal));
drawItemText(p, br, Qt::AlignCenter, opt->palette, tds == kThemeStateActive,
titlebar->text, QPalette::Text);
p->restore();
@@ -5111,7 +4932,7 @@ void QMacStyle::drawComplexControl(ComplexControl cc, const QStyleOptionComplex
tti.truncationPosition = kHIThemeTextTruncationNone;
tti.truncationMaxLines = 1 + groupBox->text.count(QLatin1Char('\n'));
QCFString groupText = qt_mac_removeMnemonics(groupBox->text);
- QRect r = subControlRect(CC_GroupBox, groupBox, SC_GroupBoxLabel, widget);
+ QRect r = proxy()->subControlRect(CC_GroupBox, groupBox, SC_GroupBoxLabel, widget);
HIRect bounds = qt_hirectForQRect(r);
HIThemeDrawTextBox(groupText, &bounds, &tti, cg, kHIThemeOrientationNormal);
p->restore();
@@ -5124,29 +4945,35 @@ void QMacStyle::drawComplexControl(ComplexControl cc, const QStyleOptionComplex
if (widget && qobject_cast<QToolBar *>(widget->parentWidget())) {
if (tb->subControls & SC_ToolButtonMenu) {
QStyleOption arrowOpt(0);
- arrowOpt.rect = subControlRect(cc, tb, SC_ToolButtonMenu, widget);
+ arrowOpt.rect = proxy()->subControlRect(cc, tb, SC_ToolButtonMenu, widget);
arrowOpt.rect.setY(arrowOpt.rect.y() + arrowOpt.rect.height() / 2);
arrowOpt.rect.setHeight(arrowOpt.rect.height() / 2);
arrowOpt.state = tb->state;
arrowOpt.palette = tb->palette;
- drawPrimitive(PE_IndicatorArrowDown, &arrowOpt, p, widget);
+ proxy()->drawPrimitive(PE_IndicatorArrowDown, &arrowOpt, p, widget);
} else if ((tb->features & QStyleOptionToolButton::HasMenu)
&& (tb->toolButtonStyle != Qt::ToolButtonTextOnly && !tb->icon.isNull())) {
drawToolbarButtonArrow(tb->rect, tds, cg);
}
if (tb->state & State_On) {
- QPen oldPen = p->pen();
- p->setPen(QColor(0, 0, 0, 0x3a));
- p->fillRect(tb->rect.adjusted(1, 1, -1, -1), QColor(0, 0, 0, 0x12));
- p->drawLine(tb->rect.left() + 1, tb->rect.top(),
- tb->rect.right() - 1, tb->rect.top());
- p->drawLine(tb->rect.left() + 1, tb->rect.bottom(),
- tb->rect.right() - 1, tb->rect.bottom());
- p->drawLine(tb->rect.topLeft(), tb->rect.bottomLeft());
- p->drawLine(tb->rect.topRight(), tb->rect.bottomRight());
- p->setPen(oldPen);
+ if (QSysInfo::MacintoshVersion >= QSysInfo::MV_10_5) {
+ static QPixmap pm(QLatin1String(":/trolltech/mac/style/images/leopard-unified-toolbar-on.png"));
+ p->setRenderHint(QPainter::SmoothPixmapTransform);
+ QStyleHelper::drawBorderPixmap(pm, p, tb->rect, 2, 2, 2, 2);
+ } else {
+ QPen oldPen = p->pen();
+ p->setPen(QColor(0, 0, 0, 0x3a));
+ p->fillRect(tb->rect.adjusted(1, 1, -1, -1), QColor(0, 0, 0, 0x12));
+ p->drawLine(tb->rect.left() + 1, tb->rect.top(),
+ tb->rect.right() - 1, tb->rect.top());
+ p->drawLine(tb->rect.left() + 1, tb->rect.bottom(),
+ tb->rect.right() - 1, tb->rect.bottom());
+ p->drawLine(tb->rect.topLeft(), tb->rect.bottomLeft());
+ p->drawLine(tb->rect.topRight(), tb->rect.bottomRight());
+ p->setPen(oldPen);
+ }
}
- drawControl(CE_ToolButtonLabel, opt, p, widget);
+ proxy()->drawControl(CE_ToolButtonLabel, opt, p, widget);
} else {
ThemeButtonKind bkind = kThemeBevelButton;
switch (d->aquaSizeConstrain(opt, widget)) {
@@ -5155,20 +4982,14 @@ void QMacStyle::drawComplexControl(ComplexControl cc, const QStyleOptionComplex
bkind = kThemeBevelButton;
break;
case QAquaSizeMini:
-#if (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_3) && 0
- if (QSysInfo::MacintoshVersion >= QSysInfo::MV_10_3) {
- bkind = kThemeMiniBevelButton;
- break;
- }
-#endif
case QAquaSizeSmall:
bkind = kThemeSmallBevelButton;
break;
}
QRect button, menuarea;
- button = subControlRect(cc, tb, SC_ToolButton, widget);
- menuarea = subControlRect(cc, tb, SC_ToolButtonMenu, widget);
+ button = proxy()->subControlRect(cc, tb, SC_ToolButton, widget);
+ menuarea = proxy()->subControlRect(cc, tb, SC_ToolButtonMenu, widget);
State bflags = tb->state,
mflags = tb->state;
if (tb->subControls & SC_ToolButton)
@@ -5231,14 +5052,18 @@ void QMacStyle::drawComplexControl(ComplexControl cc, const QStyleOptionComplex
} else if (tb->features & QStyleOptionToolButton::HasMenu) {
drawToolbarButtonArrow(tb->rect, tds, cg);
}
- QRect buttonRect = subControlRect(CC_ToolButton, tb, SC_ToolButton, widget);
- int fw = pixelMetric(PM_DefaultFrameWidth, opt, widget);
+ QRect buttonRect = proxy()->subControlRect(CC_ToolButton, tb, SC_ToolButton, widget);
+ int fw = proxy()->pixelMetric(PM_DefaultFrameWidth, opt, widget);
QStyleOptionToolButton label = *tb;
label.rect = buttonRect.adjusted(fw, fw, -fw, -fw);
- drawControl(CE_ToolButtonLabel, &label, p, widget);
+ proxy()->drawControl(CE_ToolButtonLabel, &label, p, widget);
}
}
break;
+ case CC_Dial:
+ if (const QStyleOptionSlider *dial = qstyleoption_cast<const QStyleOptionSlider *>(opt))
+ QStyleHelper::drawDial(dial, p);
+ break;
default:
QWindowsStyle::drawComplexControl(cc, opt, p, widget);
break;
@@ -5254,6 +5079,8 @@ QStyle::SubControl QMacStyle::hitTestComplexControl(ComplexControl cc,
case CC_ComboBox:
if (const QStyleOptionComboBox *cmb = qstyleoption_cast<const QStyleOptionComboBox *>(opt)) {
sc = QWindowsStyle::hitTestComplexControl(cc, cmb, pt, widget);
+ if (!cmb->editable && sc != QStyle::SC_None)
+ sc = SC_ComboBoxArrow; // A bit of a lie, but what we want
}
break;
case CC_Slider:
@@ -5283,9 +5110,9 @@ QStyle::SubControl QMacStyle::hitTestComplexControl(ComplexControl cc,
// The arrow buttons are not drawn if the scroll bar is to short,
// exclude them from the hit test.
- const int scrollBarLenght = (sb->orientation == Qt::Horizontal)
+ const int scrollBarLength = (sb->orientation == Qt::Horizontal)
? sb->rect.width() : sb->rect.height();
- if (scrollBarLenght < scrollButtonsCutoffSize(scrollButtonsCutoff, widgetSizePolicy(widget)))
+ if (scrollBarLength < scrollButtonsCutoffSize(scrollButtonsCutoff, widgetSizePolicy(widget)))
sbi.enableState = kThemeTrackNothingToScroll;
sbi.viewsize = sb->pageStep;
@@ -5403,11 +5230,7 @@ QRect QMacStyle::subControlRect(ComplexControl cc, const QStyleOptionComplex *op
cpc = sc == SC_ScrollBarSubLine ? kControlUpButtonPart
: kControlDownButtonPart;
if (slider->direction == Qt::RightToLeft
- && slider->orientation == Qt::Horizontal
- && (!slider->upsideDown
- || (QSysInfo::MacintoshVersion >= QSysInfo::MV_10_4
- && slider->upsideDown))
- ) {
+ && slider->orientation == Qt::Horizontal) {
if (cpc == kControlDownButtonPart)
cpc = kControlUpButtonPart;
else if (cpc == kControlUpButtonPart)
@@ -5460,7 +5283,7 @@ QRect QMacStyle::subControlRect(ComplexControl cc, const QStyleOptionComplex *op
else if (sc == SC_TitleBarLabel)
wrc = kWindowTitleTextRgn;
else if (sc == SC_TitleBarSysMenu)
- ret.setRect(-1024, -1024, 10, pixelMetric(PM_TitleBarHeight,
+ ret.setRect(-1024, -1024, 10, proxy()->pixelMetric(PM_TitleBarHeight,
titlebar, widget));
if (wrc != kWindowGlobalPortRgn) {
QCFType<HIShapeRef> region;
@@ -5564,7 +5387,7 @@ QRect QMacStyle::subControlRect(ComplexControl cc, const QStyleOptionComplex *op
QRect labelRect = alignedRect(groupBox->direction, groupBox->textAlignment,
QSize(tw, h), ret);
- int indicatorWidth = pixelMetric(PM_IndicatorWidth, opt, widget);
+ int indicatorWidth = proxy()->pixelMetric(PM_IndicatorWidth, opt, widget);
bool rtl = groupBox->direction == Qt::RightToLeft;
if (sc == SC_GroupBoxLabel) {
if (checkable) {
@@ -5586,7 +5409,7 @@ QRect QMacStyle::subControlRect(ComplexControl cc, const QStyleOptionComplex *op
if (sc == SC_GroupBoxCheckBox) {
int left = rtl ? labelRect.right() - indicatorWidth : labelRect.left();
ret.setRect(left, ret.top(),
- indicatorWidth, pixelMetric(PM_IndicatorHeight, opt, widget));
+ indicatorWidth, proxy()->pixelMetric(PM_IndicatorHeight, opt, widget));
}
break;
}
@@ -5624,7 +5447,7 @@ QRect QMacStyle::subControlRect(ComplexControl cc, const QStyleOptionComplex *op
QAquaWidgetSize aquaSize = d->aquaSizeConstrain(spin, widget);
int spinner_w;
int spinBoxSep;
- int fw = pixelMetric(PM_SpinBoxFrameWidth, spin, widget);
+ int fw = proxy()->pixelMetric(PM_SpinBoxFrameWidth, spin, widget);
switch (aquaSize) {
default:
case QAquaSizeUnknown:
@@ -5701,7 +5524,7 @@ QRect QMacStyle::subControlRect(ComplexControl cc, const QStyleOptionComplex *op
spin->rect.height() - fw * 2);
} else {
ret.setRect(fw, fw,
- spin->rect.width() - spinner_w - fw * 2 - spinBoxSep,
+ spin->rect.width() - fw * 2 - spinBoxSep - spinner_w,
spin->rect.height() - fw * 2);
}
ret = visualRect(spin->direction, spin->rect, ret);
@@ -5738,11 +5561,6 @@ QSize QMacStyle::sizeFromContents(ContentsType ct, const QStyleOption *opt,
break;
case QStyle::CT_TabBarTab:
if (const QStyleOptionTabV3 *tab = qstyleoption_cast<const QStyleOptionTabV3 *>(opt)) {
- bool newStyleTabs =
-#if (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4)
- QSysInfo::MacintoshVersion >= QSysInfo::MV_10_4 ? true :
-#endif
- false;
const QAquaWidgetSize AquaSize = d->aquaSizeConstrain(opt, widget);
const bool differentFont = (widget && widget->testAttribute(Qt::WA_SetFont))
|| !QApplication::desktopSettingsAware();
@@ -5750,86 +5568,61 @@ QSize QMacStyle::sizeFromContents(ContentsType ct, const QStyleOption *opt,
bool vertTabs = ttd == kThemeTabWest || ttd == kThemeTabEast;
if (vertTabs)
sz.transpose();
- if (newStyleTabs) {
- int defaultTabHeight;
- int defaultExtraSpace = pixelMetric(PM_TabBarTabHSpace, tab, widget); // Remove spurious gcc warning (AFAIK)
- QFontMetrics fm = opt->fontMetrics;
- switch (AquaSize) {
- case QAquaSizeUnknown:
- case QAquaSizeLarge:
- if (tab->documentMode)
- defaultTabHeight = 23;
- else
- defaultTabHeight = 21;
- break;
- case QAquaSizeSmall:
- defaultTabHeight = 18;
- break;
- case QAquaSizeMini:
- defaultTabHeight = 16;
- break;
- }
-
- bool setWidth = false;
- if (differentFont || !tab->icon.isNull()) {
- sz.rheight() = qMax(defaultTabHeight, sz.height());
- } else {
- QSize textSize = fm.size(Qt::TextShowMnemonic, tab->text);
- sz.rheight() = qMax(defaultTabHeight, textSize.height());
- sz.rwidth() = textSize.width() + defaultExtraSpace;
- setWidth = true;
- }
+ int defaultTabHeight;
+ int defaultExtraSpace = proxy()->pixelMetric(PM_TabBarTabHSpace, tab, widget); // Remove spurious gcc warning (AFAIK)
+ QFontMetrics fm = opt->fontMetrics;
+ switch (AquaSize) {
+ case QAquaSizeUnknown:
+ case QAquaSizeLarge:
+ if (tab->documentMode)
+ defaultTabHeight = 23;
+ else
+ defaultTabHeight = 21;
+ break;
+ case QAquaSizeSmall:
+ defaultTabHeight = 18;
+ break;
+ case QAquaSizeMini:
+ defaultTabHeight = 16;
+ break;
+ }
+ bool setWidth = false;
+ if (differentFont || !tab->icon.isNull()) {
+ sz.rheight() = qMax(defaultTabHeight, sz.height());
+ } else {
+ QSize textSize = fm.size(Qt::TextShowMnemonic, tab->text);
+ sz.rheight() = qMax(defaultTabHeight, textSize.height());
+ sz.rwidth() = textSize.width() + defaultExtraSpace;
+ setWidth = true;
+ }
- if (vertTabs)
- sz.transpose();
+ if (vertTabs)
+ sz.transpose();
- int maxWidgetHeight = qMax(tab->leftButtonSize.height(), tab->rightButtonSize.height());
- int maxWidgetWidth = qMax(tab->leftButtonSize.width(), tab->rightButtonSize.width());
+ int maxWidgetHeight = qMax(tab->leftButtonSize.height(), tab->rightButtonSize.height());
+ int maxWidgetWidth = qMax(tab->leftButtonSize.width(), tab->rightButtonSize.width());
- int widgetWidth = 0;
- int widgetHeight = 0;
- int padding = 0;
- if (tab->leftButtonSize.isValid()) {
- padding += 8;
- widgetWidth += tab->leftButtonSize.width();
- widgetHeight += tab->leftButtonSize.height();
- }
- if (tab->rightButtonSize.isValid()) {
- padding += 8;
- widgetWidth += tab->rightButtonSize.width();
- widgetHeight += tab->rightButtonSize.height();
- }
+ int widgetWidth = 0;
+ int widgetHeight = 0;
+ int padding = 0;
+ if (tab->leftButtonSize.isValid()) {
+ padding += 8;
+ widgetWidth += tab->leftButtonSize.width();
+ widgetHeight += tab->leftButtonSize.height();
+ }
+ if (tab->rightButtonSize.isValid()) {
+ padding += 8;
+ widgetWidth += tab->rightButtonSize.width();
+ widgetHeight += tab->rightButtonSize.height();
+ }
- if (vertTabs) {
- sz.setHeight(sz.height() + widgetHeight + padding);
- sz.setWidth(qMax(sz.width(), maxWidgetWidth));
- } else {
- if (setWidth)
- sz.setWidth(sz.width() + widgetWidth + padding);
- sz.setHeight(qMax(sz.height(), maxWidgetHeight));
- }
+ if (vertTabs) {
+ sz.setHeight(sz.height() + widgetHeight + padding);
+ sz.setWidth(qMax(sz.width(), maxWidgetWidth));
} else {
- SInt32 tabh = sz.height();
- SInt32 overlap = 0;
- switch (AquaSize) {
- default:
- case QAquaSizeUnknown:
- case QAquaSizeLarge:
- GetThemeMetric(kThemeLargeTabHeight, &tabh);
- GetThemeMetric(kThemeMetricTabFrameOverlap, &overlap);
- break;
- case QAquaSizeMini:
- GetThemeMetric(kThemeMetricMiniTabHeight, &tabh);
- GetThemeMetric(kThemeMetricMiniTabFrameOverlap, &overlap);
- break;
- case QAquaSizeSmall:
- GetThemeMetric(kThemeSmallTabHeight, &tabh);
- GetThemeMetric(kThemeMetricSmallTabFrameOverlap, &overlap);
- break;
- }
- tabh += overlap;
- if (sz.height() < tabh)
- sz.rheight() = tabh;
+ if (setWidth)
+ sz.setWidth(sz.width() + widgetWidth + padding);
+ sz.setHeight(qMax(sz.height(), maxWidgetHeight));
}
}
break;
@@ -5859,7 +5652,7 @@ QSize QMacStyle::sizeFromContents(ContentsType ct, const QStyleOption *opt,
h = qMax(h, iconSize.height() + 4);
maxpmw = qMax(maxpmw, iconSize.width());
} else {
- int iconExtent = pixelMetric(PM_SmallIconSize);
+ int iconExtent = proxy()->pixelMetric(PM_SmallIconSize);
h = qMax(h, mi->icon.actualSize(QSize(iconExtent, iconExtent)).height() + 4);
}
}
@@ -5888,6 +5681,14 @@ QSize QMacStyle::sizeFromContents(ContentsType ct, const QStyleOption *opt,
}
break;
case CT_ToolButton:
+ if (widget && qobject_cast<const QToolBar *>(widget->parentWidget())) {
+ sz.rwidth() += 4;
+ if (sz.height() <= 32) {
+ // Workaround strange HIToolBar bug when getting constraints.
+ sz.rheight() += 1;
+ }
+ return sz;
+ }
sz.rwidth() += 10;
sz.rheight() += 10;
return sz;
@@ -5898,7 +5699,7 @@ QSize QMacStyle::sizeFromContents(ContentsType ct, const QStyleOption *opt,
QStyleHintReturnMask menuMask;
QStyleOption myOption = *opt;
myOption.rect.setSize(sz);
- if (styleHint(SH_Menu_Mask, &myOption, widget, &menuMask)) {
+ if (proxy()->styleHint(SH_Menu_Mask, &myOption, widget, &menuMask)) {
sz = menuMask.region.boundingRect().size();
}
break; }
@@ -6067,78 +5868,12 @@ bool QMacStyle::event(QEvent *e)
return false;
}
-void qt_mac_constructQIconFromIconRef(const IconRef icon, const IconRef overlayIcon, QIcon *retIcon, QStyle::StandardPixmap standardIcon = QStyle::SP_CustomBase)
-{
- int size = 16;
- while (size <= 128) {
-
- const QString cacheKey = QLatin1String("qt_mac_constructQIconFromIconRef") + QString::number(standardIcon) + QString::number(size);
- QPixmap mainIcon;
- if (standardIcon >= QStyle::SP_CustomBase) {
- mainIcon = qt_mac_convert_iconref(icon, size, size);
- } else if (QPixmapCache::find(cacheKey, mainIcon) == false) {
- mainIcon = qt_mac_convert_iconref(icon, size, size);
- QPixmapCache::insert(cacheKey, mainIcon);
- }
-
- if (overlayIcon) {
- int littleSize = size / 2;
- QPixmap overlayPix = qt_mac_convert_iconref(overlayIcon, littleSize, littleSize);
- QPainter painter(&mainIcon);
- painter.drawPixmap(size - littleSize, size - littleSize, overlayPix);
- }
-
- retIcon->addPixmap(mainIcon);
- size += size; // 16 -> 32 -> 64 -> 128
- }
-}
-
QIcon QMacStyle::standardIconImplementation(StandardPixmap standardIcon, const QStyleOption *opt,
const QWidget *widget) const
{
- OSType iconType = 0;
switch (standardIcon) {
- case QStyle::SP_MessageBoxQuestion:
- case QStyle::SP_MessageBoxInformation:
- case QStyle::SP_MessageBoxWarning:
- case QStyle::SP_MessageBoxCritical:
- iconType = kGenericApplicationIcon;
- break;
- case SP_DesktopIcon:
- iconType = kDesktopIcon;
- break;
- case SP_TrashIcon:
- iconType = kTrashIcon;
- break;
-#if (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4)
- case SP_ComputerIcon:
- iconType = kComputerIcon;
- break;
-#endif
- case SP_DriveFDIcon:
- iconType = kGenericFloppyIcon;
- break;
- case SP_DriveHDIcon:
- iconType = kGenericHardDiskIcon;
- break;
- case SP_DriveCDIcon:
- case SP_DriveDVDIcon:
- iconType = kGenericCDROMIcon;
- break;
- case SP_DriveNetIcon:
- iconType = kGenericNetworkIcon;
- break;
- case SP_DirOpenIcon:
- iconType = kOpenFolderIcon;
- break;
- case SP_DirClosedIcon:
- case SP_DirLinkIcon:
- iconType = kGenericFolderIcon;
- break;
- case SP_FileLinkIcon:
- case SP_FileIcon:
- iconType = kGenericDocumentIcon;
- break;
+ default:
+ return QWindowsStyle::standardIconImplementation(standardIcon, opt, widget);
case SP_ToolBarHorizontalExtensionButton:
case SP_ToolBarVerticalExtensionButton: {
QPixmap pixmap(qt_mac_toolbar_ext);
@@ -6152,58 +5887,8 @@ QIcon QMacStyle::standardIconImplementation(StandardPixmap standardIcon, const Q
return pix2;
}
return pixmap;
- }
- break;
- case SP_DirIcon: {
- // A rather special case
- QIcon closeIcon = QStyle::standardIcon(SP_DirClosedIcon, opt, widget);
- QIcon openIcon = QStyle::standardIcon(SP_DirOpenIcon, opt, widget);
- closeIcon.addPixmap(openIcon.pixmap(16, 16), QIcon::Normal, QIcon::On);
- closeIcon.addPixmap(openIcon.pixmap(32, 32), QIcon::Normal, QIcon::On);
- closeIcon.addPixmap(openIcon.pixmap(64, 64), QIcon::Normal, QIcon::On);
- closeIcon.addPixmap(openIcon.pixmap(128, 128), QIcon::Normal, QIcon::On);
- return closeIcon;
- }
- case SP_TitleBarNormalButton:
- case SP_TitleBarCloseButton: {
- QIcon titleBarIcon;
- if (standardIcon == SP_TitleBarCloseButton) {
- titleBarIcon.addFile(QLatin1String(":/trolltech/styles/macstyle/images/closedock-16.png"));
- titleBarIcon.addFile(QLatin1String(":/trolltech/styles/macstyle/images/closedock-down-16.png"), QSize(16, 16), QIcon::Normal, QIcon::On);
- } else {
- titleBarIcon.addFile(QLatin1String(":/trolltech/styles/macstyle/images/dockdock-16.png"));
- titleBarIcon.addFile(QLatin1String(":/trolltech/styles/macstyle/images/dockdock-down-16.png"), QSize(16, 16), QIcon::Normal, QIcon::On);
- }
- return titleBarIcon;
}
- default:
- break;
- }
- if (iconType != 0) {
- QIcon retIcon;
- IconRef icon;
- IconRef overlayIcon = 0;
- if (iconType != kGenericApplicationIcon) {
- GetIconRef(kOnSystemDisk, kSystemIconsCreator, iconType, &icon);
- } else {
- FSRef fsRef;
- ProcessSerialNumber psn = { 0, kCurrentProcess };
- GetProcessBundleLocation(&psn, &fsRef);
- GetIconRefFromFileInfo(&fsRef, 0, 0, 0, 0, kIconServicesNormalUsageFlag, &icon, 0);
- if (standardIcon == SP_MessageBoxCritical) {
- overlayIcon = icon;
- GetIconRef(kOnSystemDisk, kSystemIconsCreator, kAlertCautionIcon, &icon);
- }
- }
- if (icon) {
- qt_mac_constructQIconFromIconRef(icon, overlayIcon, &retIcon, standardIcon);
- ReleaseIconRef(icon);
- }
- if (overlayIcon)
- ReleaseIconRef(overlayIcon);
- return retIcon;
}
- return QWindowsStyle::standardIconImplementation(standardIcon, opt, widget);
}
int QMacStyle::layoutSpacingImplementation(QSizePolicy::ControlType control1,
diff --git a/src/gui/styles/qmacstylepixmaps_mac_p.h b/src/gui/styles/qmacstylepixmaps_mac_p.h
index 22717e5..6399b5e 100644
--- a/src/gui/styles/qmacstylepixmaps_mac_p.h
+++ b/src/gui/styles/qmacstylepixmaps_mac_p.h
@@ -1,7 +1,6 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the QtGui module of the Qt Toolkit.
@@ -21,9 +20,10 @@
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.1, included in the file LGPL_EXCEPTION.txt in this
+** package.
**
** If you have questions regarding the use of this file, please contact
** Nokia at qt-info@nokia.com.
@@ -50,1406 +50,6 @@
// We mean it.
//
-static const char *const qt_mac_tabnrm_left[]={
-"6 22 71 2",
-"#a c #5f5f5f",
-"## c #6d6d6d",
-".c c #737373",
-".d c #757575",
-".b c #7c7c7c",
-".n c #7d7d7d",
-".r c #828282",
-".f c #838383",
-"#. c #878787",
-".7 c #8c8c8c",
-".v c #8e8e8e",
-".4 c #939393",
-".1 c #969696",
-".j c #979797",
-".a c #9a9a9a",
-".6 c #9b9b9b",
-".A c #a0a0a0",
-".Z c #a6a6a6",
-".C c #aaaaaa",
-".3 c #aeaeae",
-".E c #afafaf",
-".J c #b3b3b3",
-".8 c #b7b7b7",
-".o c #b8b8b8",
-".g c #b9b9b9",
-".P c #bcbcbc",
-".R c #bfbfbf",
-".T c #c2c2c2",
-".s c #c4c4c4",
-"#e c #c6c6c6",
-".V c #c7c7c7",
-".w c #c9c9c9",
-".B c #cacaca",
-"#d c #cbcbcb",
-".z c #cecece",
-".F c #cfcfcf",
-".5 c #d1d1d1",
-"#c c #d3d3d3",
-".K c #d4d4d4",
-".G c #d5d5d5",
-".Q c #d6d6d6",
-".S c #d8d8d8",
-".U c #dadada",
-".2 c #dbdbdb",
-".L c #dcdcdc",
-".H c #dedede",
-".I c #dfdfdf",
-".M c #e0e0e0",
-".X c #e1e1e1",
-".D c #e2e2e2",
-"#b c #e3e3e3",
-".O c #e4e4e4",
-".N c #e6e6e6",
-".9 c #e7e7e7",
-".e c #e8e8e8",
-".# c #e9e9e9",
-".t c #ebebeb",
-"Qt c #ececec",
-".p c #ededed",
-".x c #eeeeee",
-".y c #efefef",
-".u c #f1f1f1",
-".k c #f2f2f2",
-".q c #f3f3f3",
-".W c #f6f6f6",
-".l c #f7f7f7",
-".m c #f8f8f8",
-".Y c #f9f9f9",
-".h c #fcfcfc",
-".i c #fdfdfd",
-".0 c #ffffff",
-"Qt.#.a.b.c.d",
-".e.f.gQt.h.i",
-".j.a.k.l.m.m",
-".n.o.p.k.q.q",
-".r.s.t.u.u.u",
-".v.w.t.x.y.y",
-".a.z.#.p.x.x",
-".A.B.#.t.x.p",
-".C.B.D.t.x.x",
-".E.F.G.H.I.I",
-".J.K.L.M.N.O",
-".P.Q.D.#.e.#",
-".R.S.O.p.x.p",
-".T.U.#.u.u.k",
-".V.I.t.q.W.W",
-".P.X.k.W.Y.Y",
-".Z.M.u.Y.0.0",
-".1.2.l.0.0.0",
-".3.4.m.0.0.0",
-".5.6.7.8.9.0",
-".X.5.3#.###a",
-".O#b.L#c#d#e"};
-
-static const char *const qt_mac_tabnrm_mid[]={
-"6 22 18 1",
-"n c #585858",
-". c #777777",
-"p c #c2c2c2",
-"o c #c3c3c3",
-"g c #dedede",
-"h c #e5e5e5",
-"i c #e8e8e8",
-"f c #ededed",
-"e c #eeeeee",
-"d c #efefef",
-"c c #f1f1f1",
-"b c #f3f3f3",
-"j c #f6f6f6",
-"a c #f8f8f8",
-"k c #f9f9f9",
-"# c #fdfdfd",
-"l c #fefefe",
-"m c #ffffff",
-"......",
-"######",
-"aaaaaa",
-"bbbbbb",
-"cccccc",
-"dddddd",
-"eeeeee",
-"ffffff",
-"eeeeee",
-"gggggg",
-"hhhhhh",
-"iiiiii",
-"eeeeee",
-"cccccc",
-"jjjjjj",
-"kkkkkk",
-"llllll",
-"mmmmmm",
-"mmmmmm",
-"mmmmmm",
-"nnnnnn",
-"oppooo"};
-
-static const char *const qt_mac_tabnrm_right[]={
-"6 22 70 2",
-".9 c #5f5f5f",
-"#. c #6d6d6d",
-".# c #747474",
-"Qt c #757575",
-".a c #7c7c7c",
-".p c #7d7d7d",
-".t c #828282",
-".h c #838383",
-"## c #888888",
-".6 c #8c8c8c",
-".x c #8e8e8e",
-".3 c #929292",
-".2 c #969696",
-".l c #979797",
-".b c #9a9a9a",
-".7 c #9b9b9b",
-".A c #a0a0a0",
-".0 c #a6a6a6",
-".C c #aaaaaa",
-"#a c #aeaeae",
-".H c #afafaf",
-".N c #b3b3b3",
-".5 c #b7b7b7",
-".o c #b8b8b8",
-".g c #b9b9b9",
-".Q c #bcbcbc",
-".S c #bfbfbf",
-".U c #c2c2c2",
-".s c #c4c4c4",
-"#b c #c6c6c6",
-".W c #c7c7c7",
-".w c #c9c9c9",
-".z c #cacaca",
-".y c #cecece",
-".G c #cfcfcf",
-".8 c #d1d1d1",
-"#c c #d3d3d3",
-".M c #d4d4d4",
-".F c #d5d5d5",
-".P c #d6d6d6",
-".R c #d8d8d8",
-".T c #dadada",
-".1 c #dbdbdb",
-".L c #dcdcdc",
-".E c #dedede",
-".D c #dfdfdf",
-".K c #e0e0e0",
-".Y c #e1e1e1",
-".B c #e2e2e2",
-".I c #e4e4e4",
-"#d c #e5e5e5",
-".J c #e6e6e6",
-".4 c #e7e7e7",
-".O c #e8e8e8",
-".c c #e9e9e9",
-".r c #ebebeb",
-".d c #ececec",
-".n c #ededed",
-".v c #eeeeee",
-".u c #efefef",
-".q c #f1f1f1",
-".k c #f2f2f2",
-".m c #f3f3f3",
-".V c #f6f6f6",
-".j c #f7f7f7",
-".i c #f8f8f8",
-".X c #f9f9f9",
-".f c #fcfcfc",
-".e c #fdfdfd",
-".Z c #ffffff",
-"Qt.#.a.b.c.d",
-".e.f.d.g.h.c",
-".i.i.j.k.b.l",
-".m.m.k.n.o.p",
-".q.q.q.r.s.t",
-".u.u.v.r.w.x",
-".v.v.n.c.y.b",
-".n.v.r.c.z.A",
-".v.v.r.B.z.C",
-".D.D.E.F.G.H",
-".I.J.K.L.M.N",
-".c.O.c.B.P.Q",
-".n.v.n.I.R.S",
-".k.q.q.c.T.U",
-".V.V.m.r.D.W",
-".X.X.V.k.Y.Q",
-".Z.Z.X.q.K.0",
-".Z.Z.Z.j.1.2",
-".Z.Z.Z.i.3.H",
-".Z.4.5.6.7.8",
-".9#.###a.8.B",
-"#b.z#c.L.I#d"};
-
-static const char *const qt_mac_tabselected_active_left[]={
-"6 22 130 2",
-".d c #000069",
-".C c #0042b4",
-".I c #0157bb",
-".w c #0c28a0",
-".l c #101094",
-".O c #1163c4",
-".c c #1a1a6e",
-".U c #1e6ec9",
-".r c #214eb7",
-".x c #256cc9",
-".0 c #2877ce",
-".6 c #347fd1",
-".D c #3981d2",
-"#a c #3a81d2",
-"#g c #418ad7",
-".J c #4288d4",
-".q c #45459b",
-".V c #458cd5",
-".g c #46469f",
-".P c #4a8dd7",
-".1 c #4a90db",
-"#m c #4b91db",
-"#s c #4e91dc",
-"#y c #4f8dcd",
-".7 c #5195df",
-".b c #525280",
-"#E c #5984b2",
-"#b c #5b9be1",
-"#R c #5c7e9f",
-".2 c #5d9de6",
-"#5 c #5f5f5f",
-"#Y c #627c8d",
-"#h c #65a4e7",
-".3 c #65a6e8",
-".8 c #67a6eb",
-"#n c #69a6e8",
-"#c c #6cabed",
-"#4 c #6d6d6d",
-".4 c #6dacee",
-".5 c #6eabee",
-"#K c #6f87a1",
-"#L c #70aff1",
-".9 c #70aff2",
-"#t c #71aced",
-"#z c #72afee",
-"#F c #72afef",
-".f c #757592",
-"#i c #75b3f4",
-"#d c #75b4f3",
-"#Z c #77a6b3",
-"#. c #77b1f4",
-"## c #7ab4f4",
-".W c #7cb0e7",
-"#o c #7cb8f9",
-"#f c #80bdf9",
-"#e c #81bbf9",
-"#j c #81bbfc",
-"#u c #86c1ff",
-"#3 c #878787",
-"#k c #89c2fd",
-"#A c #89c3ff",
-".Q c #8bb9e8",
-"#l c #8bc4ff",
-"#p c #8bc6ff",
-"#G c #8dc7ff",
-".K c #8ebae8",
-"#S c #8ecbff",
-"#q c #91c8ff",
-"#M c #92ccff",
-"#v c #93ccff",
-".k c #9494b0",
-"#r c #94caff",
-".E c #96bde8",
-".X c #96c3ee",
-"#w c #96cfff",
-"#B c #97cfff",
-".Y c #99c4ee",
-"#x c #99d0ff",
-".a c #9a9aa4",
-"#X c #9b9b9b",
-".s c #9bbee8",
-".R c #9bc4ee",
-".T c #9cc5ee",
-".Z c #9dc7ef",
-"#C c #9dd3ff",
-".y c #9ec3e8",
-".L c #9ec3ed",
-".M c #9ec5ed",
-"#H c #9ed6ff",
-".S c #9fc5ee",
-"#D c #a1d7ff",
-".N c #a3c8ed",
-"#N c #a3daff",
-".F c #a5c8ed",
-".G c #a7c9ed",
-"#J c #a7ddff",
-"#I c #a7deff",
-".H c #a8caee",
-"#T c #a8e0ff",
-"#0 c #a8e2e6",
-".z c #a9caed",
-"#O c #abe3ff",
-".A c #adcbed",
-"#P c #ade3ff",
-"#Q c #aeaeae",
-".m c #afbbe7",
-".B c #afccee",
-"#U c #b0e9ff",
-".t c #b3d1ed",
-"#V c #b5ebff",
-".u c #bad4ee",
-".v c #bbd4ef",
-".h c #bfc2e8",
-"#1 c #bffdff",
-"a# c #c6c6c6",
-"a. c #cbcbcb",
-".n c #cbddf2",
-".o c #cce0f3",
-".p c #cfe1f4",
-"#W c #d1d1d1",
-"#9 c #d3d3d3",
-"#8 c #dcdcdc",
-"#2 c #e1e1e1",
-"#7 c #e3e3e3",
-"#6 c #e4e4e4",
-".i c #e6e9f6",
-".e c #e8e8e8",
-".# c #e9e9e9",
-".j c #e9edf8",
-"Qt c #ececec",
-"Qt.#.a.b.c.d",
-".e.f.g.h.i.j",
-".k.l.m.n.o.p",
-".q.r.s.t.u.v",
-".w.x.y.z.A.B",
-".C.D.E.F.G.H",
-".I.J.K.L.M.N",
-".O.P.Q.R.S.T",
-".U.V.W.X.Y.Z",
-".0.1.2.3.4.5",
-".6.7.8.9#.##",
-"#a#b#c#d#e#f",
-"#g#h#i#j#k#l",
-"#m#n#o#p#q#r",
-"#s#t#u#v#w#x",
-"#y#z#A#B#C#D",
-"#E#F#G#H#I#J",
-"#K#L#M#N#O#P",
-"#Q#R#S#T#U#V",
-"#W#X#Y#Z#0#1",
-"#2#W#Q#3#4#5",
-"#6#7#8#9a.a#"};
-
-static const char *const qt_mac_tabselected_active_mid[]={
-"6 22 23 1",
-". c #00006d",
-"s c #585858",
-"h c #70adef",
-"i c #7bb5f5",
-"j c #83bcf9",
-"k c #8bc3ff",
-"l c #93c9ff",
-"m c #9ad1ff",
-"f c #9ec5ef",
-"g c #9ec7f0",
-"n c #a0d6ff",
-"e c #a2c7ed",
-"d c #a8caee",
-"o c #a8deff",
-"p c #ade2ff",
-"c c #afceee",
-"q c #b6ecff",
-"b c #bbd5f0",
-"r c #c1feff",
-"u c #c2c2c2",
-"t c #c3c3c3",
-"a c #cfe1f3",
-"# c #e9edf8",
-"......",
-"######",
-"aaaaaa",
-"bbbbbb",
-"cccccc",
-"dddddd",
-"eeeeee",
-"ffffff",
-"gggggg",
-"hhhhhh",
-"iiiiii",
-"jjjjjj",
-"kkkkkk",
-"llllll",
-"mmmmmm",
-"nnnnnn",
-"oooooo",
-"pppppp",
-"qqqqqq",
-"rrrrrr",
-"ssssss",
-"ttttuu"};
-
-static const char *const qt_mac_tabselected_active_right[]={
-"6 22 128 2",
-"Qt c #000069",
-".G c #0042b4",
-".M c #0157bb",
-".A c #0c28a0",
-".n c #101094",
-".S c #1163c4",
-".# c #1b1b6e",
-".Y c #1e6ec9",
-".t c #214eb7",
-".z c #256cc9",
-".4 c #2877ce",
-"#. c #347fd1",
-".F c #3981d2",
-"#e c #3a81d2",
-"#k c #418ad7",
-".L c #4288d4",
-".u c #45459b",
-".X c #458cd5",
-".h c #46469f",
-".R c #4a8dd7",
-".3 c #4a90db",
-"#q c #4b91db",
-"#w c #4e91dc",
-"#C c #4f8dcd",
-".9 c #5195df",
-".a c #525280",
-"#I c #5984b2",
-"#T c #5b7d9f",
-"#d c #5b9be1",
-".2 c #5d9de6",
-"#1 c #5f5f5f",
-"#Y c #627c8d",
-"#j c #65a4e7",
-".1 c #65a6e8",
-".8 c #67a6eb",
-"#p c #69a6e8",
-"#c c #6cabed",
-"#2 c #6d6d6d",
-".0 c #6dacee",
-".Z c #6eabee",
-"#O c #6f87a1",
-"#N c #70aff1",
-".7 c #70aff2",
-"#v c #71aced",
-"#B c #72afee",
-"#H c #72afef",
-".i c #757592",
-"#i c #75b3f4",
-"#b c #75b4f3",
-"#X c #77a6b3",
-".6 c #77b1f4",
-".5 c #7ab4f4",
-".W c #7cb0e7",
-"#o c #7cb8f9",
-"## c #80bdf9",
-"#a c #81bbf9",
-"#h c #81bbfc",
-"#u c #86c1ff",
-"#3 c #888888",
-"#g c #89c2fd",
-"#A c #89c3ff",
-".Q c #8bb9e8",
-"#f c #8bc4ff",
-"#n c #8bc6ff",
-"#G c #8dc7ff",
-".K c #8ebae8",
-"#S c #8ecbff",
-"#m c #91c8ff",
-"#M c #92ccff",
-"#t c #93ccff",
-".o c #9494b0",
-"#l c #94caff",
-".E c #96bde8",
-".V c #96c3ee",
-"#s c #96cfff",
-"#z c #97cfff",
-".U c #99c4ee",
-"#r c #99d0ff",
-".b c #9a9aa4",
-"#Z c #9b9b9b",
-".s c #9bbee8",
-".P c #9bc4ee",
-".N c #9cc5ee",
-".T c #9dc7ef",
-"#y c #9dd3ff",
-".y c #9ec3e8",
-".J c #9ec3ed",
-".I c #9ec5ed",
-"#F c #9ed6ff",
-".O c #9fc5ee",
-"#x c #a1d7ff",
-".H c #a3c8ed",
-"#L c #a3daff",
-".D c #a5c8ed",
-".C c #a7c9ed",
-"#D c #a7ddff",
-"#E c #a7deff",
-".B c #a8caee",
-"#R c #a8e0ff",
-"#W c #a8e2e6",
-".x c #a9caed",
-"#K c #abe3ff",
-".w c #adcbed",
-"#J c #ade3ff",
-"#U c #aeaeae",
-".m c #afbbe7",
-".v c #afccee",
-"#Q c #b0e9ff",
-".r c #b3d1ed",
-"#P c #b5ebff",
-".q c #bad4ee",
-".p c #bbd4ef",
-".g c #bfc2e8",
-"#V c #bffdff",
-"#5 c #c6c6c6",
-"#6 c #cacaca",
-".l c #cbddf2",
-".k c #cce0f3",
-".j c #cfe1f4",
-"#0 c #d1d1d1",
-"#7 c #d3d3d3",
-"#8 c #dcdcdc",
-"#4 c #e2e2e2",
-"#9 c #e4e4e4",
-".f c #e6e9f6",
-".c c #e9e9e9",
-".e c #e9edf8",
-".d c #ececec",
-"Qt.#.a.b.c.d",
-".e.f.g.h.i.c",
-".j.k.l.m.n.o",
-".p.q.r.s.t.u",
-".v.w.x.y.z.A",
-".B.C.D.E.F.G",
-".H.I.J.K.L.M",
-".N.O.P.Q.R.S",
-".T.U.V.W.X.Y",
-".Z.0.1.2.3.4",
-".5.6.7.8.9#.",
-"###a#b#c#d#e",
-"#f#g#h#i#j#k",
-"#l#m#n#o#p#q",
-"#r#s#t#u#v#w",
-"#x#y#z#A#B#C",
-"#D#E#F#G#H#I",
-"#J#K#L#M#N#O",
-"#P#Q#R#S#T#U",
-"#V#W#X#Y#Z#0",
-"#1#2#3#U#0#4",
-"#5#6#7#8#9#9"};
-
-static const char *const qt_mac_tabselected_inactive_left[]={
-"6 22 64 1",
-"9 c #656565",
-"8 c #737373",
-"c c #767676",
-"b c #808080",
-"n c #818181",
-"q c #828282",
-"e c #888888",
-"7 c #8b8b8b",
-"u c #8d8d8d",
-"3 c #939393",
-"k c #979797",
-"0 c #989898",
-"j c #9b9b9b",
-"A c #9d9d9d",
-"a c #9e9e9e",
-"4 c #9f9f9f",
-"Y c #a3a3a3",
-"C c #a6a6a6",
-"E c #aaaaaa",
-"J c #aeaeae",
-"6 c #b0b0b0",
-"2 c #b1b1b1",
-"o c #b2b2b2",
-"f c #b3b3b3",
-"O c #b6b6b6",
-"Q c #b9b9b9",
-"S c #bbbbbb",
-"r c #bdbdbd",
-"U c #c0c0c0",
-"v c #c2c2c2",
-"B c #c3c3c3",
-"y c #c6c6c6",
-"F c #c7c7c7",
-"K c #cccccc",
-"G c #cdcdcd",
-"R c #cfcfcf",
-"T c #d1d1d1",
-"1 c #d2d2d2",
-"L c #d3d3d3",
-"H c #d5d5d5",
-"I c #d6d6d6",
-"W c #d7d7d7",
-"D c #d8d8d8",
-"N c #dadada",
-"M c #dcdcdc",
-"5 c #dddddd",
-"P c #dedede",
-"z c #dfdfdf",
-"s c #e0e0e0",
-"g c #e1e1e1",
-"p c #e2e2e2",
-"w c #e3e3e3",
-"x c #e4e4e4",
-"t c #e6e6e6",
-"l c #e7e7e7",
-"d c #e8e8e8",
-"# c #e9e9e9",
-"V c #eaeaea",
-"m c #ebebeb",
-". c #ececec",
-"X c #ededed",
-"h c #f0f0f0",
-"i c #f1f1f1",
-"Z c #f2f2f2",
-".#abcc",
-"defghi",
-"jklm..",
-"nopldd",
-"qrsttt",
-"uvswxx",
-"kyzpww",
-"ABzswp",
-"CBDsww",
-"EFGHII",
-"JKLIMN",
-"OGDzPz",
-"QRNpwp",
-"STzttl",
-"UIsdVV",
-"OWlVXX",
-"YItXZZ",
-"01mZZZ",
-"23.ZZZ",
-"T4uo5Z",
-"gT6789",
-"xwMLKF"};
-
-static const char *const qt_mac_tabselected_inactive_mid[]={
-"6 22 17 1",
-"m c #5f5f5f",
-". c #787878",
-"o c #c3c3c3",
-"n c #c4c4c4",
-"g c #d5d5d5",
-"h c #dbdbdb",
-"i c #dedede",
-"f c #e2e2e2",
-"e c #e3e3e3",
-"d c #e4e4e4",
-"c c #e6e6e6",
-"b c #e8e8e8",
-"j c #eaeaea",
-"a c #ececec",
-"k c #ededed",
-"# c #f1f1f1",
-"l c #f2f2f2",
-"......",
-"######",
-"aaaaaa",
-"bbbbbb",
-"cccccc",
-"dddddd",
-"eeeeee",
-"ffffff",
-"eeeeee",
-"gggggg",
-"hhhhhh",
-"iiiiii",
-"eeeeee",
-"cccccc",
-"jjjjjj",
-"kkkkkk",
-"llllll",
-"llllll",
-"llllll",
-"llllll",
-"mmmmmm",
-"nnnnno"};
-
-static const char *const qt_mac_tabselected_inactive_right[]={
-"6 22 65 2",
-".6 c #656565",
-".7 c #737373",
-"Qt c #767676",
-".# c #808080",
-".p c #818181",
-".t c #828282",
-".h c #888888",
-".8 c #8c8c8c",
-".x c #8d8d8d",
-".2 c #929292",
-".k c #979797",
-".1 c #989898",
-".l c #9b9b9b",
-".B c #9d9d9d",
-".a c #9e9e9e",
-".5 c #9f9f9f",
-".Z c #a3a3a3",
-".D c #a6a6a6",
-".I c #aaaaaa",
-".N c #aeaeae",
-".9 c #b0b0b0",
-".3 c #b1b1b1",
-".o c #b2b2b2",
-".g c #b3b3b3",
-".P c #b6b6b6",
-".R c #b9b9b9",
-".T c #bbbbbb",
-".s c #bdbdbd",
-".V c #c0c0c0",
-".w c #c2c2c2",
-".A c #c3c3c3",
-".z c #c6c6c6",
-".H c #c7c7c7",
-"#. c #cbcbcb",
-".M c #cccccc",
-".G c #cdcdcd",
-".Q c #cfcfcf",
-".S c #d1d1d1",
-".0 c #d2d2d2",
-".L c #d3d3d3",
-".F c #d5d5d5",
-".E c #d6d6d6",
-".X c #d7d7d7",
-".C c #d8d8d8",
-".J c #dadada",
-".K c #dcdcdc",
-".4 c #dddddd",
-".O c #dedede",
-".y c #dfdfdf",
-".r c #e0e0e0",
-".f c #e1e1e1",
-".n c #e2e2e2",
-".v c #e3e3e3",
-".u c #e4e4e4",
-".q c #e6e6e6",
-".j c #e7e7e7",
-".m c #e8e8e8",
-".b c #e9e9e9",
-".U c #eaeaea",
-".i c #ebebeb",
-".c c #ececec",
-".W c #ededed",
-".e c #f0f0f0",
-".d c #f1f1f1",
-".Y c #f2f2f2",
-"QtQt.#.a.b.c",
-".d.e.f.g.h.b",
-".c.c.i.j.k.l",
-".m.m.j.n.o.p",
-".q.q.q.r.s.t",
-".u.u.v.r.w.x",
-".v.v.n.y.z.k",
-".n.v.r.y.A.B",
-".v.v.r.C.A.D",
-".E.E.F.G.H.I",
-".J.K.E.L.M.N",
-".y.O.y.C.G.P",
-".n.v.n.J.Q.R",
-".j.q.q.y.S.T",
-".U.U.m.r.E.V",
-".W.W.U.j.X.P",
-".Y.Y.W.q.E.Z",
-".Y.Y.Y.i.0.1",
-".Y.Y.Y.c.2.3",
-".Y.4.o.x.5.S",
-".6.7.8.9.S.n",
-".H#..L.K.u.u"};
-
-static const char * const qt_mac_tab_selected_active_graph_left[]={
-"6 22 126 2",
-".d c #15283d",
-".c c #283348",
-".w c #374459",
-".l c #435364",
-".B c #465568",
-".q c #4d5367",
-".b c #525763",
-".H c #536271",
-".N c #5d6a79",
-"#1 c #5f5f5f",
-".T c #647181",
-"#N c #656e77",
-".r c #677282",
-"#B c #687380",
-"#U c #697077",
-".Z c #6c7885",
-".5 c #6c7988",
-"#0 c #6d6d6d",
-"#H c #6f767f",
-".x c #727e8a",
-"## c #757f8d",
-".f c #76767d",
-"#v c #76838f",
-"#e c #778292",
-"#k c #7b8694",
-".U c #7b8794",
-".C c #7b8795",
-".O c #7c8893",
-".I c #7d8896",
-".g c #7e8895",
-".0 c #7e8b99",
-"#q c #818c98",
-".6 c #85909e",
-"#Z c #878787",
-"#a c #8a96a3",
-"#f c #8d99a7",
-".1 c #8e99a6",
-"#V c #929ca5",
-"#l c #939daa",
-".k c #949499",
-".7 c #96a0ad",
-".2 c #98a3af",
-"#r c #99a5b0",
-".a c #9a9a9b",
-"#I c #9aa4b1",
-"#T c #9b9b9b",
-".3 c #9ba6b1",
-"#b c #9ba6b3",
-".8 c #9ca7b4",
-".4 c #9da6b1",
-"#w c #9da7b5",
-"#C c #9ea9b5",
-".V c #a0a9b4",
-"#g c #a0abb8",
-"#. c #a3acb8",
-".9 c #a4adba",
-"#c c #a6afbc",
-"#m c #a8b1bd",
-"#d c #a9b3bf",
-".J c #abb3bc",
-".P c #adb4bb",
-"#h c #adb8c3",
-"#M c #aeaeae",
-"#j c #aeb8c4",
-".W c #b0b8c2",
-"#i c #b0bac6",
-".D c #b3bac3",
-"#x c #b3bcc8",
-"#n c #b3bdc9",
-".Q c #b4bac2",
-"#D c #b5bfc9",
-".y c #b6bdc5",
-"#o c #b6becb",
-"#s c #b7c2ce",
-".K c #b8bdc6",
-".X c #b8bfc8",
-"#p c #b8c1ce",
-".S c #b9bec7",
-".R c #b9bfc8",
-".Y c #b9c1c7",
-".M c #b9c1c8",
-"#J c #bac5cf",
-".L c #bbbfc8",
-"#O c #bbc7d4",
-".s c #bcc3ca",
-"#t c #bcc5d1",
-"#u c #bcc6d2",
-".E c #bdc3ca",
-"#y c #bdc7d2",
-".G c #bec3cb",
-".F c #bec5cb",
-".z c #c2c7ce",
-"#E c #c2cad6",
-".A c #c3c9d0",
-"#z c #c3ccd7",
-"#A c #c3ced7",
-".m c #c5c9d0",
-"#7 c #c6c6c6",
-"#K c #c7d2dd",
-".t c #c8ced3",
-"#F c #c8d3de",
-"#G c #c9d3df",
-"#6 c #cbcbcb",
-".u c #cbd1d6",
-".v c #ccd2d7",
-".h c #ced2d6",
-"#W c #ced8e4",
-"#L c #d0dae3",
-"#S c #d1d1d1",
-"#P c #d1dbe6",
-"#5 c #d3d3d3",
-".n c #d5dadc",
-"#Q c #d5deea",
-".o c #d7dbdf",
-"#R c #d7e1ec",
-".p c #dadde0",
-"#4 c #dcdcdc",
-".i c #e0e2e6",
-"#Y c #e1e1e1",
-"#3 c #e3e3e3",
-"#2 c #e4e4e4",
-".j c #e6e8ea",
-".e c #e8e8e8",
-".# c #e9e9e9",
-"#X c #e9f4ff",
-"Qt c #ececec",
-"Qt.#.a.b.c.d",
-".e.f.g.h.i.j",
-".k.l.m.n.o.p",
-".q.r.s.t.u.v",
-".w.x.y.z.A.A",
-".B.C.D.E.F.G",
-".H.I.J.K.L.M",
-".N.O.P.Q.R.S",
-".T.U.V.W.X.Y",
-".Z.0.1.2.3.4",
-".5.6.7.8.9#.",
-"###a#b#c#d#d",
-"#e#f#g#h#i#j",
-"#k#l#m#n#o#p",
-"#q#r#h#s#t#u",
-"#v#w#x#y#z#A",
-"#B#C#D#E#F#G",
-"#H#I#J#K#L#L",
-"#M#N#O#P#Q#R",
-"#S#T#U#V#W#X",
-"#Y#S#M#Z#0#1",
-"#2#3#4#5#6#7"};
-
-static const char * const qt_mac_tab_selected_active_graph_mid[]={
-"6 22 41 1",
-". c #15273d",
-"# c #16283e",
-"a c #17293e",
-"b c #192a3f",
-"c c #1a2b40",
-"K c #585858",
-"p c #9ea8b4",
-"q c #a4adb9",
-"r c #aab4bf",
-"s c #afb9c6",
-"o c #b6bcc6",
-"n c #b8bec6",
-"t c #b8c2ce",
-"m c #bbc2c8",
-"u c #bbc5d0",
-"l c #bec4cb",
-"v c #bfcad4",
-"L c #c2c2c2",
-"k c #c2c9ce",
-"M c #c3c3c3",
-"w c #c7d1dd",
-"i c #cad0d5",
-"j c #cbd0d5",
-"x c #ccd5e1",
-"y c #cdd6e2",
-"z c #ced6e2",
-"A c #d5dfeb",
-"B c #d6e0ec",
-"C c #d7e1ed",
-"e c #d8dbe0",
-"f c #d8dce0",
-"g c #d9dce0",
-"D c #d9e2ee",
-"h c #dadce0",
-"E c #dae2ef",
-"d c #e7e9eb",
-"J c #e9f2ff",
-"I c #eaf3ff",
-"H c #ebf5ff",
-"G c #ecf6ff",
-"F c #edf6ff",
-"..#abc",
-"dddddd",
-"eeefgh",
-"iiiiij",
-"kkkkkk",
-"llllll",
-"mmmmmm",
-"nnnnnn",
-"oooooo",
-"pppppp",
-"qqqqqq",
-"rrrrrr",
-"ssssss",
-"tttttt",
-"uuuuuu",
-"vvvvvv",
-"wwwwww",
-"xxxxyz",
-"AABCDE",
-"FFGHIJ",
-"KKKKKK",
-"LLLLMM"};
-
-static const char * const qt_mac_tab_selected_active_graph_right[]={
-"6 22 124 2",
-"Qt c #15283d",
-".# c #293448",
-".z c #374459",
-".n c #435364",
-".F c #465568",
-".u c #4d5367",
-".a c #525763",
-".L c #536271",
-".R c #5d6a79",
-"#X c #5f5f5f",
-"#P c #646d77",
-".X c #647181",
-".t c #677282",
-"#F c #687380",
-"#U c #697077",
-".3 c #6c7885",
-".9 c #6c7988",
-"#Y c #6d6d6d",
-"#K c #6f767f",
-".y c #727e8a",
-"#c c #757f8d",
-".i c #76767d",
-"#z c #76838f",
-"#i c #778292",
-"#o c #7b8694",
-".W c #7b8794",
-".E c #7b8795",
-".Q c #7c8893",
-".K c #7d8896",
-".h c #7e8895",
-".2 c #7e8b99",
-"#t c #818c98",
-".8 c #85909e",
-"#Z c #888888",
-"#b c #8a96a3",
-"#h c #8d99a7",
-".1 c #8e99a6",
-"#T c #929ca5",
-"#n c #939daa",
-".o c #949499",
-".7 c #96a0ad",
-".0 c #98a3af",
-"#s c #99a5b0",
-".b c #9a9a9b",
-"#J c #9aa4b1",
-"#V c #9b9b9b",
-".Z c #9ba6b1",
-"#a c #9ba6b3",
-".6 c #9ca7b4",
-".Y c #9da6b1",
-"#y c #9da7b5",
-"#E c #9ea9b5",
-".V c #a0a9b4",
-"#g c #a0abb8",
-".4 c #a3acb8",
-".5 c #a4adba",
-"## c #a6afbc",
-"#m c #a8b1bd",
-"#. c #a9b3bf",
-".J c #abb3bc",
-".P c #adb4bb",
-"#f c #adb8c3",
-"#Q c #aeaeae",
-"#d c #aeb8c4",
-".U c #b0b8c2",
-"#e c #b0bac6",
-".D c #b3bac3",
-"#x c #b3bcc8",
-"#l c #b3bdc9",
-".O c #b4bac2",
-"#D c #b5bfc9",
-".x c #b6bdc5",
-"#k c #b6becb",
-"#r c #b7c2ce",
-".I c #b8bdc6",
-".T c #b8bfc8",
-"#j c #b8c1ce",
-".M c #b9bec7",
-".N c #b9bfc8",
-".S c #b9c1c7",
-".G c #b9c1c8",
-"#I c #bac5cf",
-".H c #bbbfc8",
-"#O c #bbc7d4",
-".s c #bcc3ca",
-"#q c #bcc5d1",
-"#p c #bcc6d2",
-".C c #bdc3ca",
-"#w c #bdc7d2",
-".A c #bec3cb",
-".B c #bec5cb",
-".w c #c2c7ce",
-"#C c #c2cad6",
-".v c #c3c9d0",
-"#v c #c3ccd7",
-"#u c #c3ced7",
-".m c #c5c9d0",
-"#1 c #c6c6c6",
-"#H c #c7d2dd",
-".r c #c8ced3",
-"#B c #c8d3de",
-"#A c #c9d3df",
-"#2 c #cacaca",
-".q c #cbd1d6",
-".p c #ccd2d7",
-".g c #ced2d6",
-"#S c #ced8e4",
-"#G c #d0dae3",
-"#W c #d1d1d1",
-"#N c #d1dbe6",
-"#3 c #d3d3d3",
-".l c #d5dadc",
-"#M c #d5deea",
-".k c #d7dbdf",
-"#L c #d7e1ec",
-".j c #dadde0",
-"#4 c #dcdcdc",
-".f c #e0e2e6",
-"#0 c #e2e2e2",
-"#5 c #e4e4e4",
-".e c #e6e8ea",
-".c c #e9e9e9",
-"#R c #e9f4ff",
-".d c #ececec",
-"Qt.#.a.b.c.d",
-".e.f.g.h.i.c",
-".j.k.l.m.n.o",
-".p.q.r.s.t.u",
-".v.v.w.x.y.z",
-".A.B.C.D.E.F",
-".G.H.I.J.K.L",
-".M.N.O.P.Q.R",
-".S.T.U.V.W.X",
-".Y.Z.0.1.2.3",
-".4.5.6.7.8.9",
-"#.#.###a#b#c",
-"#d#e#f#g#h#i",
-"#j#k#l#m#n#o",
-"#p#q#r#f#s#t",
-"#u#v#w#x#y#z",
-"#A#B#C#D#E#F",
-"#G#G#H#I#J#K",
-"#L#M#N#O#P#Q",
-"#R#S#T#U#V#W",
-"#X#Y#Z#Q#W#0",
-"#1#2#3#4#5#5"};
-
-static const char * const qt_mac_tab_press_left[]={
-"6 22 65 2",
-".8 c #5c5c5c",
-".c c #696969",
-".d c #6a6a6a",
-".b c #767676",
-".f c #7e7e7e",
-".t c #808080",
-".4 c #828282",
-".7 c #838383",
-".2 c #888888",
-".k c #8b8b8b",
-".0 c #8c8c8c",
-".z c #909090",
-".j c #919191",
-".a c #959595",
-".Y c #989898",
-".B c #999999",
-".D c #9e9e9e",
-".I c #a1a1a1",
-".n c #a6a6a6",
-".g c #a7a7a7",
-".6 c #a8a8a8",
-".O c #aaaaaa",
-".1 c #ababab",
-".R c #acacac",
-".T c #afafaf",
-".q c #b1b1b1",
-".V c #b3b3b3",
-".u c #b5b5b5",
-".A c #b6b6b6",
-".x c #bababa",
-".E c #bbbbbb",
-"#. c #bebebe",
-".J c #bfbfbf",
-".F c #c0c0c0",
-".P c #c1c1c1",
-".S c #c3c3c3",
-".U c #c5c5c5",
-".K c #c6c6c6",
-".G c #c8c8c8",
-".H c #c9c9c9",
-".L c #cacaca",
-".X c #cbcbcb",
-".C c #cccccc",
-".3 c #cdcdcd",
-".N c #cecece",
-".M c #cfcfcf",
-".5 c #d0d0d0",
-".Q c #d1d1d1",
-".y c #d2d2d2",
-".r c #d4d4d4",
-".h c #d5d5d5",
-".o c #d6d6d6",
-".v c #d7d7d7",
-".w c #d8d8d8",
-".s c #d9d9d9",
-".l c #dadada",
-".p c #dbdbdb",
-".9 c #dcdcdc",
-".W c #dedede",
-".m c #dfdfdf",
-".e c #e0e0e0",
-".# c #e1e1e1",
-".i c #e3e3e3",
-"Qt c #e4e4e4",
-".Z c #e6e6e6",
-"Qt.#.a.b.c.d",
-".e.f.g.h.iQt",
-".j.k.l.m.e.e",
-".b.n.o.l.p.p",
-".b.q.r.s.s.s",
-".t.u.r.v.w.w",
-".k.x.y.o.v.v",
-".z.A.y.r.v.o",
-".B.A.C.r.v.v",
-".D.E.F.G.H.H",
-".I.J.K.L.M.N",
-".O.P.C.y.Q.y",
-".R.S.N.o.v.o",
-".T.U.y.s.s.l",
-".V.H.r.p.W.W",
-".O.X.l.W.#.#",
-".Y.L.s.#.Z.Z",
-".0.K.m.Z.Z.Z",
-".1.2.e.Z.Z.Z",
-".3.Y.4.n.5.Z",
-".s.H.6.7.d.8",
-".9.l.r.L.S#."};
-
-static const char * const qt_mac_tab_press_mid[]={
-"7 22 19 1",
-"o c #555555",
-". c #6b6b6b",
-"p c #bbbbbb",
-"q c #bcbcbc",
-"g c #c8c8c8",
-"h c #cecece",
-"i c #d1d1d1",
-"f c #d6d6d6",
-"e c #d7d7d7",
-"d c #d8d8d8",
-"c c #d9d9d9",
-"j c #dadada",
-"b c #dbdbdb",
-"k c #dedede",
-"a c #e0e0e0",
-"l c #e1e1e1",
-"# c #e4e4e4",
-"m c #e5e5e5",
-"n c #e6e6e6",
-".......",
-"#######",
-"aaaaaaa",
-"bbbbbbb",
-"ccccccc",
-"ddddddd",
-"eeeeeee",
-"fffffff",
-"eeeeeee",
-"ggggggg",
-"hhhhhhh",
-"iiiiiii",
-"eeeeeee",
-"jjjjjjj",
-"kkkkkkk",
-"lllllll",
-"mmmmmmm",
-"nnnnnnn",
-"nnnnnnn",
-"nnnnnnn",
-"ooooooo",
-"ppppqqq"};
-
-static const char * const qt_mac_tab_press_right[]={
-"6 22 64 1",
-"5 c #5c5c5c",
-". c #6a6a6a",
-"# c #767676",
-"g c #7e7e7e",
-"v c #808080",
-"3 c #828282",
-"6 c #848484",
-"0 c #888888",
-"k c #8b8b8b",
-"Z c #8c8c8c",
-"z c #909090",
-"l c #919191",
-"a c #959595",
-"Y c #989898",
-"B c #999999",
-"G c #9e9e9e",
-"M c #a1a1a1",
-"o c #a6a6a6",
-"f c #a7a7a7",
-"7 c #a8a8a8",
-"P c #aaaaaa",
-"1 c #ababab",
-"R c #acacac",
-"T c #afafaf",
-"r c #b1b1b1",
-"V c #b3b3b3",
-"u c #b5b5b5",
-"y c #b6b6b6",
-"x c #bababa",
-"F c #bbbbbb",
-"8 c #bebebe",
-"L c #bfbfbf",
-"E c #c0c0c0",
-"O c #c1c1c1",
-"9 c #c2c2c2",
-"Q c #c3c3c3",
-"S c #c5c5c5",
-"K c #c6c6c6",
-"D c #c8c8c8",
-"C c #c9c9c9",
-"J c #cacaca",
-"W c #cbcbcb",
-"A c #cccccc",
-"4 c #cdcdcd",
-"H c #cecece",
-"I c #cfcfcf",
-"2 c #d0d0d0",
-"N c #d1d1d1",
-"w c #d2d2d2",
-"q c #d4d4d4",
-"e c #d5d5d5",
-"n c #d6d6d6",
-"t c #d7d7d7",
-"s c #d8d8d8",
-"p c #d9d9d9",
-"j c #dadada",
-"m c #dbdbdb",
-"U c #dedede",
-"i c #dfdfdf",
-"h c #e0e0e0",
-"b c #e1e1e1",
-"d c #e3e3e3",
-"c c #e4e4e4",
-"X c #e6e6e6",
-"..#abc",
-"cdefgb",
-"hhijkl",
-"mmjno#",
-"pppqr#",
-"sstquv",
-"ttnwxk",
-"ntqwyz",
-"ttqAyB",
-"CCDEFG",
-"HIJKLM",
-"wNwAOP",
-"ntnHQR",
-"jppwST",
-"UUmqCV",
-"bbUjWP",
-"XXbpJY",
-"XXXiKZ",
-"XXXh01",
-"X2o3Y4",
-"5.67Cj",
-"89Jqmm"};
-
static const char * const qt_mac_toolbar_ext[]={
"14 9 4 1",
"# c #858585",
diff --git a/src/gui/styles/qmotifstyle.cpp b/src/gui/styles/qmotifstyle.cpp
index d9d5098..904a8f56 100644
--- a/src/gui/styles/qmotifstyle.cpp
+++ b/src/gui/styles/qmotifstyle.cpp
@@ -1,7 +1,6 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the QtGui module of the Qt Toolkit.
@@ -21,9 +20,10 @@
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.1, included in the file LGPL_EXCEPTION.txt in this
+** package.
**
** If you have questions regarding the use of this file, please contact
** Nokia at qt-info@nokia.com.
@@ -386,7 +386,7 @@ void QMotifStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, QP
case PE_FrameTabWidget:
case PE_FrameWindow:
- qDrawShadePanel(p, opt->rect, opt->palette, QStyle::State_None, pixelMetric(PM_DefaultFrameWidth));
+ qDrawShadePanel(p, opt->rect, opt->palette, QStyle::State_None, proxy()->pixelMetric(PM_DefaultFrameWidth));
break;
case PE_FrameFocusRect:
if (const QStyleOptionFocusRect *fropt = qstyleoption_cast<const QStyleOptionFocusRect *>(opt)) {
@@ -475,7 +475,7 @@ void QMotifStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, QP
fill = opt->palette.brush(QPalette::Button);
if ((opt->state & State_Enabled || opt->state & State_On) || !(opt->state & State_AutoRaise))
qDrawShadePanel(p, opt->rect, opt->palette, bool(opt->state & (State_Sunken | State_On)),
- pixelMetric(PM_DefaultFrameWidth), &fill);
+ proxy()->pixelMetric(PM_DefaultFrameWidth), &fill);
break; }
case PE_IndicatorCheckBox: {
@@ -490,9 +490,9 @@ void QMotifStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, QP
opt->rect.x(), opt->rect.y() + opt->rect.height() - 1);
} else {
qDrawShadePanel(p, opt->rect, opt->palette, !showUp,
- pixelMetric(PM_DefaultFrameWidth), &fill);
+ proxy()->pixelMetric(PM_DefaultFrameWidth), &fill);
}
- if (!(opt->state & State_Enabled) && styleHint(SH_DitherDisabledText))
+ if (!(opt->state & State_Enabled) && proxy()->styleHint(SH_DitherDisabledText))
p->fillRect(opt->rect, QBrush(p->background().color(), Qt::Dense5Pattern));
break; }
@@ -545,7 +545,7 @@ void QMotifStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, QP
a.setPoints(INTARRLEN(bottom_pts), bottom_pts);
a.translate(opt->rect.x(), opt->rect.y());
p->drawPolyline(a);
- if (!(opt->state & State_Enabled) && styleHint(SH_DitherDisabledText))
+ if (!(opt->state & State_Enabled) && proxy()->styleHint(SH_DitherDisabledText))
p->fillRect(opt->rect, QBrush(p->background().color(), Qt::Dense5Pattern));
p->setPen(oldPen);
p->setBrush(oldBrush);
@@ -736,13 +736,13 @@ void QMotifStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, QP
#undef CLEFT
#undef CTOP
#undef CBOT
- if (!(opt->state & State_Enabled) && styleHint(SH_DitherDisabledText))
+ if (!(opt->state & State_Enabled) && proxy()->styleHint(SH_DitherDisabledText))
p->fillRect(opt->rect, QBrush(p->background().color(), Qt::Dense5Pattern));
break; }
case PE_IndicatorDockWidgetResizeHandle: {
const int motifOffset = 10;
- int sw = pixelMetric(PM_SplitterWidth);
+ int sw = proxy()->pixelMetric(PM_SplitterWidth);
if (opt->state & State_Horizontal) {
int yPos = opt->rect.y() + opt->rect.height() / 2;
int kPos = opt->rect.right() - motifOffset - sw;
@@ -769,7 +769,7 @@ void QMotifStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, QP
const int markH = 6;
int posX = opt->rect.x() + (opt->rect.width() - markW) / 2 - 1;
int posY = opt->rect.y() + (opt->rect.height() - markH) / 2;
- int dfw = pixelMetric(PM_DefaultFrameWidth);
+ int dfw = proxy()->pixelMetric(PM_DefaultFrameWidth);
if (dfw < 2) {
// Could do with some optimizing/caching...
@@ -843,7 +843,7 @@ void QMotifStyle::drawControl(ControlElement element, const QStyleOption *opt, Q
handleOpt.state &= ~State_Horizontal;
else
handleOpt.state |= State_Horizontal;
- drawPrimitive(PE_IndicatorDockWidgetResizeHandle, &handleOpt, p, widget);
+ proxy()->drawPrimitive(PE_IndicatorDockWidgetResizeHandle, &handleOpt, p, widget);
break; }
case CE_ScrollBarSubLine:
@@ -855,9 +855,9 @@ void QMotifStyle::drawControl(ControlElement element, const QStyleOption *opt, Q
pe = (opt->state & State_Horizontal) ? (opt->direction == Qt::LeftToRight ? PE_IndicatorArrowLeft : PE_IndicatorArrowRight) : PE_IndicatorArrowUp;
QStyleOption arrowOpt = *opt;
arrowOpt.state |= State_Enabled;
- drawPrimitive(pe, &arrowOpt, p, widget);
- if (!(opt->state & State_Enabled) && styleHint(SH_DitherDisabledText)) {
- int fw = pixelMetric(PM_DefaultFrameWidth);
+ proxy()->drawPrimitive(pe, &arrowOpt, p, widget);
+ if (!(opt->state & State_Enabled) && proxy()->styleHint(SH_DitherDisabledText)) {
+ int fw = proxy()->pixelMetric(PM_DefaultFrameWidth);
p->fillRect(opt->rect.adjusted(fw, fw, -fw, -fw), QBrush(p->background().color(), Qt::Dense5Pattern));
}
}break;
@@ -873,9 +873,9 @@ void QMotifStyle::drawControl(ControlElement element, const QStyleOption *opt, Q
bevelOpt.state &= ~(State_Sunken | State_On);
p->save();
p->setBrushOrigin(bevelOpt.rect.topLeft());
- drawPrimitive(PE_PanelButtonBevel, &bevelOpt, p, widget);
+ proxy()->drawPrimitive(PE_PanelButtonBevel, &bevelOpt, p, widget);
p->restore();
- if (!(opt->state & State_Enabled) && styleHint(SH_DitherDisabledText))
+ if (!(opt->state & State_Enabled) && proxy()->styleHint(SH_DitherDisabledText))
p->fillRect(opt->rect, QBrush(p->background().color(), Qt::Dense5Pattern));
break; }
@@ -886,31 +886,31 @@ void QMotifStyle::drawControl(ControlElement element, const QStyleOption *opt, Q
QStyleOptionButton subopt = *btn;
subopt.rect = subElementRect(isRadio ? SE_RadioButtonIndicator
: SE_CheckBoxIndicator, btn, widget);
- drawPrimitive(isRadio ? PE_IndicatorRadioButton : PE_IndicatorCheckBox,
+ proxy()->drawPrimitive(isRadio ? PE_IndicatorRadioButton : PE_IndicatorCheckBox,
&subopt, p, widget);
subopt.rect = subElementRect(isRadio ? SE_RadioButtonContents
: SE_CheckBoxContents, btn, widget);
- drawControl(isRadio ? CE_RadioButtonLabel : CE_CheckBoxLabel, &subopt, p, widget);
+ proxy()->drawControl(isRadio ? CE_RadioButtonLabel : CE_CheckBoxLabel, &subopt, p, widget);
if ((btn->state & State_HasFocus) && (!focus || !focus->isVisible())) {
QStyleOptionFocusRect fropt;
fropt.QStyleOption::operator=(*btn);
fropt.rect = subElementRect(isRadio ? SE_RadioButtonFocusRect
: SE_CheckBoxFocusRect, btn, widget);
- drawPrimitive(PE_FrameFocusRect, &fropt, p, widget);
+ proxy()->drawPrimitive(PE_FrameFocusRect, &fropt, p, widget);
}
}
break;
case CE_PushButton:
if (const QStyleOptionButton *btn = qstyleoption_cast<const QStyleOptionButton *>(opt)) {
- drawControl(CE_PushButtonBevel, btn, p, widget);
+ proxy()->drawControl(CE_PushButtonBevel, btn, p, widget);
QStyleOptionButton subopt = *btn;
subopt.rect = subElementRect(SE_PushButtonContents, btn, widget);
- drawControl(CE_PushButtonLabel, &subopt, p, widget);
+ proxy()->drawControl(CE_PushButtonLabel, &subopt, p, widget);
if ((btn->state & State_HasFocus) && (!focus || !focus->isVisible())) {
QStyleOptionFocusRect fropt;
fropt.QStyleOption::operator=(*btn);
fropt.rect = subElementRect(SE_PushButtonFocusRect, btn, widget);
- drawPrimitive(PE_FrameFocusRect, &fropt, p, widget);
+ proxy()->drawPrimitive(PE_FrameFocusRect, &fropt, p, widget);
}
}
break;
@@ -919,7 +919,7 @@ void QMotifStyle::drawControl(ControlElement element, const QStyleOption *opt, Q
int diw, x1, y1, x2, y2;
p->setPen(opt->palette.foreground().color());
p->setBrush(QBrush(opt->palette.button().color(), Qt::NoBrush));
- diw = pixelMetric(PM_ButtonDefaultIndicator);
+ diw = proxy()->pixelMetric(PM_ButtonDefaultIndicator);
opt->rect.getCoords(&x1, &y1, &x2, &y2);
if (btn->features & (QStyleOptionButton::AutoDefaultButton|QStyleOptionButton::DefaultButton)) {
x1 += diw;
@@ -948,14 +948,14 @@ void QMotifStyle::drawControl(ControlElement element, const QStyleOption *opt, Q
QStyleOptionButton newOpt = *btn;
newOpt.rect = QRect(x1, y1, x2 - x1 + 1, y2 - y1 + 1);
p->setBrushOrigin(p->brushOrigin());
- drawPrimitive(PE_PanelButtonCommand, &newOpt, p, widget);
+ proxy()->drawPrimitive(PE_PanelButtonCommand, &newOpt, p, widget);
}
if (btn->features & QStyleOptionButton::HasMenu) {
- int mbi = pixelMetric(PM_MenuButtonIndicator, btn, widget);
+ int mbi = proxy()->pixelMetric(PM_MenuButtonIndicator, btn, widget);
QRect ir = btn->rect;
QStyleOptionButton newBtn = *btn;
newBtn.rect = QRect(ir.right() - mbi - 3, ir.y() + 4, mbi, ir.height() - 8);
- drawPrimitive(PE_IndicatorArrowDown, &newBtn, p, widget);
+ proxy()->drawPrimitive(PE_IndicatorArrowDown, &newBtn, p, widget);
}
break;
}
@@ -963,7 +963,7 @@ void QMotifStyle::drawControl(ControlElement element, const QStyleOption *opt, Q
#ifndef QT_NO_TABBAR
case CE_TabBarTabShape:
if (const QStyleOptionTab *tab = qstyleoption_cast<const QStyleOptionTab *>(opt)) {
- const int default_frame = pixelMetric(PM_DefaultFrameWidth, tab, widget);
+ const int default_frame = proxy()->pixelMetric(PM_DefaultFrameWidth, tab, widget);
const int frame_offset = (default_frame > 1) ? 1 : 0;
if (tab->shape == QTabBar::RoundedNorth || tab->shape == QTabBar::RoundedEast ||
@@ -1081,7 +1081,7 @@ void QMotifStyle::drawControl(ControlElement element, const QStyleOption *opt, Q
}
p->setTransform(m, true);
}
- const int unit_width = pixelMetric(PM_ProgressBarChunkWidth, opt, widget);
+ const int unit_width = proxy()->pixelMetric(PM_ProgressBarChunkWidth, opt, widget);
int u = rect.width() / unit_width;
int p_v = pb->progress - pb->minimum;
int t_s = qMax(0, pb->maximum - pb->minimum);
@@ -1150,7 +1150,7 @@ void QMotifStyle::drawControl(ControlElement element, const QStyleOption *opt, Q
QFont oldFont = p->font();
p->setFont(menuitem->font);
p->fillRect(x, y, w, h, opt->palette.brush(QPalette::Button));
- drawItemText(p, menuitem->rect.adjusted(10, 0, -5, 0), Qt::AlignLeft | Qt::AlignVCenter,
+ proxy()->drawItemText(p, menuitem->rect.adjusted(10, 0, -5, 0), Qt::AlignLeft | Qt::AlignVCenter,
menuitem->palette, menuitem->state & State_Enabled, menuitem->text,
QPalette::Text);
textWidth = menuitem->fontMetrics.width(menuitem->text) + 10;
@@ -1220,10 +1220,10 @@ void QMotifStyle::drawControl(ControlElement element, const QStyleOption *opt, Q
}
if (menuitem->checkType & QStyleOptionMenuItem::Exclusive) {
newMenuItem.rect.setRect(xvis + 2, y + motifItemFrame + mh / 4, 11, 11);
- drawPrimitive(PE_IndicatorRadioButton, &newMenuItem, p, widget);
+ proxy()->drawPrimitive(PE_IndicatorRadioButton, &newMenuItem, p, widget);
} else {
newMenuItem.rect.setRect(xvis + 5, y + motifItemFrame + mh / 4, 9, 9);
- drawPrimitive(PE_IndicatorCheckBox, &newMenuItem, p, widget);
+ proxy()->drawPrimitive(PE_IndicatorCheckBox, &newMenuItem, p, widget);
}
}
@@ -1258,14 +1258,14 @@ void QMotifStyle::drawControl(ControlElement element, const QStyleOption *opt, Q
int xv = vr.x();
QRect tr(xv, y+m, menuitem->tabWidth, h-2*m);
p->drawText(tr, text_flags, s.mid(t+1));
- if (!(opt->state & State_Enabled) && styleHint(SH_DitherDisabledText))
+ if (!(opt->state & State_Enabled) && proxy()->styleHint(SH_DitherDisabledText))
p->fillRect(tr, QBrush(p->background().color(), Qt::Dense5Pattern));
s = s.left(t);
}
QRect tr(xvis, y+m, w - xm - menuitem->tabWidth + 1, h-2*m);
p->drawText(tr, text_flags, s.left(t));
p->setFont(oldFont);
- if (!(opt->state & State_Enabled) && styleHint(SH_DitherDisabledText))
+ if (!(opt->state & State_Enabled) && proxy()->styleHint(SH_DitherDisabledText))
p->fillRect(tr, QBrush(p->background().color(), Qt::Dense5Pattern));
}
if (menuitem->menuItemType == QStyleOptionMenuItem::SubMenu) { // draw sub menu arrow
@@ -1279,7 +1279,7 @@ void QMotifStyle::drawControl(ControlElement element, const QStyleOption *opt, Q
arrowOpt.state = (State_Sunken | ((opt->state & State_Enabled) ? State_Enabled : State_None));
else
arrowOpt.state = ((opt->state & State_Enabled) ? State_Enabled : State_None);
- drawPrimitive(arrow, &arrowOpt, p, widget);
+ proxy()->drawPrimitive(arrow, &arrowOpt, p, widget);
}
break; }
@@ -1296,7 +1296,7 @@ void QMotifStyle::drawControl(ControlElement element, const QStyleOption *opt, Q
p->save();
p->setBrushOrigin(opt->rect.topLeft());
qDrawShadePanel(p, opt->rect, opt->palette, bool(opt->state & (State_Sunken|State_On)),
- pixelMetric(PM_DefaultFrameWidth),
+ proxy()->pixelMetric(PM_DefaultFrameWidth),
&opt->palette.brush((opt->state & State_Sunken) ? QPalette::Mid : QPalette::Button));
p->restore();
break;
@@ -1431,8 +1431,8 @@ void QMotifStyle::drawComplexControl(ComplexControl cc, const QStyleOptionComple
if (const QStyleOptionToolButton *toolbutton
= qstyleoption_cast<const QStyleOptionToolButton *>(opt)) {
QRect button, menuarea;
- button = subControlRect(cc, toolbutton, SC_ToolButton, widget);
- menuarea = subControlRect(cc, toolbutton, SC_ToolButtonMenu, widget);
+ button = proxy()->subControlRect(cc, toolbutton, SC_ToolButton, widget);
+ menuarea = proxy()->subControlRect(cc, toolbutton, SC_ToolButtonMenu, widget);
State bflags = toolbutton->state & ~State_Sunken;
if (bflags & State_AutoRaise) {
@@ -1453,7 +1453,7 @@ void QMotifStyle::drawComplexControl(ComplexControl cc, const QStyleOptionComple
if (bflags & (State_Sunken | State_On | State_Raised)) {
tool.rect = button;
tool.state = bflags;
- drawPrimitive(PE_PanelButtonTool, &tool, p, widget);
+ proxy()->drawPrimitive(PE_PanelButtonTool, &tool, p, widget);
}
}
@@ -1461,26 +1461,26 @@ void QMotifStyle::drawComplexControl(ComplexControl cc, const QStyleOptionComple
QStyleOptionFocusRect fr;
fr.QStyleOption::operator=(*toolbutton);
fr.rect = toolbutton->rect.adjusted(3, 3, -3, -3);
- drawPrimitive(PE_FrameFocusRect, &fr, p, widget);
+ proxy()->drawPrimitive(PE_FrameFocusRect, &fr, p, widget);
}
QStyleOptionToolButton label = *toolbutton;
label.state = bflags;
- int fw = pixelMetric(PM_DefaultFrameWidth, opt, widget);
+ int fw = proxy()->pixelMetric(PM_DefaultFrameWidth, opt, widget);
label.rect = button.adjusted(fw, fw, -fw, -fw);
- drawControl(CE_ToolButtonLabel, &label, p, widget);
+ proxy()->drawControl(CE_ToolButtonLabel, &label, p, widget);
if (toolbutton->subControls & SC_ToolButtonMenu) {
tool.rect = menuarea;
tool.state = mflags;
if (mflags & (State_Sunken | State_On | State_Raised))
- drawPrimitive(PE_IndicatorButtonDropDown, &tool, p, widget);
- drawPrimitive(PE_IndicatorArrowDown, &tool, p, widget);
+ proxy()->drawPrimitive(PE_IndicatorButtonDropDown, &tool, p, widget);
+ proxy()->drawPrimitive(PE_IndicatorArrowDown, &tool, p, widget);
} else if (toolbutton->features & QStyleOptionToolButton::HasMenu) {
- int mbi = pixelMetric(PM_MenuButtonIndicator, toolbutton, widget);
+ int mbi = proxy()->pixelMetric(PM_MenuButtonIndicator, toolbutton, widget);
QRect ir = toolbutton->rect;
QStyleOptionToolButton newBtn = *toolbutton;
newBtn.rect = QRect(ir.right() + 5 - mbi, ir.height() - mbi + 4, mbi - 6, mbi - 6);
- drawPrimitive(PE_IndicatorArrowDown, &newBtn, p, widget);
+ proxy()->drawPrimitive(PE_IndicatorArrowDown, &newBtn, p, widget);
}
}
break;
@@ -1491,18 +1491,18 @@ void QMotifStyle::drawComplexControl(ComplexControl cc, const QStyleOptionComple
PrimitiveElement pe;
if (spinbox->frame && (spinbox->subControls & SC_SpinBoxFrame)) {
- QRect r = subControlRect(CC_SpinBox, spinbox, SC_SpinBoxFrame, widget);
- qDrawShadePanel(p, r, opt->palette, false, pixelMetric(PM_SpinBoxFrameWidth));
+ QRect r = proxy()->subControlRect(CC_SpinBox, spinbox, SC_SpinBoxFrame, widget);
+ qDrawShadePanel(p, r, opt->palette, false, proxy()->pixelMetric(PM_SpinBoxFrameWidth));
- int fw = pixelMetric(QStyle::PM_DefaultFrameWidth);
- r = subControlRect(CC_SpinBox, spinbox, SC_SpinBoxEditField, widget).adjusted(-fw,-fw,fw,fw);
+ int fw = proxy()->pixelMetric(QStyle::PM_DefaultFrameWidth);
+ r = proxy()->subControlRect(CC_SpinBox, spinbox, SC_SpinBoxEditField, widget).adjusted(-fw,-fw,fw,fw);
QStyleOptionFrame lineOpt;
lineOpt.QStyleOption::operator=(*opt);
lineOpt.rect = r;
lineOpt.lineWidth = fw;
lineOpt.midLineWidth = 0;
lineOpt.state |= QStyle::State_Sunken;
- drawPrimitive(QStyle::PE_FrameLineEdit, &lineOpt, p, widget);
+ proxy()->drawPrimitive(QStyle::PE_FrameLineEdit, &lineOpt, p, widget);
}
if (spinbox->subControls & SC_SpinBoxUp) {
@@ -1525,8 +1525,8 @@ void QMotifStyle::drawComplexControl(ComplexControl cc, const QStyleOptionComple
pe = (spinbox->buttonSymbols == QAbstractSpinBox::PlusMinus ? PE_IndicatorSpinPlus
: PE_IndicatorSpinUp);
- copy.rect = subControlRect(CC_SpinBox, spinbox, SC_SpinBoxUp, widget);
- drawPrimitive(pe, &copy, p, widget);
+ copy.rect = proxy()->subControlRect(CC_SpinBox, spinbox, SC_SpinBoxUp, widget);
+ proxy()->drawPrimitive(pe, &copy, p, widget);
}
if (spinbox->subControls & SC_SpinBoxDown) {
@@ -1549,8 +1549,8 @@ void QMotifStyle::drawComplexControl(ComplexControl cc, const QStyleOptionComple
pe = (spinbox->buttonSymbols == QAbstractSpinBox::PlusMinus ? PE_IndicatorSpinMinus
: PE_IndicatorSpinDown);
- copy.rect = subControlRect(CC_SpinBox, spinbox, SC_SpinBoxDown, widget);
- drawPrimitive(pe, &copy, p, widget);
+ copy.rect = proxy()->subControlRect(CC_SpinBox, spinbox, SC_SpinBoxDown, widget);
+ proxy()->drawPrimitive(pe, &copy, p, widget);
}
}
break;
@@ -1558,16 +1558,16 @@ void QMotifStyle::drawComplexControl(ComplexControl cc, const QStyleOptionComple
#ifndef QT_NO_SLIDER
case CC_Slider:
if (const QStyleOptionSlider *slider = qstyleoption_cast<const QStyleOptionSlider *>(opt)) {
- QRect groove = subControlRect(CC_Slider, opt, SC_SliderGroove, widget),
- handle = subControlRect(CC_Slider, opt, SC_SliderHandle, widget);
+ QRect groove = proxy()->subControlRect(CC_Slider, opt, SC_SliderGroove, widget),
+ handle = proxy()->subControlRect(CC_Slider, opt, SC_SliderHandle, widget);
if ((opt->subControls & SC_SliderGroove) && groove.isValid()) {
- qDrawShadePanel(p, groove, opt->palette, true, pixelMetric(PM_DefaultFrameWidth),
+ qDrawShadePanel(p, groove, opt->palette, true, proxy()->pixelMetric(PM_DefaultFrameWidth),
&opt->palette.brush((opt->state & State_Enabled) ? QPalette::Mid : QPalette::Window));
if ((opt->state & State_HasFocus) && (!focus || !focus->isVisible())) {
QStyleOption focusOpt = *opt;
focusOpt.rect = subElementRect(SE_SliderFocusRect, opt, widget);
- drawPrimitive(PE_FrameFocusRect, &focusOpt, p, widget);
+ proxy()->drawPrimitive(PE_FrameFocusRect, &focusOpt, p, widget);
}
}
@@ -1577,7 +1577,7 @@ void QMotifStyle::drawComplexControl(ComplexControl cc, const QStyleOptionComple
bevelOpt.rect = handle;
p->save();
p->setBrushOrigin(bevelOpt.rect.topLeft());
- drawPrimitive(PE_PanelButtonBevel, &bevelOpt, p, widget);
+ proxy()->drawPrimitive(PE_PanelButtonBevel, &bevelOpt, p, widget);
p->restore();
if (slider->orientation == Qt::Horizontal) {
@@ -1589,14 +1589,14 @@ void QMotifStyle::drawComplexControl(ComplexControl cc, const QStyleOptionComple
qDrawShadeLine(p, handle.x(), mid, handle.x() + handle.width() - 2, mid, opt->palette,
true, 1);
}
- if (!(opt->state & State_Enabled) && styleHint(SH_DitherDisabledText))
+ if (!(opt->state & State_Enabled) && proxy()->styleHint(SH_DitherDisabledText))
p->fillRect(handle, QBrush(p->background().color(), Qt::Dense5Pattern));
}
if (slider->subControls & SC_SliderTickmarks) {
QStyleOptionSlider tmpSlider = *slider;
tmpSlider.subControls = SC_SliderTickmarks;
- int frameWidth = pixelMetric(PM_DefaultFrameWidth);
+ int frameWidth = proxy()->pixelMetric(PM_DefaultFrameWidth);
tmpSlider.rect.translate(frameWidth - 1, 0);
QCommonStyle::drawComplexControl(cc, &tmpSlider, p, widget);
}
@@ -1607,13 +1607,13 @@ void QMotifStyle::drawComplexControl(ComplexControl cc, const QStyleOptionComple
if (const QStyleOptionComboBox *cb = qstyleoption_cast<const QStyleOptionComboBox *>(opt)) {
if (opt->subControls & SC_ComboBoxArrow) {
int awh, ax, ay, sh, sy, dh, ew;
- int fw = cb->frame ? pixelMetric(PM_ComboBoxFrameWidth, opt, widget) : 0;
+ int fw = cb->frame ? proxy()->pixelMetric(PM_ComboBoxFrameWidth, opt, widget) : 0;
if (cb->frame) {
QStyleOptionButton btn;
btn.QStyleOption::operator=(*cb);
btn.state |= QStyle::State_Raised;
- drawPrimitive(PE_PanelButtonCommand, &btn, p, widget);
+ proxy()->drawPrimitive(PE_PanelButtonCommand, &btn, p, widget);
} else {
p->fillRect(opt->rect, opt->palette.brush(QPalette::Button));
}
@@ -1627,7 +1627,7 @@ void QMotifStyle::drawComplexControl(ComplexControl cc, const QStyleOptionComple
QStyleOption arrowOpt = *opt;
arrowOpt.rect = ar;
arrowOpt.state |= State_Enabled;
- drawPrimitive(PE_IndicatorArrowDown, &arrowOpt, p, widget);
+ proxy()->drawPrimitive(PE_IndicatorArrowDown, &arrowOpt, p, widget);
// draws the shaded line under the arrow
@@ -1643,13 +1643,13 @@ void QMotifStyle::drawComplexControl(ComplexControl cc, const QStyleOptionComple
focus.QStyleOption::operator=(*opt);
focus.rect = subElementRect(SE_ComboBoxFocusRect, opt, widget);
focus.backgroundColor = opt->palette.button().color();
- drawPrimitive(PE_FrameFocusRect, &focus, p, widget);
+ proxy()->drawPrimitive(PE_FrameFocusRect, &focus, p, widget);
}
}
if (opt->subControls & SC_ComboBoxEditField) {
if (cb->editable) {
- QRect er = subControlRect(CC_ComboBox, opt, SC_ComboBoxEditField, widget);
+ QRect er = proxy()->subControlRect(CC_ComboBox, opt, SC_ComboBoxEditField, widget);
er.adjust(-1, -1, 1, 1);
qDrawShadePanel(p, er, opt->palette, true, 1,
&opt->palette.brush(QPalette::Base));
@@ -1663,7 +1663,7 @@ void QMotifStyle::drawComplexControl(ComplexControl cc, const QStyleOptionComple
case CC_ScrollBar: {
if (opt->subControls & SC_ScrollBarGroove)
qDrawShadePanel(p, opt->rect, opt->palette, true,
- pixelMetric(PM_DefaultFrameWidth, opt, widget),
+ proxy()->pixelMetric(PM_DefaultFrameWidth, opt, widget),
&opt->palette.brush((opt->state & State_Enabled) ? QPalette::Mid : QPalette::Window));
if (const QStyleOptionSlider *scrollbar = qstyleoption_cast<const QStyleOptionSlider *>(opt)) {
@@ -1798,7 +1798,7 @@ int QMotifStyle::pixelMetric(PixelMetric pm, const QStyleOption *opt,
break;
case PM_ToolBarFrameWidth:
- ret = pixelMetric(PM_DefaultFrameWidth);
+ ret = proxy()->pixelMetric(PM_DefaultFrameWidth);
break;
case PM_ToolBarItemMargin:
@@ -1819,7 +1819,7 @@ int QMotifStyle::pixelMetric(PixelMetric pm, const QStyleOption *opt,
break;
case PM_SliderThickness:
- ret = 16 + 4 * pixelMetric(PM_DefaultFrameWidth);
+ ret = 16 + 4 * proxy()->pixelMetric(PM_DefaultFrameWidth);
break;
#ifndef QT_NO_SLIDER
case PM_SliderControlThickness:
@@ -1849,9 +1849,9 @@ int QMotifStyle::pixelMetric(PixelMetric pm, const QStyleOption *opt,
case PM_SliderSpaceAvailable:
if (const QStyleOptionSlider *sl = qstyleoption_cast<const QStyleOptionSlider *>(opt)) {
if (sl->orientation == Qt::Horizontal)
- ret = sl->rect.width() - pixelMetric(PM_SliderLength, opt, widget) - 2 * pixelMetric(PM_DefaultFrameWidth, opt, widget);
+ ret = sl->rect.width() - proxy()->pixelMetric(PM_SliderLength, opt, widget) - 2 * proxy()->pixelMetric(PM_DefaultFrameWidth, opt, widget);
else
- ret = sl->rect.height() - pixelMetric(PM_SliderLength, opt, widget) - 2 * pixelMetric(PM_DefaultFrameWidth, opt, widget);
+ ret = sl->rect.height() - proxy()->pixelMetric(PM_SliderLength, opt, widget) - 2 * proxy()->pixelMetric(PM_DefaultFrameWidth, opt, widget);
}
break;
#endif // QT_NO_SLIDER
@@ -1901,7 +1901,7 @@ QMotifStyle::subControlRect(ComplexControl cc, const QStyleOptionComplex *opt,
#ifndef QT_NO_SPINBOX
case CC_SpinBox:
if (const QStyleOptionSpinBox *spinbox = qstyleoption_cast<const QStyleOptionSpinBox *>(opt)) {
- int fw = spinbox->frame ? pixelMetric(PM_SpinBoxFrameWidth, spinbox, widget) : 0;
+ int fw = spinbox->frame ? proxy()->pixelMetric(PM_SpinBoxFrameWidth, spinbox, widget) : 0;
QSize bs;
bs.setHeight(opt->rect.height()/2 - fw);
bs.setWidth(qMin(bs.height() * 8 / 5, opt->rect.width() / 4)); // 1.6 -approximate golden mean
@@ -1944,11 +1944,11 @@ QMotifStyle::subControlRect(ComplexControl cc, const QStyleOptionComplex *opt,
case CC_Slider:
if (const QStyleOptionSlider *slider = qstyleoption_cast<const QStyleOptionSlider *>(opt)) {
if (sc == SC_SliderHandle) {
- int tickOffset = pixelMetric(PM_SliderTickmarkOffset, opt, widget);
- int thickness = pixelMetric(PM_SliderControlThickness, opt, widget);
+ int tickOffset = proxy()->pixelMetric(PM_SliderTickmarkOffset, opt, widget);
+ int thickness = proxy()->pixelMetric(PM_SliderControlThickness, opt, widget);
bool horizontal = slider->orientation == Qt::Horizontal;
- int len = pixelMetric(PM_SliderLength, opt, widget);
- int motifBorder = pixelMetric(PM_DefaultFrameWidth);
+ int len = proxy()->pixelMetric(PM_SliderLength, opt, widget);
+ int motifBorder = proxy()->pixelMetric(PM_DefaultFrameWidth);
int sliderPos = sliderPositionFromValue(slider->minimum, slider->maximum, slider->sliderPosition,
horizontal ? slider->rect.width() - len - 2 * motifBorder
: slider->rect.height() - len - 2 * motifBorder,
@@ -1967,7 +1967,7 @@ QMotifStyle::subControlRect(ComplexControl cc, const QStyleOptionComplex *opt,
#ifndef QT_NO_SCROLLBAR
case CC_ScrollBar:
if (const QStyleOptionSlider *scrollbar = qstyleoption_cast<const QStyleOptionSlider *>(opt)) {
- int dfw = pixelMetric(PM_DefaultFrameWidth);
+ int dfw = proxy()->pixelMetric(PM_DefaultFrameWidth);
QRect rect = visualRect(scrollbar->direction, scrollbar->rect,
QCommonStyle::subControlRect(cc, scrollbar, sc, widget));
if (sc == SC_ScrollBarSlider) {
@@ -1991,7 +1991,7 @@ QMotifStyle::subControlRect(ComplexControl cc, const QStyleOptionComplex *opt,
switch (sc) {
case SC_ComboBoxArrow: {
int ew, awh, sh, dh, ax, ay, sy;
- int fw = cb->frame ? pixelMetric(PM_ComboBoxFrameWidth, opt, widget) : 0;
+ int fw = cb->frame ? proxy()->pixelMetric(PM_ComboBoxFrameWidth, opt, widget) : 0;
QRect cr = opt->rect;
cr.adjust(fw, fw, -fw, -fw);
get_combo_parameters(cr, ew, awh, ax, ay, sh, dh, sy);
@@ -1999,7 +1999,7 @@ QMotifStyle::subControlRect(ComplexControl cc, const QStyleOptionComplex *opt,
}
case SC_ComboBoxEditField: {
- int fw = cb->frame ? pixelMetric(PM_ComboBoxFrameWidth, opt, widget) : 0;
+ int fw = cb->frame ? proxy()->pixelMetric(PM_ComboBoxFrameWidth, opt, widget) : 0;
QRect rect = opt->rect;
rect.adjust(fw, fw, -fw, -fw);
int ew = get_combo_extra_width(rect.height(), rect.width());
@@ -2029,10 +2029,6 @@ QMotifStyle::sizeFromContents(ContentsType ct, const QStyleOption *opt,
QSize sz(contentsSize);
switch(ct) {
- case CT_Splitter:
- sz = QSize(10, 10);
- break;
-
case CT_RadioButton:
case CT_CheckBox:
sz = QCommonStyle::sizeFromContents(ct, opt, contentsSize, widget);
@@ -2119,7 +2115,7 @@ QMotifStyle::subElementRect(SubElement sr, const QStyleOption *opt, const QWidge
case SE_ComboBoxFocusRect:
{
int awh, ax, ay, sh, sy, dh, ew;
- int fw = pixelMetric(PM_DefaultFrameWidth, opt, widget);
+ int fw = proxy()->pixelMetric(PM_DefaultFrameWidth, opt, widget);
QRect tr = opt->rect;
tr.adjust(fw, fw, -fw, -fw);
@@ -2687,6 +2683,9 @@ QMotifStyle::styleHint(StyleHint hint, const QStyleOption *opt, const QWidget *w
case SH_LineEdit_PasswordCharacter:
ret = '*';
break;
+ case SH_DialogButtonBox_ButtonsHaveIcons:
+ ret = 0;
+ break;
default:
ret = QCommonStyle::styleHint(hint, opt, widget, returnData);
break;
diff --git a/src/gui/styles/qmotifstyle.h b/src/gui/styles/qmotifstyle.h
index 521f218..93518fe 100644
--- a/src/gui/styles/qmotifstyle.h
+++ b/src/gui/styles/qmotifstyle.h
@@ -1,7 +1,6 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the QtGui module of the Qt Toolkit.
@@ -21,9 +20,10 @@
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.1, included in the file LGPL_EXCEPTION.txt in this
+** package.
**
** If you have questions regarding the use of this file, please contact
** Nokia at qt-info@nokia.com.
diff --git a/src/gui/styles/qmotifstyle_p.h b/src/gui/styles/qmotifstyle_p.h
index 483df6e..ec9458d 100644
--- a/src/gui/styles/qmotifstyle_p.h
+++ b/src/gui/styles/qmotifstyle_p.h
@@ -1,7 +1,6 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the QtGui module of the Qt Toolkit.
@@ -21,9 +20,10 @@
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.1, included in the file LGPL_EXCEPTION.txt in this
+** package.
**
** If you have questions regarding the use of this file, please contact
** Nokia at qt-info@nokia.com.
diff --git a/src/gui/styles/qplastiquestyle.cpp b/src/gui/styles/qplastiquestyle.cpp
index 349a60d..bdd72b7 100644
--- a/src/gui/styles/qplastiquestyle.cpp
+++ b/src/gui/styles/qplastiquestyle.cpp
@@ -1,7 +1,6 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the QtGui module of the Qt Toolkit.
@@ -21,9 +20,10 @@
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.1, included in the file LGPL_EXCEPTION.txt in this
+** package.
**
** If you have questions regarding the use of this file, please contact
** Nokia at qt-info@nokia.com.
@@ -43,7 +43,6 @@
#if !defined(QT_NO_STYLE_PLASTIQUE) || defined(QT_PLUGIN)
-static bool UsePixmapCache = true;
static const bool AnimateBusyProgressBar = true;
static const bool AnimateProgressBar = false;
// #define QPlastique_MaskButtons
@@ -51,6 +50,7 @@ static const int ProgressBarFps = 25;
static const int blueFrameWidth = 2; // with of line edit focus frame
#include "qwindowsstyle_p.h"
+#include <private/qstylehelper_p.h>
#include <qapplication.h>
#include <qbitmap.h>
#include <qabstractitemview.h>
@@ -98,7 +98,6 @@ static const int windowsItemHMargin = 3; // menu item hor text margin
static const int windowsItemVMargin = 2; // menu item ver text margin
static const int windowsArrowHMargin = 6; // arrow horizontal margin
static const int windowsTabSpacing = 12; // space between text and tab
-static const int windowsCheckMarkHMargin = 2; // horiz. margins of check mark
static const int windowsRightBorder = 15; // right border on windows
static const int windowsCheckMarkWidth = 12; // checkmarks width on windows
@@ -490,7 +489,7 @@ static void qBrushSetAlphaF(QBrush *brush, qreal alpha)
QPixmap texture = brush->texture();
QPixmap pixmap;
QString name = QString::fromLatin1("qbrushtexture-alpha-%1-%2").arg(alpha).arg(texture.cacheKey());
- if (UsePixmapCache && !QPixmapCache::find(name, pixmap)) {
+ if (!QPixmapCache::find(name, pixmap)) {
QImage image = texture.toImage();
QRgb *rgb = reinterpret_cast<QRgb *>(image.bits());
int pixels = image.width() * image.height();
@@ -551,7 +550,7 @@ static QBrush qBrushLight(QBrush brush, int light)
QPixmap texture = brush.texture();
QPixmap pixmap;
QString name = QString::fromLatin1("qbrushtexture-light-%1-%2").arg(light).arg(texture.cacheKey());
- if (UsePixmapCache && !QPixmapCache::find(name, pixmap)) {
+ if (!QPixmapCache::find(name, pixmap)) {
QImage image = texture.toImage();
QRgb *rgb = reinterpret_cast<QRgb *>(image.bits());
int pixels = image.width() * image.height();
@@ -610,7 +609,7 @@ static QBrush qBrushDark(QBrush brush, int dark)
QPixmap texture = brush.texture();
QPixmap pixmap;
QString name = QString::fromLatin1("qbrushtexture-dark-%1-%2").arg(dark).arg(brush.texture().cacheKey());
- if (UsePixmapCache && !QPixmapCache::find(name, pixmap)) {
+ if (!QPixmapCache::find(name, pixmap)) {
QImage image = texture.toImage();
QRgb *rgb = reinterpret_cast<QRgb *>(image.bits());
int pixels = image.width() * image.height();
@@ -730,16 +729,6 @@ static QColor mergedColors(const QColor &colorA, const QColor &colorB, int facto
return tmp;
}
-static QString uniqueName(const QString &key, const QStyleOption *option, const QSize &size)
-{
- QString tmp;
- const QStyleOptionComplex *complexOption = qstyleoption_cast<const QStyleOptionComplex *>(option);
- tmp.sprintf("%s-%d-%d-%d-%lld-%dx%d", key.toLatin1().constData(), uint(option->state),
- option->direction, complexOption ? uint(complexOption->activeSubControls) : uint(0),
- option->palette.cacheKey(), size.width(), size.height());
- return tmp;
-}
-
static void qt_plastique_draw_gradient(QPainter *painter, const QRect &rect, const QColor &gradientStart,
const QColor &gradientStop)
{
@@ -749,8 +738,7 @@ static void qt_plastique_draw_gradient(QPainter *painter, const QRect &rect, con
QPainter *p = painter;
QRect r = rect;
- bool doPixmapCache = UsePixmapCache
- && painter->deviceTransform().isIdentity()
+ bool doPixmapCache = painter->deviceTransform().isIdentity()
&& painter->worldMatrix().isIdentity();
if (doPixmapCache && QPixmapCache::find(gradientName, cache)) {
painter->drawPixmap(rect, cache);
@@ -1005,8 +993,6 @@ QPlastiqueStylePrivate::QPlastiqueStylePrivate() :
, progressBarAnimateTimer(0)
#endif
{
- if (!qgetenv("QT_STYLE_NO_PIXMAPCACHE").isNull())
- UsePixmapCache = false;
}
/*!
@@ -1132,7 +1118,7 @@ void QPlastiqueStyle::drawPrimitive(PrimitiveElement element, const QStyleOption
switch (element) {
case PE_IndicatorButtonDropDown:
- drawPrimitive(PE_PanelButtonTool, option, painter, widget);
+ proxy()->drawPrimitive(PE_PanelButtonTool, option, painter, widget);
break;
case PE_FrameDefaultButton: {
if (!(option->state & QStyle::State_Enabled))
@@ -1178,7 +1164,7 @@ void QPlastiqueStyle::drawPrimitive(PrimitiveElement element, const QStyleOption
break;
}
- int borderThickness = pixelMetric(PM_TabBarBaseOverlap, twf, widget);
+ int borderThickness = proxy()->pixelMetric(PM_TabBarBaseOverlap, twf, widget);
bool reverse = (twf->direction == Qt::RightToLeft);
painter->save();
@@ -1357,7 +1343,7 @@ void QPlastiqueStyle::drawPrimitive(PrimitiveElement element, const QStyleOption
painter->setPen(oldPen);
} else {
frameV2.state &= ~(State_Sunken | State_HasFocus);
- drawPrimitive(PE_Frame, &frameV2, painter, widget);
+ proxy()->drawPrimitive(PE_Frame, &frameV2, painter, widget);
}
}
break;
@@ -1515,8 +1501,8 @@ void QPlastiqueStyle::drawPrimitive(PrimitiveElement element, const QStyleOption
rect.adjust(2, 0, -2, 0);
}
#endif
- QString pixmapName = uniqueName(QLatin1String("toolbarhandle"), option, rect.size());
- if (!UsePixmapCache || !QPixmapCache::find(pixmapName, cache)) {
+ QString pixmapName = QStyleHelper::uniqueName(QLatin1String("toolbarhandle"), option, rect.size());
+ if (!QPixmapCache::find(pixmapName, cache)) {
cache = QPixmap(rect.size());
cache.fill(Qt::transparent);
QPainter cachePainter(&cache);
@@ -1546,8 +1532,7 @@ void QPlastiqueStyle::drawPrimitive(PrimitiveElement element, const QStyleOption
handle);
}
cachePainter.end();
- if (UsePixmapCache)
- QPixmapCache::insert(pixmapName, cache);
+ QPixmapCache::insert(pixmapName, cache);
}
painter->drawPixmap(rect.topLeft(), cache);
break;
@@ -1857,13 +1842,13 @@ void QPlastiqueStyle::drawPrimitive(PrimitiveElement element, const QStyleOption
QStyleOptionButton button;
button.QStyleOption::operator=(*option);
button.state &= ~State_MouseOver;
- drawPrimitive(PE_IndicatorCheckBox, &button, painter, widget);
+ proxy()->drawPrimitive(PE_IndicatorCheckBox, &button, painter, widget);
break;
}
case PE_FrameWindow: {
painter->save();
bool active = (option->state & State_Active);
- int titleBarStop = option->rect.top() + pixelMetric(PM_TitleBarHeight, option, widget);
+ int titleBarStop = option->rect.top() + proxy()->pixelMetric(PM_TitleBarHeight, option, widget);
QPalette palette = option->palette;
if (!active)
@@ -2073,7 +2058,7 @@ void QPlastiqueStyle::drawControl(ControlElement element, const QStyleOption *op
&& !leftCornerWidget;
bool reverseShadow = false;
- int borderThickness = pixelMetric(PM_TabBarBaseOverlap, tab, widget);
+ int borderThickness = proxy()->pixelMetric(PM_TabBarBaseOverlap, tab, widget);
int marginLeft = 0;
if ((atBeginning && !selected) || (selected && leftCornerWidget && ((tab->position == QStyleOptionTab::Beginning) || onlyTab))) {
marginLeft = 1;
@@ -2585,8 +2570,7 @@ void QPlastiqueStyle::drawControl(ControlElement element, const QStyleOption *op
painter->setTransform(m, true);
}
- double vc6_workaround = ((bar->progress - qint64(bar->minimum)) / qMax(double(1.0), double(qint64(bar->maximum) - qint64(bar->minimum))) * rect.width());
- int progressIndicatorPos = int(vc6_workaround);
+ int progressIndicatorPos = (bar->progress - qreal(bar->minimum)) / qMax(qreal(1.0), qreal(bar->maximum) - bar->minimum) * rect.width();
bool flip = (!vertical && (((bar->direction == Qt::RightToLeft) && !inverted)
|| ((bar->direction == Qt::LeftToRight) && inverted))) || (vertical && ((!inverted && !bottomToTop) || (inverted && bottomToTop)));
@@ -2646,8 +2630,7 @@ void QPlastiqueStyle::drawControl(ControlElement element, const QStyleOption *op
// same rendering code for both orientations.
if (vertical) {
rect = QRect(rect.left(), rect.top(), rect.height(), rect.width()); // flip width and height
- QTransform m;
- m.translate(rect.height()-1, 0);
+ QTransform m = QTransform::fromTranslate(rect.height()-1, 0);
m.rotate(90.0);
painter->setTransform(m, true);
}
@@ -2782,10 +2765,10 @@ void QPlastiqueStyle::drawControl(ControlElement element, const QStyleOption *op
// contents
painter->setPen(QPen());
- QString progressBarName = uniqueName(QLatin1String("progressBarContents"),
+ QString progressBarName = QStyleHelper::uniqueName(QLatin1String("progressBarContents"),
option, rect.size());
QPixmap cache;
- if ((!UsePixmapCache || !QPixmapCache::find(progressBarName, cache)) && rect.height() > 7) {
+ if (!QPixmapCache::find(progressBarName, cache) && rect.height() > 7) {
QSize size = rect.size();
cache = QPixmap(QSize(size.width() - 6 + 30, size.height() - 6));
cache.fill(Qt::white);
@@ -2818,8 +2801,7 @@ void QPlastiqueStyle::drawControl(ControlElement element, const QStyleOption *op
leftEdge += 10;
}
- if (UsePixmapCache)
- QPixmapCache::insert(progressBarName, cache);
+ QPixmapCache::insert(progressBarName, cache);
}
painter->setClipRect(progressBar.adjusted(1, 0, -1, -1));
@@ -2843,11 +2825,11 @@ void QPlastiqueStyle::drawControl(ControlElement element, const QStyleOption *op
// Draws the header in tables.
if (const QStyleOptionHeader *header = qstyleoption_cast<const QStyleOptionHeader *>(option)) {
QPixmap cache;
- QString pixmapName = uniqueName(QLatin1String("headersection"), option, option->rect.size());
- pixmapName += QLatin1String("-") + QString::number(int(header->position));
- pixmapName += QLatin1String("-") + QString::number(int(header->orientation));
+ QString pixmapName = QStyleHelper::uniqueName(QLatin1String("headersection"), option, option->rect.size());
+ pixmapName += QString::number(- int(header->position));
+ pixmapName += QString::number(- int(header->orientation));
- if (!UsePixmapCache || !QPixmapCache::find(pixmapName, cache)) {
+ if (!QPixmapCache::find(pixmapName, cache)) {
cache = QPixmap(option->rect.size());
cache.fill(Qt::white);
QRect pixmapRect(0, 0, option->rect.width(), option->rect.height());
@@ -2891,8 +2873,7 @@ void QPlastiqueStyle::drawControl(ControlElement element, const QStyleOption *op
cachePainter.drawLines(lines, 2);
cachePainter.end();
- if (UsePixmapCache)
- QPixmapCache::insert(pixmapName, cache);
+ QPixmapCache::insert(pixmapName, cache);
}
painter->drawPixmap(option->rect.topLeft(), cache);
@@ -2915,7 +2896,7 @@ void QPlastiqueStyle::drawControl(ControlElement element, const QStyleOption *op
int w = 0;
if (!menuItem->text.isEmpty()) {
painter->setFont(menuItem->font);
- drawItemText(painter, menuItem->rect.adjusted(5, 0, -5, 0), Qt::AlignLeft | Qt::AlignVCenter,
+ proxy()->drawItemText(painter, menuItem->rect.adjusted(5, 0, -5, 0), Qt::AlignLeft | Qt::AlignVCenter,
menuItem->palette, menuItem->state & State_Enabled, menuItem->text,
QPalette::Text);
w = menuItem->fontMetrics.width(menuItem->text) + 5;
@@ -2958,7 +2939,7 @@ void QPlastiqueStyle::drawControl(ControlElement element, const QStyleOption *op
if (checked)
button.state |= State_On;
button.palette = menuItem->palette;
- drawPrimitive(PE_IndicatorRadioButton, &button, painter, widget);
+ proxy()->drawPrimitive(PE_IndicatorRadioButton, &button, painter, widget);
} else {
if (menuItem->icon.isNull()) {
QStyleOptionButton button;
@@ -2967,7 +2948,7 @@ void QPlastiqueStyle::drawControl(ControlElement element, const QStyleOption *op
if (checked)
button.state |= State_On;
button.palette = menuItem->palette;
- drawPrimitive(PE_IndicatorCheckBox, &button, painter, widget);
+ proxy()->drawPrimitive(PE_IndicatorCheckBox, &button, painter, widget);
} else if (checked) {
int iconSize = qMax(menuItem->maxIconWidth, 20);
QRect sunkenRect(option->rect.left() + 1,
@@ -3079,7 +3060,7 @@ void QPlastiqueStyle::drawControl(ControlElement element, const QStyleOption *op
newMI.palette.highlightedText().color());
else
newMI.palette.setColor(QPalette::ButtonText, textBrush.color());
- drawPrimitive(arrow, &newMI, painter, widget);
+ proxy()->drawPrimitive(arrow, &newMI, painter, widget);
}
painter->restore();
@@ -3091,8 +3072,8 @@ void QPlastiqueStyle::drawControl(ControlElement element, const QStyleOption *op
// Draws a menu bar item; File, Edit, Help etc..
if ((option->state & State_Selected)) {
QPixmap cache;
- QString pixmapName = uniqueName(QLatin1String("menubaritem"), option, option->rect.size());
- if (!UsePixmapCache || !QPixmapCache::find(pixmapName, cache)) {
+ QString pixmapName = QStyleHelper::uniqueName(QLatin1String("menubaritem"), option, option->rect.size());
+ if (!QPixmapCache::find(pixmapName, cache)) {
cache = QPixmap(option->rect.size());
cache.fill(Qt::white);
QRect pixmapRect(0, 0, option->rect.width(), option->rect.height());
@@ -3142,8 +3123,7 @@ void QPlastiqueStyle::drawControl(ControlElement element, const QStyleOption *op
lines[1] = QLine(rect.right() - 1, rect.top() + 1, rect.right() - 1, rect.bottom() - 2);
cachePainter.drawLines(lines, 2);
cachePainter.end();
- if (UsePixmapCache)
- QPixmapCache::insert(pixmapName, cache);
+ QPixmapCache::insert(pixmapName, cache);
}
painter->drawPixmap(option->rect.topLeft(), cache);
} else {
@@ -3455,9 +3435,9 @@ void QPlastiqueStyle::drawControl(ControlElement element, const QStyleOption *op
bool reverse = scrollBar->direction == Qt::RightToLeft;
bool sunken = scrollBar->state & State_Sunken;
- QString addLinePixmapName = uniqueName(QLatin1String("scrollbar_addline"), option, option->rect.size());
+ QString addLinePixmapName = QStyleHelper::uniqueName(QLatin1String("scrollbar_addline"), option, option->rect.size());
QPixmap cache;
- if (!UsePixmapCache || !QPixmapCache::find(addLinePixmapName, cache)) {
+ if (!QPixmapCache::find(addLinePixmapName, cache)) {
cache = QPixmap(option->rect.size());
cache.fill(Qt::white);
QRect pixmapRect(0, 0, cache.width(), cache.height());
@@ -3516,8 +3496,7 @@ void QPlastiqueStyle::drawControl(ControlElement element, const QStyleOption *op
addLinePainter.drawImage(QPoint(pixmapRect.center().x() - 3, pixmapRect.center().y() - 2), arrow);
}
addLinePainter.end();
- if (UsePixmapCache)
- QPixmapCache::insert(addLinePixmapName, cache);
+ QPixmapCache::insert(addLinePixmapName, cache);
}
painter->drawPixmap(option->rect.topLeft(), cache);
}
@@ -3528,14 +3507,14 @@ void QPlastiqueStyle::drawControl(ControlElement element, const QStyleOption *op
bool sunken = scrollBar->state & State_Sunken;
bool horizontal = scrollBar->orientation == Qt::Horizontal;
- QString groovePixmapName = uniqueName(QLatin1String("scrollbar_groove"), option, option->rect.size());
+ QString groovePixmapName = QStyleHelper::uniqueName(QLatin1String("scrollbar_groove"), option, option->rect.size());
if (sunken)
groovePixmapName += QLatin1String("-sunken");
if (element == CE_ScrollBarAddPage)
groovePixmapName += QLatin1String("-addpage");
QPixmap cache;
- if (!UsePixmapCache || !QPixmapCache::find(groovePixmapName, cache)) {
+ if (!QPixmapCache::find(groovePixmapName, cache)) {
cache = QPixmap(option->rect.size());
cache.fill(option->palette.background().color());
QPainter groovePainter(&cache);
@@ -3561,8 +3540,7 @@ void QPlastiqueStyle::drawControl(ControlElement element, const QStyleOption *op
}
groovePainter.end();
- if (UsePixmapCache)
- QPixmapCache::insert(groovePixmapName, cache);
+ QPixmapCache::insert(groovePixmapName, cache);
}
painter->drawPixmap(option->rect.topLeft(), cache);
}
@@ -3579,7 +3557,7 @@ void QPlastiqueStyle::drawControl(ControlElement element, const QStyleOption *op
// The SubLine (up/left) buttons
QRect button1;
QRect button2;
- int scrollBarExtent = pixelMetric(PM_ScrollBarExtent, option, widget);
+ int scrollBarExtent = proxy()->pixelMetric(PM_ScrollBarExtent, option, widget);
if (horizontal) {
button1.setRect(scrollBarSubLine.left(), scrollBarSubLine.top(), scrollBarExtent, scrollBarSubLine.height());
button2.setRect(scrollBarSubLine.right() - (scrollBarExtent - 1), scrollBarSubLine.top(), scrollBarExtent, scrollBarSubLine.height());
@@ -3588,9 +3566,9 @@ void QPlastiqueStyle::drawControl(ControlElement element, const QStyleOption *op
button2.setRect(scrollBarSubLine.left(), scrollBarSubLine.bottom() - (scrollBarExtent - 1), scrollBarSubLine.width(), scrollBarExtent);
}
- QString subLinePixmapName = uniqueName(QLatin1String("scrollbar_subline"), option, button1.size());
+ QString subLinePixmapName = QStyleHelper::uniqueName(QLatin1String("scrollbar_subline"), option, button1.size());
QPixmap cache;
- if (!UsePixmapCache || !QPixmapCache::find(subLinePixmapName, cache)) {
+ if (!QPixmapCache::find(subLinePixmapName, cache)) {
cache = QPixmap(button1.size());
cache.fill(Qt::white);
QRect pixmapRect(0, 0, cache.width(), cache.height());
@@ -3650,8 +3628,7 @@ void QPlastiqueStyle::drawControl(ControlElement element, const QStyleOption *op
subLinePainter.drawImage(QPoint(pixmapRect.center().x() - 3, pixmapRect.center().y() - 2), arrow);
}
subLinePainter.end();
- if (UsePixmapCache)
- QPixmapCache::insert(subLinePixmapName, cache);
+ QPixmapCache::insert(subLinePixmapName, cache);
}
painter->drawPixmap(button1.topLeft(), cache);
painter->drawPixmap(button2.topLeft(), cache);
@@ -3664,12 +3641,12 @@ void QPlastiqueStyle::drawControl(ControlElement element, const QStyleOption *op
// The slider
if (option->rect.isValid()) {
- QString sliderPixmapName = uniqueName(QLatin1String("scrollbar_slider"), option, option->rect.size());
+ QString sliderPixmapName = QStyleHelper::uniqueName(QLatin1String("scrollbar_slider"), option, option->rect.size());
if (horizontal)
sliderPixmapName += QLatin1String("-horizontal");
QPixmap cache;
- if (!UsePixmapCache || !QPixmapCache::find(sliderPixmapName, cache)) {
+ if (!QPixmapCache::find(sliderPixmapName, cache)) {
cache = QPixmap(option->rect.size());
cache.fill(Qt::white);
QRect pixmapRect(0, 0, cache.width(), cache.height());
@@ -3720,7 +3697,7 @@ void QPlastiqueStyle::drawControl(ControlElement element, const QStyleOption *op
pixmapRect.right() - 1, pixmapRect.bottom() - 1);
sliderPainter.drawLines(lines, 2);
- int sliderMinLength = pixelMetric(PM_ScrollBarSliderMin, scrollBar, widget);
+ int sliderMinLength = proxy()->pixelMetric(PM_ScrollBarSliderMin, scrollBar, widget);
if ((horizontal && scrollBar->rect.width() > sliderMinLength)
|| (!horizontal && scrollBar->rect.height() > sliderMinLength)) {
QImage pattern(horizontal ? qt_scrollbar_slider_pattern_horizontal
@@ -3740,8 +3717,7 @@ void QPlastiqueStyle::drawControl(ControlElement element, const QStyleOption *op
}
sliderPainter.end();
// insert the slider into the cache
- if (UsePixmapCache)
- QPixmapCache::insert(sliderPixmapName, cache);
+ QPixmapCache::insert(sliderPixmapName, cache);
}
painter->drawPixmap(option->rect.topLeft(), cache);
}
@@ -3760,7 +3736,7 @@ void QPlastiqueStyle::drawControl(ControlElement element, const QStyleOption *op
QWindowsStyle::drawControl(element, option, painter, widget);
} else if (!comboBox->currentIcon.isNull()) {
{
- QRect editRect = subControlRect(CC_ComboBox, comboBox, SC_ComboBoxEditField, widget);
+ QRect editRect = proxy()->subControlRect(CC_ComboBox, comboBox, SC_ComboBoxEditField, widget);
if (comboBox->direction == Qt::RightToLeft)
editRect.adjust(0, 2, -2, -2);
else
@@ -3773,11 +3749,11 @@ void QPlastiqueStyle::drawControl(ControlElement element, const QStyleOption *op
QPixmap pixmap = comboBox->currentIcon.pixmap(comboBox->iconSize, mode);
QRect iconRect(editRect);
iconRect.setWidth(comboBox->iconSize.width() + 5);
- iconRect = alignedRect(QApplication::layoutDirection(),
+ iconRect = alignedRect(comboBox->direction,
Qt::AlignLeft | Qt::AlignVCenter,
iconRect.size(), editRect);
painter->fillRect(iconRect, option->palette.brush(QPalette::Base));
- drawItemPixmap(painter, iconRect, Qt::AlignCenter, pixmap);
+ proxy()->drawItemPixmap(painter, iconRect, Qt::AlignCenter, pixmap);
}
painter->restore();
}
@@ -3820,9 +3796,9 @@ void QPlastiqueStyle::drawComplexControl(ComplexControl control, const QStyleOpt
#ifndef QT_NO_SLIDER
case CC_Slider:
if (const QStyleOptionSlider *slider = qstyleoption_cast<const QStyleOptionSlider *>(option)) {
- QRect grooveRegion = subControlRect(CC_Slider, option, SC_SliderGroove, widget);
- QRect handle = subControlRect(CC_Slider, option, SC_SliderHandle, widget);
- QRect ticks = subControlRect(CC_Slider, option, SC_SliderTickmarks, widget);
+ QRect grooveRegion = proxy()->subControlRect(CC_Slider, option, SC_SliderGroove, widget);
+ QRect handle = proxy()->subControlRect(CC_Slider, option, SC_SliderHandle, widget);
+ QRect ticks = proxy()->subControlRect(CC_Slider, option, SC_SliderTickmarks, widget);
bool horizontal = slider->orientation == Qt::Horizontal;
bool ticksAbove = slider->tickPosition & QSlider::TicksAbove;
bool ticksBelow = slider->tickPosition & QSlider::TicksBelow;
@@ -3885,13 +3861,13 @@ void QPlastiqueStyle::drawComplexControl(ComplexControl control, const QStyleOpt
}
if ((option->subControls & SC_SliderHandle) && handle.isValid()) {
- QString handlePixmapName = uniqueName(QLatin1String("slider_handle"), option, handle.size());
+ QString handlePixmapName = QStyleHelper::uniqueName(QLatin1String("slider_handle"), option, handle.size());
if (ticksAbove && !ticksBelow)
handlePixmapName += QLatin1String("-flipped");
if ((option->activeSubControls & SC_SliderHandle) && (option->state & State_Sunken))
handlePixmapName += QLatin1String("-sunken");
- if (!UsePixmapCache || !QPixmapCache::find(handlePixmapName, cache)) {
+ if (!QPixmapCache::find(handlePixmapName, cache)) {
cache = QPixmap(handle.size());
cache.fill(Qt::white);
QRect pixmapRect(0, 0, handle.width(), handle.height());
@@ -3974,8 +3950,7 @@ void QPlastiqueStyle::drawComplexControl(ComplexControl control, const QStyleOpt
}
handlePainter.drawImage(pixmapRect, image);
handlePainter.end();
- if (UsePixmapCache)
- QPixmapCache::insert(handlePixmapName, cache);
+ QPixmapCache::insert(handlePixmapName, cache);
}
painter->drawPixmap(handle.topLeft(), cache);
@@ -3984,15 +3959,15 @@ void QPlastiqueStyle::drawComplexControl(ComplexControl control, const QStyleOpt
QStyleOptionFocusRect fropt;
fropt.QStyleOption::operator=(*slider);
fropt.rect = subElementRect(SE_SliderFocusRect, slider, widget);
- drawPrimitive(PE_FrameFocusRect, &fropt, painter, widget);
+ proxy()->drawPrimitive(PE_FrameFocusRect, &fropt, painter, widget);
}
}
if (option->subControls & SC_SliderTickmarks) {
QPen oldPen = painter->pen();
painter->setPen(borderColor);
- int tickSize = pixelMetric(PM_SliderTickmarkOffset, option, widget);
- int available = pixelMetric(PM_SliderSpaceAvailable, slider, widget);
+ int tickSize = proxy()->pixelMetric(PM_SliderTickmarkOffset, option, widget);
+ int available = proxy()->pixelMetric(PM_SliderSpaceAvailable, slider, widget);
int interval = slider->tickInterval;
if (interval <= 0) {
interval = slider->singleStep;
@@ -4006,7 +3981,7 @@ void QPlastiqueStyle::drawComplexControl(ComplexControl control, const QStyleOpt
interval = 1;
int v = slider->minimum;
- int len = pixelMetric(PM_SliderLength, slider, widget);
+ int len = proxy()->pixelMetric(PM_SliderLength, slider, widget);
QVarLengthArray<QLine, 32> lines;
while (v <= slider->maximum + 1) {
if (v == slider->maximum + 1 && interval == 1)
@@ -4061,8 +4036,8 @@ void QPlastiqueStyle::drawComplexControl(ComplexControl control, const QStyleOpt
bool reverse = (spinBox->direction == Qt::RightToLeft);
// Rects
- QRect upRect = subControlRect(CC_SpinBox, option, SC_SpinBoxUp, widget);
- QRect downRect = subControlRect(CC_SpinBox, option, SC_SpinBoxDown, widget);
+ QRect upRect = proxy()->subControlRect(CC_SpinBox, option, SC_SpinBoxUp, widget);
+ QRect downRect = proxy()->subControlRect(CC_SpinBox, option, SC_SpinBoxDown, widget);
QRect buttonRect = upRect | downRect;
// Brushes
@@ -4083,7 +4058,7 @@ void QPlastiqueStyle::drawComplexControl(ComplexControl control, const QStyleOpt
} else {
d->drawPartialFrame(painter,
option,
- subControlRect(CC_SpinBox, spinBox, SC_SpinBoxEditField, widget),
+ proxy()->subControlRect(CC_SpinBox, spinBox, SC_SpinBoxEditField, widget),
widget);
}
// Paint buttons
@@ -4423,7 +4398,7 @@ void QPlastiqueStyle::drawComplexControl(ComplexControl control, const QStyleOpt
Q_D(const QPlastiqueStyle);
d->drawPartialFrame(painter,
option,
- subControlRect(CC_ComboBox, option, SC_ComboBoxEditField, widget),
+ proxy()->subControlRect(CC_ComboBox, option, SC_ComboBoxEditField, widget),
widget);
QBrush border = qMapBrushToRect(option->palette.shadow(), buttonRect);
@@ -4547,7 +4522,7 @@ void QPlastiqueStyle::drawComplexControl(ComplexControl control, const QStyleOpt
if (!sunken) {
buttonOption.state &= ~State_Sunken;
}
- drawPrimitive(PE_PanelButtonCommand, &buttonOption, painter, widget);
+ proxy()->drawPrimitive(PE_PanelButtonCommand, &buttonOption, painter, widget);
// Draw the menu button separator line
QBrush border = qMapBrushToRect(option->palette.shadow(), rect);
@@ -4580,11 +4555,12 @@ void QPlastiqueStyle::drawComplexControl(ComplexControl control, const QStyleOpt
}
// Draw the focus rect
- if (((option->state & State_HasFocus) && (option->state & State_KeyboardFocusChange)) && !comboBox->editable) {
+ if ((option->state & State_HasFocus) && !comboBox->editable
+ && ((option->state & State_KeyboardFocusChange) || styleHint(SH_UnderlineShortcut, option, widget))) {
QStyleOptionFocusRect focus;
- focus.rect = subControlRect(CC_ComboBox, option, SC_ComboBoxEditField, widget)
+ focus.rect = proxy()->subControlRect(CC_ComboBox, option, SC_ComboBoxEditField, widget)
.adjusted(-2, 0, 2, 0);
- drawPrimitive(PE_FrameFocusRect, &focus, painter, widget);
+ proxy()->drawPrimitive(PE_FrameFocusRect, &focus, painter, widget);
}
painter->setPen(oldPen);
@@ -4614,7 +4590,7 @@ void QPlastiqueStyle::drawComplexControl(ComplexControl control, const QStyleOpt
QStyleOptionDockWidgetV2 dockwidget;
dockwidget.QStyleOption::operator=(*option);
dockwidget.title = titleBar->text;
- drawControl(CE_DockWidgetTitle, &dockwidget, painter, widget);
+ proxy()->drawControl(CE_DockWidgetTitle, &dockwidget, painter, widget);
} else
#endif // QT3_SUPPORT
@@ -4687,7 +4663,7 @@ void QPlastiqueStyle::drawComplexControl(ComplexControl control, const QStyleOpt
}
}
// draw title
- QRect textRect = subControlRect(CC_TitleBar, titleBar, SC_TitleBarLabel, widget);
+ QRect textRect = proxy()->subControlRect(CC_TitleBar, titleBar, SC_TitleBarLabel, widget);
QFont font = painter->font();
font.setBold(true);
@@ -4714,7 +4690,7 @@ void QPlastiqueStyle::drawComplexControl(ComplexControl control, const QStyleOpt
bool hover = (titleBar->activeSubControls & SC_TitleBarMinButton) && (titleBar->state & State_MouseOver);
bool sunken = (titleBar->activeSubControls & SC_TitleBarMinButton) && (titleBar->state & State_Sunken);
- QRect minButtonRect = subControlRect(CC_TitleBar, titleBar, SC_TitleBarMinButton, widget);
+ QRect minButtonRect = proxy()->subControlRect(CC_TitleBar, titleBar, SC_TitleBarMinButton, widget);
qt_plastique_draw_mdibutton(painter, titleBar, minButtonRect, hover, sunken);
int xoffset = minButtonRect.width() / 3;
@@ -4758,7 +4734,7 @@ void QPlastiqueStyle::drawComplexControl(ComplexControl control, const QStyleOpt
bool hover = (titleBar->activeSubControls & SC_TitleBarMaxButton) && (titleBar->state & State_MouseOver);
bool sunken = (titleBar->activeSubControls & SC_TitleBarMaxButton) && (titleBar->state & State_Sunken);
- QRect maxButtonRect = subControlRect(CC_TitleBar, titleBar, SC_TitleBarMaxButton, widget);
+ QRect maxButtonRect = proxy()->subControlRect(CC_TitleBar, titleBar, SC_TitleBarMaxButton, widget);
qt_plastique_draw_mdibutton(painter, titleBar, maxButtonRect, hover, sunken);
int xoffset = maxButtonRect.width() / 3;
@@ -4783,7 +4759,7 @@ void QPlastiqueStyle::drawComplexControl(ComplexControl control, const QStyleOpt
bool hover = (titleBar->activeSubControls & SC_TitleBarCloseButton) && (titleBar->state & State_MouseOver);
bool sunken = (titleBar->activeSubControls & SC_TitleBarCloseButton) && (titleBar->state & State_Sunken);
- QRect closeButtonRect = subControlRect(CC_TitleBar, titleBar, SC_TitleBarCloseButton, widget);
+ QRect closeButtonRect = proxy()->subControlRect(CC_TitleBar, titleBar, SC_TitleBarCloseButton, widget);
qt_plastique_draw_mdibutton(painter, titleBar, closeButtonRect, hover, sunken);
int xoffset = closeButtonRect.width() / 3;
@@ -4829,7 +4805,7 @@ void QPlastiqueStyle::drawComplexControl(ComplexControl control, const QStyleOpt
bool hover = (titleBar->activeSubControls & SC_TitleBarNormalButton) && (titleBar->state & State_MouseOver);
bool sunken = (titleBar->activeSubControls & SC_TitleBarNormalButton) && (titleBar->state & State_Sunken);
- QRect normalButtonRect = subControlRect(CC_TitleBar, titleBar, SC_TitleBarNormalButton, widget);
+ QRect normalButtonRect = proxy()->subControlRect(CC_TitleBar, titleBar, SC_TitleBarNormalButton, widget);
qt_plastique_draw_mdibutton(painter, titleBar, normalButtonRect, hover, sunken);
int xoffset = int(normalButtonRect.width() / 3.5);
int yoffset = int(normalButtonRect.height() / 3.5);
@@ -4875,7 +4851,7 @@ void QPlastiqueStyle::drawComplexControl(ComplexControl control, const QStyleOpt
bool hover = (titleBar->activeSubControls & SC_TitleBarContextHelpButton) && (titleBar->state & State_MouseOver);
bool sunken = (titleBar->activeSubControls & SC_TitleBarContextHelpButton) && (titleBar->state & State_Sunken);
- QRect contextHelpButtonRect = subControlRect(CC_TitleBar, titleBar, SC_TitleBarContextHelpButton, widget);
+ QRect contextHelpButtonRect = proxy()->subControlRect(CC_TitleBar, titleBar, SC_TitleBarContextHelpButton, widget);
qt_plastique_draw_mdibutton(painter, titleBar, contextHelpButtonRect, hover, sunken);
@@ -4902,7 +4878,7 @@ void QPlastiqueStyle::drawComplexControl(ComplexControl control, const QStyleOpt
bool hover = (titleBar->activeSubControls & SC_TitleBarShadeButton) && (titleBar->state & State_MouseOver);
bool sunken = (titleBar->activeSubControls & SC_TitleBarShadeButton) && (titleBar->state & State_Sunken);
- QRect shadeButtonRect = subControlRect(CC_TitleBar, titleBar, SC_TitleBarShadeButton, widget);
+ QRect shadeButtonRect = proxy()->subControlRect(CC_TitleBar, titleBar, SC_TitleBarShadeButton, widget);
qt_plastique_draw_mdibutton(painter, titleBar, shadeButtonRect, hover, sunken);
int xoffset = shadeButtonRect.width() / 3;
@@ -4926,7 +4902,7 @@ void QPlastiqueStyle::drawComplexControl(ComplexControl control, const QStyleOpt
bool hover = (titleBar->activeSubControls & SC_TitleBarUnshadeButton) && (titleBar->state & State_MouseOver);
bool sunken = (titleBar->activeSubControls & SC_TitleBarUnshadeButton) && (titleBar->state & State_Sunken);
- QRect unshadeButtonRect = subControlRect(CC_TitleBar, titleBar, SC_TitleBarUnshadeButton, widget);
+ QRect unshadeButtonRect = proxy()->subControlRect(CC_TitleBar, titleBar, SC_TitleBarUnshadeButton, widget);
qt_plastique_draw_mdibutton(painter, titleBar, unshadeButtonRect, hover, sunken);
int xoffset = unshadeButtonRect.width() / 3;
@@ -4951,7 +4927,7 @@ void QPlastiqueStyle::drawComplexControl(ComplexControl control, const QStyleOpt
bool hover = (titleBar->activeSubControls & SC_TitleBarSysMenu) && (titleBar->state & State_MouseOver);
bool sunken = (titleBar->activeSubControls & SC_TitleBarSysMenu) && (titleBar->state & State_Sunken);
- QRect iconRect = subControlRect(CC_TitleBar, titleBar, SC_TitleBarSysMenu, widget);
+ QRect iconRect = proxy()->subControlRect(CC_TitleBar, titleBar, SC_TitleBarSysMenu, widget);
if (hover)
qt_plastique_draw_mdibutton(painter, titleBar, iconRect, hover, sunken);
@@ -4963,13 +4939,19 @@ void QPlastiqueStyle::drawComplexControl(ComplexControl control, const QStyleOpt
QPixmap pm = standardPixmap(SP_TitleBarMenuButton, &tool, widget);
tool.rect = iconRect;
painter->save();
- drawItemPixmap(painter, iconRect, Qt::AlignCenter, pm);
+ proxy()->drawItemPixmap(painter, iconRect, Qt::AlignCenter, pm);
painter->restore();
}
}
painter->restore();
}
break;
+#ifndef QT_NO_DIAL
+ case CC_Dial:
+ if (const QStyleOptionSlider *dial = qstyleoption_cast<const QStyleOptionSlider *>(option))
+ QStyleHelper::drawDial(dial, painter);
+ break;
+#endif // QT_NO_DIAL
default:
QWindowsStyle::drawComplexControl(control, option, painter, widget);
break;
@@ -4992,7 +4974,7 @@ QSize QPlastiqueStyle::sizeFromContents(ContentsType type, const QStyleOption *o
#ifndef QT_NO_SLIDER
case CT_Slider:
if (const QStyleOptionSlider *slider = qstyleoption_cast<const QStyleOptionSlider *>(option)) {
- int tickSize = pixelMetric(PM_SliderTickmarkOffset, option, widget);
+ int tickSize = proxy()->pixelMetric(PM_SliderTickmarkOffset, option, widget);
if (slider->tickPosition & QSlider::TicksBelow) {
if (slider->orientation == Qt::Horizontal)
newSize.rheight() += tickSize;
@@ -5011,8 +4993,8 @@ QSize QPlastiqueStyle::sizeFromContents(ContentsType type, const QStyleOption *o
#ifndef QT_NO_SCROLLBAR
case CT_ScrollBar:
if (const QStyleOptionSlider *scrollBar = qstyleoption_cast<const QStyleOptionSlider *>(option)) {
- int scrollBarExtent = pixelMetric(PM_ScrollBarExtent, option, widget);
- int scrollBarSliderMinimum = pixelMetric(PM_ScrollBarSliderMin, option, widget);
+ int scrollBarExtent = proxy()->pixelMetric(PM_ScrollBarExtent, option, widget);
+ int scrollBarSliderMinimum = proxy()->pixelMetric(PM_ScrollBarSliderMin, option, widget);
if (scrollBar->orientation == Qt::Horizontal) {
newSize = QSize(scrollBarExtent * 3 + scrollBarSliderMinimum, scrollBarExtent);
} else {
@@ -5093,7 +5075,7 @@ QRect QPlastiqueStyle::subControlRect(ComplexControl control, const QStyleOption
#ifndef QT_NO_SLIDER
case CC_Slider:
if (const QStyleOptionSlider *slider = qstyleoption_cast<const QStyleOptionSlider *>(option)) {
- int tickSize = pixelMetric(PM_SliderTickmarkOffset, option, widget);
+ int tickSize = proxy()->pixelMetric(PM_SliderTickmarkOffset, option, widget);
switch (subControl) {
case SC_SliderHandle:
@@ -5146,10 +5128,10 @@ QRect QPlastiqueStyle::subControlRect(ComplexControl control, const QStyleOption
#ifndef QT_NO_SCROLLBAR
case CC_ScrollBar:
if (const QStyleOptionSlider *scrollBar = qstyleoption_cast<const QStyleOptionSlider *>(option)) {
- int scrollBarExtent = pixelMetric(PM_ScrollBarExtent, scrollBar, widget);
+ int scrollBarExtent = proxy()->pixelMetric(PM_ScrollBarExtent, scrollBar, widget);
int sliderMaxLength = ((scrollBar->orientation == Qt::Horizontal) ?
scrollBar->rect.width() : scrollBar->rect.height()) - (scrollBarExtent * 3);
- int sliderMinLength = pixelMetric(PM_ScrollBarSliderMin, scrollBar, widget);
+ int sliderMinLength = proxy()->pixelMetric(PM_ScrollBarSliderMin, scrollBar, widget);
int sliderLength;
// calculate slider length
@@ -5271,7 +5253,7 @@ QRect QPlastiqueStyle::subControlRect(ComplexControl control, const QStyleOption
break;
case SC_ComboBoxEditField: {
if (const QStyleOptionComboBox *box = qstyleoption_cast<const QStyleOptionComboBox *>(option)) {
- int frameWidth = pixelMetric(PM_DefaultFrameWidth);
+ int frameWidth = proxy()->pixelMetric(PM_DefaultFrameWidth);
rect = visualRect(option->direction, option->rect, rect);
if (box->editable) {
@@ -5453,6 +5435,16 @@ int QPlastiqueStyle::styleHint(StyleHint hint, const QStyleOption *option, const
case SH_Menu_SubMenuPopupDelay:
ret = 96; // from Plastik
break;
+#ifdef Q_WS_X11
+ case SH_DialogButtonBox_ButtonsHaveIcons:
+ ret = true;
+ break;
+#endif
+#ifndef Q_OS_WIN
+ case SH_Menu_AllowActiveAndDisabled:
+ ret = false;
+ break;
+#endif
default:
ret = QWindowsStyle::styleHint(hint, option, widget, returnData);
break;
@@ -5471,31 +5463,31 @@ QStyle::SubControl QPlastiqueStyle::hitTestComplexControl(ComplexControl control
#ifndef QT_NO_SCROLLBAR
case CC_ScrollBar:
if (const QStyleOptionSlider *scrollBar = qstyleoption_cast<const QStyleOptionSlider *>(option)) {
- QRect slider = subControlRect(control, scrollBar, SC_ScrollBarSlider, widget);
+ QRect slider = proxy()->subControlRect(control, scrollBar, SC_ScrollBarSlider, widget);
if (slider.contains(pos)) {
ret = SC_ScrollBarSlider;
break;
}
- QRect scrollBarAddLine = subControlRect(control, scrollBar, SC_ScrollBarAddLine, widget);
+ QRect scrollBarAddLine = proxy()->subControlRect(control, scrollBar, SC_ScrollBarAddLine, widget);
if (scrollBarAddLine.contains(pos)) {
ret = SC_ScrollBarAddLine;
break;
}
- QRect scrollBarSubPage = subControlRect(control, scrollBar, SC_ScrollBarSubPage, widget);
+ QRect scrollBarSubPage = proxy()->subControlRect(control, scrollBar, SC_ScrollBarSubPage, widget);
if (scrollBarSubPage.contains(pos)) {
ret = SC_ScrollBarSubPage;
break;
}
- QRect scrollBarAddPage = subControlRect(control, scrollBar, SC_ScrollBarAddPage, widget);
+ QRect scrollBarAddPage = proxy()->subControlRect(control, scrollBar, SC_ScrollBarAddPage, widget);
if (scrollBarAddPage.contains(pos)) {
ret = SC_ScrollBarAddPage;
break;
}
- QRect scrollBarSubLine = subControlRect(control, scrollBar, SC_ScrollBarSubLine, widget);
+ QRect scrollBarSubLine = proxy()->subControlRect(control, scrollBar, SC_ScrollBarSubLine, widget);
if (scrollBarSubLine.contains(pos)) {
ret = SC_ScrollBarSubLine;
break;
diff --git a/src/gui/styles/qplastiquestyle.h b/src/gui/styles/qplastiquestyle.h
index 4a889c7..1d4301a 100644
--- a/src/gui/styles/qplastiquestyle.h
+++ b/src/gui/styles/qplastiquestyle.h
@@ -1,7 +1,6 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the QtGui module of the Qt Toolkit.
@@ -21,9 +20,10 @@
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.1, included in the file LGPL_EXCEPTION.txt in this
+** package.
**
** If you have questions regarding the use of this file, please contact
** Nokia at qt-info@nokia.com.
diff --git a/src/gui/styles/qproxystyle.cpp b/src/gui/styles/qproxystyle.cpp
new file mode 100644
index 0000000..50904b1
--- /dev/null
+++ b/src/gui/styles/qproxystyle.cpp
@@ -0,0 +1,420 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the QtGui module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.1, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <qstyle.h>
+#include <private/qstyle_p.h>
+#include <private/qproxystyle_p.h>
+#include <private/qapplication_p.h>
+#include "qproxystyle.h"
+#include "qstylefactory.h"
+
+#if !defined(QT_NO_STYLE_PROXY) || defined(QT_PLUGIN)
+
+QT_BEGIN_NAMESPACE
+
+/*!
+ \class QProxyStyle
+
+ \brief The QProxyStyle class is a convenience class that simplifies
+ dynamically overriding QStyle elements.
+
+ \since 4.6
+
+ A QProxyStyle wraps a QStyle (usually the default system style) for the
+ purpose of dynamically overriding painting or other specific style behavior.
+
+ The following example shows how to override the shortcut underline
+ behavior on any platform:
+
+ \snippet doc/src/snippets/code/src_gui_qproxystyle.cpp 1
+
+ Warning: The \l {QCommonStyle} {common styles} provided by Qt will
+ respect this hint, because they call QStyle::proxy(), but there is
+ no guarantee that QStyle::proxy() will be called for user defined
+ or system controlled styles. It would not work on a Mac, for
+ example, where menus are handled by the operating system.
+
+ \sa QStyle
+*/
+
+void QProxyStylePrivate::ensureBaseStyle() const
+{
+ Q_Q(const QProxyStyle);
+
+ if (baseStyle)
+ return;
+
+ if (!baseStyle && !QApplicationPrivate::styleOverride.isEmpty()) {
+ baseStyle = QStyleFactory::create(QApplicationPrivate::styleOverride);
+ if (baseStyle) {
+ // If baseStyle is an instance of the same proxyStyle
+ // we destroy it and fall back to the desktop style
+ if (qstrcmp(baseStyle->metaObject()->className(),
+ q->metaObject()->className()) == 0) {
+ delete baseStyle;
+ baseStyle = 0;
+ }
+ }
+ }
+
+ if (!baseStyle) // Use application desktop style
+ baseStyle = QStyleFactory::create(QApplicationPrivate::desktopStyleKey());
+
+ if (!baseStyle) // Fallback to windows style
+ baseStyle = QStyleFactory::create(QLatin1String("windows"));
+
+ baseStyle->setProxy(const_cast<QProxyStyle*>(q));
+ baseStyle->setParent(const_cast<QProxyStyle*>(q)); // Take ownership
+}
+
+/*!
+ Constructs a QProxyStyle object for overriding behavior in \a style
+ or in the current application \l{QStyle}{style} if \a style is 0
+ (default). Normally \a style is 0, because you want to override
+ behavior in the system style.
+
+ Ownership of \a style is transferred to QProxyStyle.
+*/
+QProxyStyle::QProxyStyle(QStyle *style) :
+ QCommonStyle(*new QProxyStylePrivate())
+{
+ Q_D(QProxyStyle);
+ if (style) {
+ style->setProxy(this);
+ style->setParent(this); // Take ownership
+ d->baseStyle = style;
+ }
+}
+
+/*!
+ Destroys the QProxyStyle object.
+*/
+QProxyStyle::~QProxyStyle()
+{
+}
+
+/*!
+ Returns the proxy base style object. If no base style
+ is set on the proxy style, QProxyStyle will create
+ an instance of the application style instead.
+
+ \sa setBaseStyle(), QStyle
+*/
+QStyle *QProxyStyle::baseStyle() const
+{
+ Q_D (const QProxyStyle);
+ d->ensureBaseStyle();
+ return d->baseStyle;
+}
+
+/*!
+ Sets the base style that should be proxied.
+
+ Ownership of \a style is transferred to QProxyStyle.
+
+ If style is zero, a desktop-dependant style will be
+ assigned automatically.
+*/
+void QProxyStyle::setBaseStyle(QStyle *style)
+{
+ Q_D (QProxyStyle);
+
+ if (d->baseStyle && d->baseStyle->parent() == this)
+ d->baseStyle->deleteLater();
+
+ d->baseStyle = style;
+
+ if (d->baseStyle) {
+ d->baseStyle->setProxy(this);
+ d->baseStyle->setParent(this);
+ }
+}
+
+/*! \reimp
+ */
+void QProxyStyle::drawPrimitive(PrimitiveElement element, const QStyleOption *option, QPainter *painter, const QWidget *widget) const
+{
+ Q_D (const QProxyStyle);
+ d->ensureBaseStyle();
+ d->baseStyle->drawPrimitive(element, option, painter, widget);
+}
+
+/*!
+ \reimp
+ */
+void QProxyStyle::drawControl(ControlElement element, const QStyleOption *option, QPainter *painter, const QWidget *widget) const
+{
+ Q_D (const QProxyStyle);
+ d->ensureBaseStyle();
+ d->baseStyle->drawControl(element, option, painter, widget);
+}
+
+/*! \reimp
+ */
+void QProxyStyle::drawComplexControl(ComplexControl control, const QStyleOptionComplex *option, QPainter *painter, const QWidget *widget) const
+{
+ Q_D (const QProxyStyle);
+ d->ensureBaseStyle();
+ d->baseStyle->drawComplexControl(control, option, painter, widget);
+}
+
+/*! \reimp
+ */
+void QProxyStyle::drawItemText(QPainter *painter, const QRect &rect, int flags, const QPalette &pal, bool enabled,
+ const QString &text, QPalette::ColorRole textRole) const
+{
+ Q_D (const QProxyStyle);
+ d->ensureBaseStyle();
+ d->baseStyle->drawItemText(painter, rect, flags, pal, enabled, text, textRole);
+}
+
+/*! \reimp
+ */
+void QProxyStyle::drawItemPixmap(QPainter *painter, const QRect &rect, int alignment, const QPixmap &pixmap) const
+{
+ Q_D (const QProxyStyle);
+ d->ensureBaseStyle();
+ d->baseStyle->drawItemPixmap(painter, rect, alignment, pixmap);
+}
+
+/*! \reimp
+ */
+QSize QProxyStyle::sizeFromContents(ContentsType type, const QStyleOption *option, const QSize &size, const QWidget *widget) const
+{
+ Q_D (const QProxyStyle);
+ d->ensureBaseStyle();
+ return d->baseStyle->sizeFromContents(type, option, size, widget);
+}
+
+/*! \reimp
+ */
+QRect QProxyStyle::subElementRect(SubElement element, const QStyleOption *option, const QWidget *widget) const
+{
+ Q_D (const QProxyStyle);
+ d->ensureBaseStyle();
+ return d->baseStyle->subElementRect(element, option, widget);
+}
+
+/*! \reimp
+ */
+QRect QProxyStyle::subControlRect(ComplexControl cc, const QStyleOptionComplex *option, SubControl sc, const QWidget *widget) const
+{
+ Q_D (const QProxyStyle);
+ d->ensureBaseStyle();
+ return d->baseStyle->subControlRect(cc, option, sc, widget);
+}
+
+/*! \reimp
+ */
+QRect QProxyStyle::itemTextRect(const QFontMetrics &fm, const QRect &r, int flags, bool enabled, const QString &text) const
+{
+ Q_D (const QProxyStyle);
+ d->ensureBaseStyle();
+ return d->baseStyle->itemTextRect(fm, r, flags, enabled, text);
+}
+
+/*! \reimp
+ */
+QRect QProxyStyle::itemPixmapRect(const QRect &r, int flags, const QPixmap &pixmap) const
+{
+ Q_D (const QProxyStyle);
+ d->ensureBaseStyle();
+ return d->baseStyle->itemPixmapRect(r, flags, pixmap);
+}
+
+/*! \reimp
+ */
+QStyle::SubControl QProxyStyle::hitTestComplexControl(ComplexControl control, const QStyleOptionComplex *option, const QPoint &pos, const QWidget *widget) const
+{
+ Q_D (const QProxyStyle);
+ d->ensureBaseStyle();
+ return d->baseStyle->hitTestComplexControl(control, option, pos, widget);
+}
+
+/*! \reimp
+ */
+int QProxyStyle::styleHint(StyleHint hint, const QStyleOption *option, const QWidget *widget, QStyleHintReturn *returnData) const
+{
+ Q_D (const QProxyStyle);
+ d->ensureBaseStyle();
+ return d->baseStyle->styleHint(hint, option, widget, returnData);
+}
+
+/*! \reimp
+ */
+int QProxyStyle::pixelMetric(PixelMetric metric, const QStyleOption *option, const QWidget *widget) const
+{
+ Q_D (const QProxyStyle);
+ d->ensureBaseStyle();
+ return d->baseStyle->pixelMetric(metric, option, widget);
+}
+
+/*! \reimp
+ */
+QPixmap QProxyStyle::standardPixmap(StandardPixmap standardPixmap, const QStyleOption *opt, const QWidget *widget) const
+{
+ Q_D (const QProxyStyle);
+ d->ensureBaseStyle();
+ return d->baseStyle->standardPixmap(standardPixmap, opt, widget);
+}
+
+/*! \reimp
+ */
+QPixmap QProxyStyle::generatedIconPixmap(QIcon::Mode iconMode, const QPixmap &pixmap, const QStyleOption *opt) const
+{
+ Q_D (const QProxyStyle);
+ d->ensureBaseStyle();
+ return d->baseStyle->generatedIconPixmap(iconMode, pixmap, opt);
+}
+
+/*! \reimp
+ */
+QPalette QProxyStyle::standardPalette() const
+{
+ Q_D (const QProxyStyle);
+ d->ensureBaseStyle();
+ return d->baseStyle->standardPalette();
+}
+
+/*! \reimp
+ */
+void QProxyStyle::polish(QWidget *widget)
+{
+ Q_D (QProxyStyle);
+ d->ensureBaseStyle();
+ d->baseStyle->polish(widget);
+}
+
+/*! \reimp
+ */
+void QProxyStyle::polish(QPalette &pal)
+{
+ Q_D (QProxyStyle);
+ d->ensureBaseStyle();
+ d->baseStyle->polish(pal);
+}
+
+/*! \reimp
+ */
+void QProxyStyle::polish(QApplication *app)
+{
+ Q_D (QProxyStyle);
+ d->ensureBaseStyle();
+ d->baseStyle->polish(app);
+}
+
+/*! \reimp
+ */
+void QProxyStyle::unpolish(QWidget *widget)
+{
+ Q_D (QProxyStyle);
+ d->ensureBaseStyle();
+ d->baseStyle->unpolish(widget);
+}
+
+/*! \reimp
+ */
+void QProxyStyle::unpolish(QApplication *app)
+{
+ Q_D (QProxyStyle);
+ d->ensureBaseStyle();
+ d->baseStyle->unpolish(app);
+}
+
+/*! \reimp
+ */
+bool QProxyStyle::event(QEvent *e)
+{
+ Q_D (QProxyStyle);
+ d->ensureBaseStyle();
+ return d->baseStyle->event(e);
+}
+
+/*!
+ Returns an icon for the given \a standardIcon.
+
+ Reimplement this slot to provide your own icons in a QStyle
+ subclass. The \a option argument can be used to pass extra
+ information required to find the appropriate icon. The \a widget
+ argument is optional and can also be used to help find the icon.
+
+ \note Because of binary compatibility constraints, standardIcon()
+ introduced in Qt 4.1 is not virtual. Therefore it must dynamically
+ detect and call \e this slot. This default implementation simply
+ calls standardIcon() with the given parameters.
+
+ \sa standardIcon()
+ */
+QIcon QProxyStyle::standardIconImplementation(StandardPixmap standardIcon,
+ const QStyleOption *option,
+ const QWidget *widget) const
+{
+ Q_D (const QProxyStyle);
+ d->ensureBaseStyle();
+ return d->baseStyle->standardIcon(standardIcon, option, widget);
+}
+
+/*!
+ This slot is called by layoutSpacing() to determine the spacing that
+ should be used between \a control1 and \a control2 in a layout. \a
+ orientation specifies whether the controls are laid out side by side
+ or stacked vertically. The \a option parameter can be used to pass
+ extra information about the parent widget. The \a widget parameter
+ is optional and can also be used if \a option is 0.
+
+ The default implementation returns -1.
+
+ \sa layoutSpacing(), combinedLayoutSpacing()
+ */
+int QProxyStyle::layoutSpacingImplementation(QSizePolicy::ControlType control1,
+ QSizePolicy::ControlType control2,
+ Qt::Orientation orientation,
+ const QStyleOption *option,
+ const QWidget *widget) const
+{
+ Q_D (const QProxyStyle);
+ d->ensureBaseStyle();
+ return d->baseStyle->layoutSpacing(control1, control2, orientation, option, widget);
+}
+
+QT_END_NAMESPACE
+
+#endif // QT_NO_STYLE_PROXY
diff --git a/src/gui/styles/qproxystyle.h b/src/gui/styles/qproxystyle.h
new file mode 100644
index 0000000..112a692
--- /dev/null
+++ b/src/gui/styles/qproxystyle.h
@@ -0,0 +1,114 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the QtGui module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.1, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QPROXYSTYLE_H
+#define QPROXYSTYLE_H
+
+#include <QtGui/QCommonStyle>
+
+QT_BEGIN_HEADER
+
+QT_BEGIN_NAMESPACE
+
+QT_MODULE(Gui)
+
+#if !defined(QT_NO_STYLE_PROXY)
+
+class QProxyStylePrivate;
+class Q_GUI_EXPORT QProxyStyle : public QCommonStyle
+{
+ Q_OBJECT
+
+public:
+ QProxyStyle(QStyle *baseStyle = 0);
+ ~QProxyStyle();
+
+ QStyle *baseStyle() const;
+ void setBaseStyle(QStyle *style);
+
+ void drawPrimitive(PrimitiveElement element, const QStyleOption *option, QPainter *painter, const QWidget *widget = 0) const;
+ void drawControl(ControlElement element, const QStyleOption *option, QPainter *painter, const QWidget *widget = 0) const;
+ void drawComplexControl(ComplexControl control, const QStyleOptionComplex *option, QPainter *painter, const QWidget *widget = 0) const;
+ void drawItemText(QPainter *painter, const QRect &rect, int flags, const QPalette &pal, bool enabled,
+ const QString &text, QPalette::ColorRole textRole = QPalette::NoRole) const;
+ virtual void drawItemPixmap(QPainter *painter, const QRect &rect, int alignment, const QPixmap &pixmap) const;
+
+ QSize sizeFromContents(ContentsType type, const QStyleOption *option, const QSize &size, const QWidget *widget) const;
+
+ QRect subElementRect(SubElement element, const QStyleOption *option, const QWidget *widget) const;
+ QRect subControlRect(ComplexControl cc, const QStyleOptionComplex *opt, SubControl sc, const QWidget *widget) const;
+ QRect itemTextRect(const QFontMetrics &fm, const QRect &r, int flags, bool enabled, const QString &text) const;
+ QRect itemPixmapRect(const QRect &r, int flags, const QPixmap &pixmap) const;
+
+ SubControl hitTestComplexControl(ComplexControl control, const QStyleOptionComplex *option, const QPoint &pos, const QWidget *widget = 0) const;
+ int styleHint(StyleHint hint, const QStyleOption *option = 0, const QWidget *widget = 0, QStyleHintReturn *returnData = 0) const;
+ int pixelMetric(PixelMetric metric, const QStyleOption *option = 0, const QWidget *widget = 0) const;
+
+ QPixmap standardPixmap(StandardPixmap standardPixmap, const QStyleOption *opt, const QWidget *widget = 0) const;
+ QPixmap generatedIconPixmap(QIcon::Mode iconMode, const QPixmap &pixmap, const QStyleOption *opt) const;
+ QPalette standardPalette() const;
+
+ void polish(QWidget *widget);
+ void polish(QPalette &pal);
+ void polish(QApplication *app);
+
+ void unpolish(QWidget *widget);
+ void unpolish(QApplication *app);
+
+protected:
+ bool event(QEvent *e);
+
+protected Q_SLOTS:
+ QIcon standardIconImplementation(StandardPixmap standardIcon, const QStyleOption *option, const QWidget *widget) const;
+ int layoutSpacingImplementation(QSizePolicy::ControlType control1, QSizePolicy::ControlType control2,
+ Qt::Orientation orientation, const QStyleOption *option = 0, const QWidget *widget = 0) const;
+private:
+ Q_DISABLE_COPY(QProxyStyle)
+ Q_DECLARE_PRIVATE(QProxyStyle)
+};
+
+#endif // QT_NO_STYLE_PROXY
+
+QT_END_NAMESPACE
+
+QT_END_HEADER
+
+#endif // QPROXYSTYLE_H
diff --git a/src/gui/styles/qproxystyle_p.h b/src/gui/styles/qproxystyle_p.h
new file mode 100644
index 0000000..080587e
--- /dev/null
+++ b/src/gui/styles/qproxystyle_p.h
@@ -0,0 +1,79 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the QtGui module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.1, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QPROXYSTYLE_P_H
+#define QPROXYSTYLE_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists for the convenience
+// of qapplication_*.cpp, qwidget*.cpp and qfiledialog.cpp. This header
+// file may change from version to version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include "qcommonstyle.h"
+#include "qcommonstyle_p.h"
+#include "qproxystyle.h"
+
+#ifndef QT_NO_STYLE_PROXY
+
+QT_BEGIN_NAMESPACE
+
+class QProxyStylePrivate : public QCommonStylePrivate
+{
+ Q_DECLARE_PUBLIC(QProxyStyle)
+public:
+ void ensureBaseStyle() const;
+private:
+ QProxyStylePrivate() :
+ QCommonStylePrivate(), baseStyle(0) {}
+ mutable QPointer <QStyle> baseStyle;
+};
+
+QT_END_NAMESPACE
+
+#endif // QT_NO_STYLE_PROXY
+
+#endif //QPROXYSTYLE_P_H
diff --git a/src/gui/styles/qs60style.cpp b/src/gui/styles/qs60style.cpp
new file mode 100644
index 0000000..e328403
--- /dev/null
+++ b/src/gui/styles/qs60style.cpp
@@ -0,0 +1,2882 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the QtGui of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.1, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qs60style_p.h"
+
+#include "qapplication.h"
+#include "qpainter.h"
+#include "qstyleoption.h"
+#include "qevent.h"
+#include "qpixmapcache.h"
+
+#include "qcalendarwidget.h"
+#include "qdial.h"
+#include "qdialog.h"
+#include "qgroupbox.h"
+#include "qheaderview.h"
+#include "qlist.h"
+#include "qlistwidget.h"
+#include "qlistview.h"
+#include "qmenu.h"
+#include "qmenubar.h"
+#include "qpushbutton.h"
+#include "qscrollarea.h"
+#include "qscrollbar.h"
+#include "qtabbar.h"
+#include "qtablewidget.h"
+#include "qtableview.h"
+#include "qtextedit.h"
+#include "qtoolbar.h"
+#include "qtoolbutton.h"
+#include "qtreeview.h"
+#include "qfocusframe.h"
+
+#include "private/qtoolbarextension_p.h"
+#include "private/qcombobox_p.h"
+#include "private/qwidget_p.h"
+#include "private/qapplication_p.h"
+
+#if !defined(QT_NO_STYLE_S60) || defined(QT_PLUGIN)
+
+QT_BEGIN_NAMESPACE
+
+// from text/qfont.cpp
+extern Q_GUI_EXPORT int qt_defaultDpiY();
+
+const QS60StylePrivate::SkinElementFlags QS60StylePrivate::KDefaultSkinElementFlags =
+ SkinElementFlags(SF_PointNorth | SF_StateEnabled);
+
+static const QByteArray propertyKeyLayouts = "layouts";
+static const QByteArray propertyKeyCurrentlayout = "currentlayout";
+
+static const qreal goldenRatio = 1.618;
+
+const layoutHeader QS60StylePrivate::m_layoutHeaders[] = {
+// *** generated layout data ***
+{240,320,1,14,true,"QVGA Landscape Mirrored"},
+{240,320,1,14,false,"QVGA Landscape"},
+{320,240,1,14,true,"QVGA Portrait Mirrored"},
+{320,240,1,14,false,"QVGA Portrait"},
+{360,640,1,14,true,"NHD Landscape Mirrored"},
+{360,640,1,14,false,"NHD Landscape"},
+{640,360,1,14,true,"NHD Portrait Mirrored"},
+{640,360,1,14,false,"NHD Portrait"},
+{352,800,1,12,true,"E90 Landscape Mirrored"},
+{352,800,1,12,false,"E90 Landscape"}
+// *** End of generated data ***
+};
+const int QS60StylePrivate::m_numberOfLayouts =
+ (int)sizeof(QS60StylePrivate::m_layoutHeaders)/sizeof(QS60StylePrivate::m_layoutHeaders[0]);
+
+const short QS60StylePrivate::data[][MAX_PIXELMETRICS] = {
+// *** generated pixel metrics ***
+{5,0,-909,0,0,1,0,0,-1,8,15,22,15,15,7,198,-909,-909,-909,19,15,2,0,0,21,-909,21,-909,4,4,1,-909,-909,0,2,0,0,13,23,17,17,21,21,2,115,21,0,-909,-909,-909,-909,0,0,15,1,-909,0,0,-909,15,-909,-909,-909,-909,32,21,51,27,51,4,4,5,10,15,-909,5,58,12,5,0,7,4,4,9,4,4,-909,1,-909,-909,-909,-909,4,4,3,1},
+{5,0,-909,0,0,1,0,0,-1,8,15,22,15,15,7,198,-909,-909,-909,19,15,2,0,0,21,-909,21,-909,4,4,1,-909,-909,0,2,0,0,13,23,17,17,21,21,2,115,21,0,-909,-909,-909,-909,0,0,15,1,-909,0,0,-909,15,-909,-909,-909,-909,32,21,51,27,51,4,4,5,10,15,-909,5,58,12,5,0,4,4,7,9,4,4,-909,1,-909,-909,-909,-909,4,4,3,1},
+{5,0,-909,0,0,1,0,0,-1,8,14,22,15,15,7,164,-909,-909,-909,19,15,2,0,0,21,-909,27,-909,4,4,1,-909,-909,0,7,6,0,13,23,17,17,21,21,7,115,21,0,-909,-909,-909,-909,0,0,15,1,-909,0,0,-909,15,-909,-909,-909,-909,32,21,65,27,65,4,4,5,10,15,-909,5,58,13,5,0,7,4,4,9,4,4,-909,1,-909,-909,-909,-909,4,4,3,1},
+{5,0,-909,0,0,1,0,0,-1,8,14,22,15,15,7,164,-909,-909,-909,19,15,2,0,0,21,-909,27,-909,4,4,1,-909,-909,0,7,6,0,13,23,17,17,21,21,7,115,21,0,-909,-909,-909,-909,0,0,15,1,-909,0,0,-909,15,-909,-909,-909,-909,32,21,65,27,65,4,4,5,10,15,-909,5,58,13,5,0,4,4,7,9,4,4,-909,1,-909,-909,-909,-909,4,4,3,1},
+{7,0,-909,0,0,2,0,0,-1,20,53,28,19,19,9,258,-909,-909,-909,29,19,26,0,0,32,-909,72,-909,5,5,2,-909,-909,0,7,21,0,17,29,22,22,27,27,7,173,29,0,-909,-909,-909,-909,0,0,25,2,-909,0,0,-909,25,-909,-909,-909,-909,87,27,77,35,77,5,5,6,8,19,-909,7,74,19,7,0,8,5,5,12,5,5,-909,2,-909,-909,-909,-909,7,7,3,1},
+{7,0,-909,0,0,2,0,0,-1,20,53,28,19,19,9,258,-909,-909,-909,29,19,26,0,0,32,-909,72,-909,5,5,2,-909,-909,0,7,21,0,17,29,22,22,27,27,7,173,29,0,-909,-909,-909,-909,0,0,25,2,-909,0,0,-909,25,-909,-909,-909,-909,87,27,77,35,77,5,5,6,8,19,-909,7,74,19,7,0,5,5,8,12,5,5,-909,2,-909,-909,-909,-909,7,7,3,1},
+{7,0,-909,0,0,2,0,0,-1,20,52,28,19,19,9,258,-909,-909,-909,29,19,6,0,0,32,-909,60,-909,5,5,2,-909,-909,0,7,32,0,17,29,22,22,27,27,7,173,29,0,-909,-909,-909,-909,0,0,26,2,-909,0,0,-909,26,-909,-909,-909,-909,87,27,98,35,98,5,5,6,8,19,-909,7,74,22,7,0,8,5,5,12,5,5,-909,2,-909,-909,-909,-909,7,7,3,1},
+{7,0,-909,0,0,2,0,0,-1,20,52,28,19,19,9,258,-909,-909,-909,29,19,6,0,0,32,-909,60,-909,5,5,2,-909,-909,0,7,32,0,17,29,22,22,27,27,7,173,29,0,-909,-909,-909,-909,0,0,26,2,-909,0,0,-909,26,-909,-909,-909,-909,87,27,98,35,98,5,5,6,8,19,-909,7,74,22,7,0,5,5,8,12,5,5,-909,2,-909,-909,-909,-909,7,7,3,1},
+{7,0,-909,0,0,2,0,0,-1,10,20,27,18,18,9,301,-909,-909,-909,29,18,5,0,0,35,-909,32,-909,5,5,2,-909,-909,0,2,8,0,16,28,21,21,26,26,2,170,26,0,-909,-909,-909,-909,0,0,21,5,-909,0,0,-909,-909,-909,-909,-909,-909,54,26,265,34,265,5,5,6,3,18,-909,7,72,19,7,0,8,6,5,11,6,5,-909,2,-909,-909,-909,-909,5,5,3,1},
+{7,0,-909,0,0,2,0,0,-1,10,20,27,18,18,9,301,-909,-909,-909,29,18,5,0,0,35,-909,32,-909,5,5,2,-909,-909,0,2,8,0,16,28,21,21,26,26,2,170,26,0,-909,-909,-909,-909,0,0,21,6,-909,0,0,-909,-909,-909,-909,-909,-909,54,26,265,34,265,5,5,6,3,18,-909,7,72,19,7,0,5,6,8,11,6,5,-909,2,-909,-909,-909,-909,5,5,3,1}
+// *** End of generated data ***
+};
+
+const short *QS60StylePrivate::m_pmPointer = QS60StylePrivate::data[0];
+
+// theme background texture
+QPixmap *QS60StylePrivate::m_background = 0;
+
+// theme palette
+QPalette *QS60StylePrivate::m_themePalette = 0;
+
+const struct QS60StylePrivate::frameElementCenter QS60StylePrivate::m_frameElementsData[] = {
+ {SE_ButtonNormal, QS60StyleEnums::SP_QsnFrButtonTbCenter},
+ {SE_ButtonPressed, QS60StyleEnums::SP_QsnFrButtonTbCenterPressed},
+ {SE_FrameLineEdit, QS60StyleEnums::SP_QsnFrInputCenter},
+ {SE_ListHighlight, QS60StyleEnums::SP_QsnFrListCenter},
+ {SE_OptionsMenu, QS60StyleEnums::SP_QsnFrPopupCenter},
+ {SE_SettingsList, QS60StyleEnums::SP_QsnFrSetOptCenter},
+ {SE_TableItem, QS60StyleEnums::SP_QsnFrCaleCenter},
+ {SE_TableHeaderItem, QS60StyleEnums::SP_QsnFrCaleHeadingCenter},
+ {SE_ToolTip, QS60StyleEnums::SP_QsnFrPopupPreviewCenter},
+ {SE_ToolBar, QS60StyleEnums::SP_QsnFrPopupSubCenter},
+ {SE_ToolBarButton, QS60StyleEnums::SP_QsnFrSctrlButtonCenter},
+ {SE_ToolBarButtonPressed, QS60StyleEnums::SP_QsnFrSctrlButtonCenterPressed},
+ {SE_PanelBackground, QS60StyleEnums::SP_QsnFrSetOptCenter},
+ {SE_ButtonInactive, QS60StyleEnums::SP_QsnFrButtonCenterInactive},
+ {SE_Editor, QS60StyleEnums::SP_QsnFrNotepadCenter},
+};
+
+static const int frameElementsCount =
+ int(sizeof(QS60StylePrivate::m_frameElementsData)/sizeof(QS60StylePrivate::m_frameElementsData[0]));
+
+const int KNotFound = -909;
+const double KTabFontMul = 0.72;
+
+QS60StylePrivate::~QS60StylePrivate()
+{
+ clearCaches(); //deletes also background image
+ deleteThemePalette();
+}
+
+void QS60StylePrivate::drawSkinElement(SkinElements element, QPainter *painter,
+ const QRect &rect, SkinElementFlags flags)
+{
+ switch (element) {
+ case SE_ButtonNormal:
+ drawFrame(SF_ButtonNormal, painter, rect, flags | SF_PointNorth);
+ break;
+ case SE_ButtonPressed:
+ drawFrame(SF_ButtonPressed, painter, rect, flags | SF_PointNorth);
+ break;
+ case SE_FrameLineEdit:
+ drawFrame(SF_FrameLineEdit, painter, rect, flags | SF_PointNorth);
+ break;
+ case SE_ProgressBarGrooveHorizontal:
+ drawRow(QS60StyleEnums::SP_QgnGrafBarFrameSideL, QS60StyleEnums::SP_QgnGrafBarFrameCenter,
+ QS60StyleEnums::SP_QgnGrafBarFrameSideR, Qt::Horizontal, painter, rect, flags | SF_PointNorth);
+ break;
+ case SE_ProgressBarGrooveVertical:
+ drawRow(QS60StyleEnums::SP_QgnGrafBarFrameSideL, QS60StyleEnums::SP_QgnGrafBarFrameCenter,
+ QS60StyleEnums::SP_QgnGrafBarFrameSideR, Qt::Vertical, painter, rect, flags | SF_PointEast);
+ break;
+ case SE_ProgressBarIndicatorHorizontal:
+ drawPart(QS60StyleEnums::SP_QgnGrafBarProgress, painter, rect, flags | SF_PointNorth);
+ break;
+ case SE_ProgressBarIndicatorVertical:
+ drawPart(QS60StyleEnums::SP_QgnGrafBarProgress, painter, rect, flags | SF_PointWest);
+ break;
+ case SE_ScrollBarGrooveHorizontal:
+ drawRow(QS60StyleEnums::SP_QsnCpScrollBgBottom, QS60StyleEnums::SP_QsnCpScrollBgMiddle,
+ QS60StyleEnums::SP_QsnCpScrollBgTop, Qt::Horizontal, painter, rect, flags | SF_PointEast);
+ break;
+ case SE_ScrollBarGrooveVertical:
+ drawRow(QS60StyleEnums::SP_QsnCpScrollBgTop, QS60StyleEnums::SP_QsnCpScrollBgMiddle,
+ QS60StyleEnums::SP_QsnCpScrollBgBottom, Qt::Vertical, painter, rect, flags | SF_PointNorth);
+ break;
+ case SE_ScrollBarHandleHorizontal:
+ drawRow(QS60StyleEnums::SP_QsnCpScrollHandleBottom, QS60StyleEnums::SP_QsnCpScrollHandleMiddle,
+ QS60StyleEnums::SP_QsnCpScrollHandleTop, Qt::Horizontal, painter, rect, flags | SF_PointEast);
+ break;
+ case SE_ScrollBarHandleVertical:
+ drawRow(QS60StyleEnums::SP_QsnCpScrollHandleTop, QS60StyleEnums::SP_QsnCpScrollHandleMiddle,
+ QS60StyleEnums::SP_QsnCpScrollHandleBottom, Qt::Vertical, painter, rect, flags | SF_PointNorth);
+ break;
+ case SE_SliderHandleHorizontal:
+ drawPart(QS60StyleEnums::SP_QgnIndiSliderEdit, painter, rect, flags | SF_PointNorth);
+ break;
+ case SE_SliderHandleVertical:
+ drawPart(QS60StyleEnums::SP_QgnIndiSliderEdit, painter, rect, flags | SF_PointEast);
+ break;
+ case SE_TabBarTabEastActive:
+ drawRow(QS60StyleEnums::SP_QgnGrafTabActiveL, QS60StyleEnums::SP_QgnGrafTabActiveM,
+ QS60StyleEnums::SP_QgnGrafTabActiveR, Qt::Vertical, painter, rect, flags | SF_PointEast);
+ break;
+ case SE_TabBarTabEastInactive:
+ drawRow(QS60StyleEnums::SP_QgnGrafTabPassiveL, QS60StyleEnums::SP_QgnGrafTabPassiveM,
+ QS60StyleEnums::SP_QgnGrafTabPassiveR, Qt::Vertical, painter, rect, flags | SF_PointEast);
+ break;
+ case SE_TabBarTabNorthActive:
+ drawRow(QS60StyleEnums::SP_QgnGrafTabActiveL, QS60StyleEnums::SP_QgnGrafTabActiveM,
+ QS60StyleEnums::SP_QgnGrafTabActiveR, Qt::Horizontal, painter, rect, flags | SF_PointNorth);
+ break;
+ case SE_TabBarTabNorthInactive:
+ drawRow(QS60StyleEnums::SP_QgnGrafTabPassiveL, QS60StyleEnums::SP_QgnGrafTabPassiveM,
+ QS60StyleEnums::SP_QgnGrafTabPassiveR, Qt::Horizontal, painter, rect, flags | SF_PointNorth);
+ break;
+ case SE_TabBarTabSouthActive:
+ drawRow(QS60StyleEnums::SP_QgnGrafTabActiveR, QS60StyleEnums::SP_QgnGrafTabActiveM,
+ QS60StyleEnums::SP_QgnGrafTabActiveL, Qt::Horizontal, painter, rect, flags | SF_PointSouth);
+ break;
+ case SE_TabBarTabSouthInactive:
+ drawRow(QS60StyleEnums::SP_QgnGrafTabPassiveR, QS60StyleEnums::SP_QgnGrafTabPassiveM,
+ QS60StyleEnums::SP_QgnGrafTabPassiveL, Qt::Horizontal, painter, rect, flags | SF_PointSouth);
+ break;
+ case SE_TabBarTabWestActive:
+ drawRow(QS60StyleEnums::SP_QgnGrafTabActiveR, QS60StyleEnums::SP_QgnGrafTabActiveM,
+ QS60StyleEnums::SP_QgnGrafTabActiveL, Qt::Vertical, painter, rect, flags | SF_PointWest);
+ break;
+ case SE_TabBarTabWestInactive:
+ drawRow(QS60StyleEnums::SP_QgnGrafTabPassiveR, QS60StyleEnums::SP_QgnGrafTabPassiveM,
+ QS60StyleEnums::SP_QgnGrafTabPassiveL, Qt::Vertical, painter, rect, flags | SF_PointWest);
+ break;
+ case SE_ListHighlight:
+ drawFrame(SF_ListHighlight, painter, rect, flags | SF_PointNorth);
+ break;
+ case SE_OptionsMenu:
+ drawFrame(SF_OptionsMenu, painter, rect, flags | SF_PointNorth);
+ break;
+ case SE_SettingsList:
+ drawFrame(SF_SettingsList, painter, rect, flags | SF_PointNorth);
+ break;
+ case SE_TableItem:
+ drawFrame(SF_TableItem, painter, rect, flags | SF_PointNorth);
+ break;
+ case SE_TableHeaderItem:
+ drawFrame(SF_TableHeaderItem, painter, rect, flags | SF_PointNorth);
+ break;
+ case SE_ToolTip:
+ drawFrame(SF_ToolTip, painter, rect, flags | SF_PointNorth);
+ break;
+ case SE_ToolBar:
+ drawFrame(SF_ToolBar, painter, rect, flags | SF_PointNorth);
+ break;
+ case SE_ToolBarButton:
+ drawFrame(SF_ToolBarButton, painter, rect, flags | SF_PointNorth);
+ break;
+ case SE_ToolBarButtonPressed:
+ drawFrame(SF_ToolBarButtonPressed, painter, rect, flags | SF_PointNorth);
+ break;
+ case SE_PanelBackground:
+ drawFrame(SF_PanelBackground, painter, rect, flags | SF_PointNorth);
+ break;
+ case SE_ScrollBarHandlePressedHorizontal:
+ drawRow(QS60StyleEnums::SP_QsnCpScrollHandleBottomPressed, QS60StyleEnums::SP_QsnCpScrollHandleMiddlePressed,
+ QS60StyleEnums::SP_QsnCpScrollHandleTopPressed, Qt::Horizontal, painter, rect, flags | SF_PointEast);
+ break;
+ case SE_ScrollBarHandlePressedVertical:
+ drawRow(QS60StyleEnums::SP_QsnCpScrollHandleTopPressed, QS60StyleEnums::SP_QsnCpScrollHandleMiddlePressed,
+ QS60StyleEnums::SP_QsnCpScrollHandleBottomPressed, Qt::Vertical, painter, rect, flags | SF_PointNorth);
+ break;
+ case SE_ButtonInactive:
+ drawFrame(SF_ButtonInactive, painter, rect, flags | SF_PointNorth);
+ break;
+ case SE_Editor:
+ drawFrame(SF_Editor, painter, rect, flags | SF_PointNorth);
+ break;
+ default:
+ break;
+ }
+}
+
+void QS60StylePrivate::drawSkinPart(QS60StyleEnums::SkinParts part,
+ QPainter *painter, const QRect &rect, SkinElementFlags flags)
+{
+ drawPart(part, painter, rect, flags);
+}
+
+short QS60StylePrivate::pixelMetric(int metric)
+{
+ Q_ASSERT(metric < MAX_PIXELMETRICS);
+ const short returnValue = m_pmPointer[metric];
+ return returnValue;
+}
+
+void QS60StylePrivate::setStyleProperty(const char *name, const QVariant &value)
+{
+ if (name == propertyKeyCurrentlayout) {
+ static const QStringList layouts = styleProperty(propertyKeyLayouts).toStringList();
+ const QString layout = value.toString();
+ Q_ASSERT(layouts.contains(layout));
+ const int layoutIndex = layouts.indexOf(layout);
+ setCurrentLayout(layoutIndex);
+ QApplication::setLayoutDirection(m_layoutHeaders[layoutIndex].mirroring ? Qt::RightToLeft : Qt::LeftToRight);
+ clearCaches();
+ refreshUI();
+ }
+}
+
+QVariant QS60StylePrivate::styleProperty(const char *name) const
+{
+ if (name == propertyKeyLayouts) {
+ static QStringList layouts;
+ if (layouts.isEmpty())
+ for (int i = 0; i < m_numberOfLayouts; i++)
+ layouts.append(QLatin1String(m_layoutHeaders[i].layoutName));
+ return layouts;
+ }
+ return QVariant();
+}
+
+QColor QS60StylePrivate::stateColor(const QColor &color, const QStyleOption *option)
+{
+ QColor retColor (color);
+ if (option && !(option->state & QStyle::State_Enabled)) {
+ QColor hsvColor = retColor.toHsv();
+ int colorSat = hsvColor.saturation();
+ int colorVal = hsvColor.value();
+ colorSat = (colorSat!=0) ? (colorSat>>1) : 128;
+ colorVal = (colorVal!=0) ? (colorVal>>1) : 128;
+ hsvColor.setHsv(hsvColor.hue(), colorSat, colorVal);
+ retColor = hsvColor.toRgb();
+ }
+ return retColor;
+}
+
+QColor QS60StylePrivate::lighterColor(const QColor &baseColor)
+{
+ QColor result(baseColor);
+ bool modifyColor = false;
+ if (result.saturation() == 0) {
+ result.setHsv(result.hue(), 128, result.value());
+ modifyColor = true;
+ }
+ if (result.value() == 0) {
+ result.setHsv(result.hue(), result.saturation(), 128);
+ modifyColor = true;
+ }
+ if (modifyColor)
+ result = result.lighter(175);
+ else
+ result = result.lighter(225);
+ return result;
+}
+
+bool QS60StylePrivate::drawsOwnThemeBackground(const QWidget *widget)
+{
+ return qobject_cast<const QDialog *> (widget);
+}
+
+QFont QS60StylePrivate::s60Font(
+ QS60StyleEnums::FontCategories fontCategory, int pointSize) const
+{
+ QFont result;
+ int actualPointSize = pointSize;
+ if (actualPointSize <= 0) {
+ const QFont appFont = QApplication::font();
+ actualPointSize = appFont.pointSize();
+ if (actualPointSize <= 0)
+ actualPointSize = appFont.pixelSize() * 72 / qt_defaultDpiY();
+ }
+ Q_ASSERT(actualPointSize > 0);
+ const QPair<QS60StyleEnums::FontCategories, int> key(fontCategory, actualPointSize);
+ if (!m_mappedFontsCache.contains(key)) {
+ result = s60Font_specific(fontCategory, actualPointSize);
+ m_mappedFontsCache.insert(key, result);
+ } else {
+ result = m_mappedFontsCache.value(key);
+ if (result.pointSize() != actualPointSize)
+ result.setPointSize(actualPointSize);
+ }
+ return result;
+}
+
+void QS60StylePrivate::clearCaches(CacheClearReason reason)
+{
+ switch(reason){
+ case CC_LayoutChange:
+ // when layout changes, the colors remain in cache, but graphics and fonts can change
+ m_mappedFontsCache.clear();
+ deleteBackground();
+ QPixmapCache::clear();
+ break;
+ case CC_ThemeChange:
+ m_colorCache.clear();
+ QPixmapCache::clear();
+ deleteBackground();
+ break;
+ case CC_UndefinedChange:
+ default:
+ m_colorCache.clear();
+ m_mappedFontsCache.clear();
+ QPixmapCache::clear();
+ deleteBackground();
+ break;
+ }
+}
+
+// Since S60Style has 'button' and 'tooltip' as a graphic, we don't have any native color which to use
+// for QPalette::Button and QPalette::ToolTipBase. Therefore S60Style needs to guesstimate
+// palette colors by calculating average rgb values for button pixels.
+// Returns Qt::black if there is an issue with the graphics (image is NULL, or no bits() found).
+QColor QS60StylePrivate::colorFromFrameGraphics(SkinFrameElements frame) const
+{
+ const bool cachedColorExists = m_colorCache.contains(frame);
+ if (!cachedColorExists) {
+ const int frameCornerWidth = pixelMetric(PM_Custom_FrameCornerWidth);
+ const int frameCornerHeight = pixelMetric(PM_Custom_FrameCornerHeight);
+ Q_ASSERT(2*frameCornerWidth<32);
+ Q_ASSERT(2*frameCornerHeight<32);
+
+ const QImage frameImage = QS60StylePrivate::frame(frame, QSize(32,32)).toImage();
+ Q_ASSERT(frameImage.bytesPerLine() > 0);
+ if (frameImage.isNull())
+ return Qt::black;
+
+ const QRgb *pixelRgb = (const QRgb*)frameImage.bits();
+ const int pixels = frameImage.numBytes()/sizeof(QRgb);
+
+ int estimatedRed = 0;
+ int estimatedGreen = 0;
+ int estimatedBlue = 0;
+
+ int skips = 0;
+ int estimations = 0;
+
+ const int topBorderLastPixel = frameCornerHeight*frameImage.width()-1;
+ const int bottomBorderFirstPixel = frameImage.width()*frameImage.height()-frameCornerHeight*frameImage.width()-1;
+ const int rightBorderFirstPixel = frameImage.width()-frameCornerWidth;
+ const int leftBorderLastPixel = frameCornerWidth;
+
+ while ((skips + estimations) < pixels) {
+ if ((skips+estimations) > topBorderLastPixel &&
+ (skips+estimations) < bottomBorderFirstPixel) {
+ for (int rowIndex = 0; rowIndex < frameImage.width(); rowIndex++) {
+ if (rowIndex > leftBorderLastPixel &&
+ rowIndex < rightBorderFirstPixel) {
+ estimatedRed += qRed(*pixelRgb);
+ estimatedGreen += qGreen(*pixelRgb);
+ estimatedBlue += qBlue(*pixelRgb);
+ }
+ pixelRgb++;
+ estimations++;
+ }
+ } else {
+ pixelRgb++;
+ skips++;
+ }
+ }
+ QColor frameColor(estimatedRed/estimations, estimatedGreen/estimations, estimatedBlue/estimations);
+ m_colorCache.insert(frame, frameColor);
+ return !estimations ? Qt::black : frameColor;
+ } else {
+ return m_colorCache.value(frame);
+ }
+
+}
+
+void QS60StylePrivate::setThemePalette(QApplication *app) const
+{
+ Q_UNUSED(app)
+ QPalette widgetPalette = QPalette(Qt::white);
+ setThemePalette(&widgetPalette);
+ QApplication::setPalette(widgetPalette); //calling QApplication::setPalette clears palette hash
+ setThemePaletteHash(&widgetPalette);
+ storeThemePalette(&widgetPalette);
+}
+
+void QS60StylePrivate::setThemePalette(QStyleOption *option) const
+{
+ setThemePalette(&option->palette);
+}
+
+QPalette* QS60StylePrivate::themePalette()
+{
+ return m_themePalette;
+}
+
+void QS60StylePrivate::setBackgroundTexture(QApplication *app) const
+{
+ Q_UNUSED(app)
+ QPalette applicationPalette = QApplication::palette();
+ applicationPalette.setBrush(QPalette::Window, backgroundTexture());
+ QApplication::setPalette(applicationPalette);
+}
+
+void QS60StylePrivate::deleteBackground()
+{
+ if (m_background) {
+ delete m_background;
+ m_background = 0;
+ }
+}
+
+void QS60StylePrivate::setCurrentLayout(int index)
+{
+ m_pmPointer = data[index];
+}
+
+void QS60StylePrivate::drawPart(QS60StyleEnums::SkinParts skinPart,
+ QPainter *painter, const QRect &rect, SkinElementFlags flags)
+{
+ static const bool doCache =
+#if defined(Q_WS_S60)
+ // Freezes on 3.1. Anyways, caching is only really needed on touch UI
+ !(QSysInfo::s60Version() == QSysInfo::SV_S60_3_1 || QSysInfo::s60Version() == QSysInfo::SV_S60_3_2);
+#else
+ true;
+#endif
+ const QPixmap skinPartPixMap((doCache ? cachedPart : part)(skinPart, rect.size(), flags));
+ if (!skinPartPixMap.isNull())
+ painter->drawPixmap(rect.topLeft(), skinPartPixMap);
+}
+
+void QS60StylePrivate::drawFrame(SkinFrameElements frameElement, QPainter *painter, const QRect &rect, SkinElementFlags flags)
+{
+ static const bool doCache =
+#if defined(Q_WS_S60)
+ // Freezes on 3.1. Anyways, caching is only really needed on touch UI
+ !(QSysInfo::s60Version() == QSysInfo::SV_S60_3_1 || QSysInfo::s60Version() == QSysInfo::SV_S60_3_2);
+#else
+ true;
+#endif
+ const QPixmap frameElementPixMap((doCache ? cachedFrame : frame)(frameElement, rect.size(), flags));
+ if (!frameElementPixMap.isNull())
+ painter->drawPixmap(rect.topLeft(), frameElementPixMap);
+}
+
+void QS60StylePrivate::drawRow(QS60StyleEnums::SkinParts start,
+ QS60StyleEnums::SkinParts middle, QS60StyleEnums::SkinParts end,
+ Qt::Orientation orientation, QPainter *painter, const QRect &rect,
+ SkinElementFlags flags)
+{
+ QSize startEndSize(partSize(start, flags));
+ startEndSize.scale(rect.size(), Qt::KeepAspectRatio);
+
+ QRect startRect = QRect(rect.topLeft(), startEndSize);
+ QRect middleRect = rect;
+ QRect endRect;
+
+ if (orientation == Qt::Horizontal) {
+ startRect.setWidth(qMin((rect.width() >> 1) - 1, startRect.width()));
+ endRect = startRect.translated(rect.width() - startRect.width(), 0);
+ middleRect.adjust(startRect.width(), 0, -startRect.width(), 0);
+ if (startRect.bottomRight().x() > endRect.topLeft().x()) {
+ const int overlap = (startRect.bottomRight().x() - endRect.topLeft().x())>>1;
+ startRect.setWidth(startRect.width()-overlap);
+ endRect.adjust(overlap,0,0,0);
+ }
+ } else {
+ startRect.setHeight(qMin((rect.height() >> 1) - 1, startRect.height()));
+ endRect = startRect.translated(0, rect.height() - startRect.height());
+ middleRect.adjust(0, startRect.height(), 0, -startRect.height());
+ if (startRect.topRight().y() > endRect.bottomLeft().y()) {
+ const int overlap = (startRect.topRight().y() - endRect.bottomLeft().y())>>1;
+ startRect.setHeight(startRect.height()-overlap);
+ endRect.adjust(0,overlap,0,0);
+ }
+ }
+
+#if 0
+ painter->save();
+ painter->setOpacity(.3);
+ painter->fillRect(startRect, Qt::red);
+ painter->fillRect(middleRect, Qt::green);
+ painter->fillRect(endRect, Qt::blue);
+ painter->restore();
+#else
+ drawPart(start, painter, startRect, flags);
+ if (middleRect.isValid())
+ drawPart(middle, painter, middleRect, flags);
+ drawPart(end, painter, endRect, flags);
+#endif
+}
+
+QPixmap QS60StylePrivate::cachedPart(QS60StyleEnums::SkinParts part,
+ const QSize &size, SkinElementFlags flags)
+{
+ QPixmap result;
+ const QString cacheKey =
+ QString::fromLatin1("S60Style: SkinParts=%1 QSize=%2|%3 SkinPartFlags=%4")
+ .arg((int)part).arg(size.width()).arg(size.height()).arg((int)flags);
+ if (!QPixmapCache::find(cacheKey, result)) {
+ result = QS60StylePrivate::part(part, size, flags);
+ QPixmapCache::insert(cacheKey, result);
+ }
+ return result;
+}
+
+QPixmap QS60StylePrivate::cachedFrame(SkinFrameElements frame, const QSize &size, SkinElementFlags flags)
+{
+ QPixmap result;
+ const QString cacheKey =
+ QString::fromLatin1("S60Style: SkinFrameElements=%1 QSize=%2|%3 SkinElementFlags=%4")
+ .arg((int)frame).arg(size.width()).arg(size.height()).arg((int)flags);
+ if (!QPixmapCache::find(cacheKey, result)) {
+ result = QS60StylePrivate::frame(frame, size, flags);
+ QPixmapCache::insert(cacheKey, result);
+ }
+ return result;
+}
+
+void QS60StylePrivate::refreshUI()
+{
+ QList<QWidget *> widgets = QApplication::allWidgets();
+
+ for (int i = 0; i < widgets.size(); ++i) {
+ QWidget *widget = widgets.at(i);
+ if (widget == 0)
+ continue;
+
+ if (widget->style()) {
+ widget->style()->polish(widget);
+ QEvent event(QEvent::StyleChange);
+ qApp->sendEvent(widget, &event);
+ }
+ widget->update();
+ widget->updateGeometry();
+ }
+}
+
+void QS60StylePrivate::setFont(QWidget *widget) const
+{
+ QS60StyleEnums::FontCategories fontCategory = QS60StyleEnums::FC_Undefined;
+ if (!widget)
+ return;
+ if (qobject_cast<QPushButton *>(widget)){
+ fontCategory = QS60StyleEnums::FC_Primary;
+ } else if (qobject_cast<QToolButton *>(widget)){
+ fontCategory = QS60StyleEnums::FC_Primary;
+ } else if (qobject_cast<QHeaderView *>(widget)){
+ fontCategory = QS60StyleEnums::FC_Secondary;
+ } else if (qobject_cast<QGroupBox *>(widget)){
+ fontCategory = QS60StyleEnums::FC_Title;
+ }
+ if (fontCategory != QS60StyleEnums::FC_Undefined) {
+ const QFont suggestedFont =
+ s60Font(fontCategory, widget->font().pointSizeF());
+ widget->setFont(suggestedFont);
+ }
+}
+
+void QS60StylePrivate::setThemePalette(QWidget *widget) const
+{
+ if(!widget)
+ return;
+ QPalette widgetPalette = QApplication::palette(widget);
+
+ //header view and its viewport need to be set 100% transparent button color, since drawing code will
+ //draw transparent theme graphics to table column and row headers.
+ if (qobject_cast<QHeaderView *>(widget)){
+ widgetPalette.setColor(QPalette::Active, QPalette::ButtonText,
+ s60Color(QS60StyleEnums::CL_QsnTextColors, 23, 0));
+ QHeaderView* header = qobject_cast<QHeaderView *>(widget);
+ widgetPalette.setColor(QPalette::Button, Qt::transparent );
+ if ( header->viewport() )
+ header->viewport()->setPalette(widgetPalette);
+ QApplication::setPalette(widgetPalette, "QHeaderView");
+ }
+}
+
+void QS60StylePrivate::setThemePalette(QPalette *palette) const
+{
+ if (!palette)
+ return;
+
+ // basic colors
+ palette->setColor(QPalette::WindowText,
+ s60Color(QS60StyleEnums::CL_QsnTextColors, 6, 0));
+ palette->setColor(QPalette::ButtonText,
+ s60Color(QS60StyleEnums::CL_QsnTextColors, 6, 0));
+ palette->setColor(QPalette::Text,
+ s60Color(QS60StyleEnums::CL_QsnTextColors, 6, 0));
+ palette->setColor(QPalette::ToolTipText,
+ s60Color(QS60StyleEnums::CL_QsnTextColors, 55, 0));
+ palette->setColor(QPalette::BrightText, palette->color(QPalette::WindowText).lighter());
+ palette->setColor(QPalette::HighlightedText,
+ s60Color(QS60StyleEnums::CL_QsnTextColors, 10, 0));
+ palette->setColor(QPalette::Link,
+ s60Color(QS60StyleEnums::CL_QsnHighlightColors, 3, 0));
+ palette->setColor(QPalette::LinkVisited, palette->color(QPalette::Link).darker());
+ palette->setColor(QPalette::Highlight,
+ s60Color(QS60StyleEnums::CL_QsnHighlightColors, 2, 0));
+ // set background image as a texture brush
+ palette->setBrush(QPalette::Window, backgroundTexture());
+ // set these as transparent so that styled full screen theme background is visible
+ palette->setColor(QPalette::AlternateBase, Qt::transparent);
+ palette->setBrush(QPalette::Base, Qt::transparent);
+ // set button and tooltipbase based on pixel colors
+ const QColor buttonColor = this->colorFromFrameGraphics(SF_ButtonNormal);
+ palette->setColor(QPalette::Button, buttonColor );
+ const QColor toolTipColor = this->colorFromFrameGraphics(SF_ToolTip);
+ palette->setColor(QPalette::ToolTipBase, toolTipColor );
+ palette->setColor(QPalette::Light, palette->color(QPalette::Button).lighter());
+ palette->setColor(QPalette::Dark, palette->color(QPalette::Button).darker());
+ palette->setColor(QPalette::Midlight, palette->color(QPalette::Button).lighter(125));
+ palette->setColor(QPalette::Mid, palette->color(QPalette::Button).darker(150));
+ palette->setColor(QPalette::Shadow, Qt::black);
+}
+
+void QS60StylePrivate::deleteThemePalette()
+{
+ if (m_themePalette) {
+ delete m_themePalette;
+ m_themePalette = 0;
+ }
+}
+
+void QS60StylePrivate::storeThemePalette(QPalette *palette)
+{
+ deleteThemePalette();
+ //store specified palette for latter use.
+ m_themePalette = new QPalette(*palette);
+}
+
+// set widget specific palettes
+void QS60StylePrivate::setThemePaletteHash(QPalette *palette) const
+{
+ if (!palette)
+ return;
+
+ //store the original palette
+ QPalette widgetPalette = *palette;
+ const QColor mainAreaTextColor =
+ s60Color(QS60StyleEnums::CL_QsnTextColors, 6, 0);
+
+ widgetPalette.setColor(QPalette::All, QPalette::WindowText,
+ s60Color(QS60StyleEnums::CL_QsnLineColors, 8, 0));
+ QApplication::setPalette(widgetPalette, "QSlider");
+ // return to original palette after each widget
+ widgetPalette = *palette;
+
+ widgetPalette.setColor(QPalette::Active, QPalette::ButtonText, mainAreaTextColor);
+ widgetPalette.setColor(QPalette::Inactive, QPalette::ButtonText, mainAreaTextColor);
+ const QStyleOption opt;
+ widgetPalette.setColor(QPalette::Disabled, QPalette::ButtonText,
+ s60Color(QS60StyleEnums::CL_QsnTextColors, 6, &opt));
+ QApplication::setPalette(widgetPalette, "QPushButton");
+ widgetPalette = *palette;
+
+ widgetPalette.setColor(QPalette::Active, QPalette::ButtonText, mainAreaTextColor);
+ widgetPalette.setColor(QPalette::Inactive, QPalette::ButtonText, mainAreaTextColor);
+ QApplication::setPalette(widgetPalette, "QToolButton");
+ widgetPalette = *palette;
+
+ widgetPalette.setColor(QPalette::Active, QPalette::ButtonText,
+ s60Color(QS60StyleEnums::CL_QsnTextColors, 23, 0));
+ QApplication::setPalette(widgetPalette, "QHeaderView");
+ widgetPalette = *palette;
+
+ widgetPalette.setColor(QPalette::All, QPalette::ButtonText,
+ s60Color(QS60StyleEnums::CL_QsnTextColors, 8, 0));
+ QApplication::setPalette(widgetPalette, "QMenuBar");
+ widgetPalette = *palette;
+
+ widgetPalette.setColor(QPalette::Active, QPalette::WindowText,
+ s60Color(QS60StyleEnums::CL_QsnTextColors, 4, 0));
+ QApplication::setPalette(widgetPalette, "QTabBar");
+ widgetPalette = *palette;
+
+ widgetPalette.setColor(QPalette::All, QPalette::Text,
+ s60Color(QS60StyleEnums::CL_QsnTextColors, 22, 0));
+ QApplication::setPalette(widgetPalette, "QTableView");
+ widgetPalette = *palette;
+
+ widgetPalette.setColor(QPalette::All, QPalette::HighlightedText,
+ s60Color(QS60StyleEnums::CL_QsnTextColors, 24, 0));
+ QApplication::setPalette(widgetPalette, "QLineEdit");
+ widgetPalette = *palette;
+
+ widgetPalette.setColor(QPalette::All, QPalette::Text,
+ s60Color(QS60StyleEnums::CL_QsnTextColors, 34, 0));
+ widgetPalette.setColor(QPalette::All, QPalette::HighlightedText,
+ s60Color(QS60StyleEnums::CL_QsnTextColors, 24, 0));
+ QApplication::setPalette(widgetPalette, "QTextEdit");
+ widgetPalette = *palette;
+
+ widgetPalette.setColor(QPalette::All, QPalette::HighlightedText,
+ s60Color(QS60StyleEnums::CL_QsnTextColors, 24, 0));
+ QApplication::setPalette(widgetPalette, "QComboBox");
+ widgetPalette = *palette;
+
+ widgetPalette.setColor(QPalette::WindowText, mainAreaTextColor);
+ widgetPalette.setColor(QPalette::Button, QApplication::palette().color(QPalette::Button));
+ widgetPalette.setColor(QPalette::Dark, mainAreaTextColor.darker());
+ widgetPalette.setColor(QPalette::Light, mainAreaTextColor.lighter());
+ QApplication::setPalette(widgetPalette, "QDial");
+ widgetPalette = *palette;
+
+ widgetPalette.setBrush(QPalette::Window, QBrush());
+ QApplication::setPalette(widgetPalette, "QScrollArea");
+ widgetPalette = *palette;
+}
+
+QSize QS60StylePrivate::partSize(QS60StyleEnums::SkinParts part, SkinElementFlags flags)
+{
+ QSize result(20, 20);
+ switch (part)
+ {
+ case QS60StyleEnums::SP_QgnGrafBarProgress:
+ result.setWidth(pixelMetric(QStyle::PM_ProgressBarChunkWidth));
+ break;
+ case QS60StyleEnums::SP_QgnGrafTabActiveM:
+ case QS60StyleEnums::SP_QgnGrafTabPassiveM:
+ case QS60StyleEnums::SP_QgnGrafTabActiveR:
+ case QS60StyleEnums::SP_QgnGrafTabPassiveR:
+ case QS60StyleEnums::SP_QgnGrafTabPassiveL:
+ case QS60StyleEnums::SP_QgnGrafTabActiveL:
+ break;
+ case QS60StyleEnums::SP_QgnIndiSliderEdit:
+ result.scale(pixelMetric(QStyle::PM_SliderLength),
+ pixelMetric(QStyle::PM_SliderControlThickness), Qt::IgnoreAspectRatio);
+ break;
+
+ case QS60StyleEnums::SP_QsnCpScrollHandleBottomPressed:
+ case QS60StyleEnums::SP_QsnCpScrollHandleTopPressed:
+ case QS60StyleEnums::SP_QsnCpScrollHandleMiddlePressed:
+ case QS60StyleEnums::SP_QsnCpScrollBgBottom:
+ case QS60StyleEnums::SP_QsnCpScrollBgMiddle:
+ case QS60StyleEnums::SP_QsnCpScrollBgTop:
+ case QS60StyleEnums::SP_QsnCpScrollHandleBottom:
+ case QS60StyleEnums::SP_QsnCpScrollHandleMiddle:
+ case QS60StyleEnums::SP_QsnCpScrollHandleTop:
+ result.setHeight(pixelMetric(QStyle::PM_ScrollBarExtent));
+ result.setWidth(pixelMetric(QStyle::PM_ScrollBarSliderMin));
+ break;
+ default:
+ // Generic frame part size gathering.
+ for (int i = 0; i < frameElementsCount; ++i)
+ {
+ switch (m_frameElementsData[i].center - part) {
+ case 8: /* CornerTl */
+ case 7: /* CornerTr */
+ case 6: /* CornerBl */
+ case 5: /* CornerBr */
+ result.setWidth(pixelMetric(PM_Custom_FrameCornerWidth));
+ // Falltrough intended...
+ case 4: /* SideT */
+ case 3: /* SideB */
+ result.setHeight(pixelMetric(PM_Custom_FrameCornerHeight));
+ break;
+ case 2: /* SideL */
+ case 1: /* SideR */
+ result.setWidth(pixelMetric(PM_Custom_FrameCornerWidth));
+ break;
+ case 0: /* center */
+ default:
+ break;
+ }
+ }
+ break;
+ }
+ if (flags & (SF_PointEast | SF_PointWest)) {
+ const int temp = result.width();
+ result.setWidth(result.height());
+ result.setHeight(temp);
+ }
+ return result;
+}
+
+/*!
+ \class QS60Style
+ \brief The QS60Style class provides a look and feel suitable for applications on S60.
+ \since 4.6
+ \ingroup appearance
+
+ \sa QMacStyle, QWindowsStyle, QWindowsXPStyle, QWindowsVistaStyle, QPlastiqueStyle, QCleanlooksStyle, QMotifStyle
+*/
+
+
+/*!
+ Destroys the style.
+*/
+QS60Style::~QS60Style()
+{
+}
+
+/*!
+ \reimp
+*/
+void QS60Style::drawComplexControl(ComplexControl control, const QStyleOptionComplex *option, QPainter *painter, const QWidget *widget) const
+{
+ const QS60StylePrivate::SkinElementFlags flags = (option->state & State_Enabled) ? QS60StylePrivate::SF_StateEnabled : QS60StylePrivate::SF_StateDisabled;
+ SubControls sub = option->subControls;
+
+ switch (control) {
+#ifndef QT_NO_SCROLLBAR
+ case CC_ScrollBar:
+ if (const QStyleOptionSlider *optionSlider = qstyleoption_cast<const QStyleOptionSlider *>(option)) {
+ const bool horizontal = optionSlider->orientation == Qt::Horizontal;
+
+ const QRect scrollBarSlider = subControlRect(control, optionSlider, SC_ScrollBarSlider, widget);
+ const QRect grooveRect = subControlRect(control, optionSlider, SC_ScrollBarGroove, widget);
+
+ const QS60StylePrivate::SkinElements grooveElement =
+ horizontal ? QS60StylePrivate::SE_ScrollBarGrooveHorizontal : QS60StylePrivate::SE_ScrollBarGrooveVertical;
+ QS60StylePrivate::drawSkinElement(grooveElement, painter, grooveRect, flags);
+
+ const QStyle::SubControls subControls = optionSlider->subControls;
+
+ // select correct slider (horizontal/vertical/pressed)
+ const bool sliderPressed = ((optionSlider->state & QStyle::State_Sunken) && (subControls & SC_ScrollBarSlider));
+ const QS60StylePrivate::SkinElements handleElement =
+ horizontal ?
+ ( sliderPressed ?
+ QS60StylePrivate::SE_ScrollBarHandlePressedHorizontal :
+ QS60StylePrivate::SE_ScrollBarHandleHorizontal ) :
+ ( sliderPressed ?
+ QS60StylePrivate::SE_ScrollBarHandlePressedVertical :
+ QS60StylePrivate::SE_ScrollBarHandleVertical);
+ QS60StylePrivate::drawSkinElement(handleElement, painter, scrollBarSlider, flags);
+ }
+ break;
+#endif // QT_NO_SCROLLBAR
+#ifndef QT_NO_SLIDER
+ case CC_Slider:
+ if (const QStyleOptionSlider *optionSlider = qstyleoption_cast<const QStyleOptionSlider *>(option)) {
+
+ // The groove is just a centered line. Maybe a qgn_graf_line_* at some point
+ const QRect sliderGroove = subControlRect(control, optionSlider, SC_SliderGroove, widget);
+ const QPoint sliderGrooveCenter = sliderGroove.center();
+ const bool horizontal = optionSlider->orientation == Qt::Horizontal;
+ painter->save();
+ if (widget)
+ painter->setPen(widget->palette().windowText().color());
+ if (horizontal)
+ painter->drawLine(0, sliderGrooveCenter.y(), sliderGroove.right(), sliderGrooveCenter.y());
+ else
+ painter->drawLine(sliderGrooveCenter.x(), 0, sliderGrooveCenter.x(), sliderGroove.bottom());
+ painter->restore();
+
+ const QRect sliderHandle = subControlRect(control, optionSlider, SC_SliderHandle, widget);
+ const QS60StylePrivate::SkinElements handleElement =
+ horizontal ? QS60StylePrivate::SE_SliderHandleHorizontal : QS60StylePrivate::SE_SliderHandleVertical;
+ QS60StylePrivate::drawSkinElement(handleElement, painter, sliderHandle, flags);
+ }
+ break;
+#endif // QT_NO_SLIDER
+#ifndef QT_NO_COMBOBOX
+ case CC_ComboBox:
+ if (const QStyleOptionComboBox *cmb = qstyleoption_cast<const QStyleOptionComboBox *>(option)) {
+ const QRect cmbxEditField = subControlRect(CC_ComboBox, option, SC_ComboBoxEditField, widget);
+ const QRect cmbxFrame = subControlRect(CC_ComboBox, option, SC_ComboBoxFrame, widget);
+ const bool direction = cmb->direction == Qt::LeftToRight;
+
+ // Button frame
+ QStyleOptionFrame buttonOption;
+ buttonOption.QStyleOption::operator=(*cmb);
+ const int maxHeight = cmbxFrame.height();
+ const int maxWidth = cmbxFrame.width() - cmbxEditField.width();
+ const int topLeftPoint = direction ? cmbxEditField.right()+1 : cmbxEditField.left()+1-maxWidth;
+ const QRect buttonRect(topLeftPoint, cmbxEditField.top(), maxWidth, maxHeight);
+ buttonOption.rect = buttonRect;
+ buttonOption.state = cmb->state & (State_Enabled | State_MouseOver);
+ drawPrimitive(PE_PanelButtonCommand, &buttonOption, painter, widget);
+
+ // draw label background - label itself is drawn separately
+ const QS60StylePrivate::SkinElements skinElement = QS60StylePrivate::SE_FrameLineEdit;
+ QS60StylePrivate::drawSkinElement(skinElement, painter, cmbxEditField, flags);
+
+ // Draw the combobox arrow
+ if (sub & SC_ComboBoxArrow) {
+ // Make rect slightly smaller
+ buttonOption.rect.adjust(1, 1, -1, -1);
+ painter->save();
+ painter->setPen(option->palette.buttonText().color());
+ drawPrimitive(PE_IndicatorSpinDown, &buttonOption, painter, widget);
+ painter->restore();
+ }
+ }
+ break;
+#endif // QT_NO_COMBOBOX
+#ifndef QT_NO_TOOLBUTTON
+ case CC_ToolButton:
+ if (const QStyleOptionToolButton *toolBtn = qstyleoption_cast<const QStyleOptionToolButton *>(option)) {
+ const State bflags = toolBtn->state;
+ const QRect button(subControlRect(control, toolBtn, SC_ToolButton, widget));
+ QStyleOptionToolButton toolButton = *toolBtn;
+
+ if (sub&SC_ToolButton) {
+ QStyleOption tool(0);
+ tool.palette = toolBtn->palette;
+
+ // Check if toolbutton is in toolbar.
+ QToolBar *toolBar = 0;
+ if (widget)
+ toolBar = qobject_cast<QToolBar *>(widget->parentWidget());
+
+ if (bflags & (State_Sunken | State_On | State_Raised)) {
+ tool.rect = button;
+ tool.state = bflags;
+
+ // todo: I'd like to move extension button next to where last button is
+ // however, the painter seems to want to clip the button rect even if I turn of the clipping.
+ if (toolBar && (qobject_cast<const QToolBarExtension *>(widget))){
+ /*QList<QAction *> actionList = toolBar->actions();
+ const int actionCount = actionList.count();
+ const int toolbarWidth = toolBar->width();
+ const int extButtonWidth = pixelMetric(PM_ToolBarExtensionExtent, option, widget);
+ const int toolBarButtonWidth = pixelMetric(PM_ToolBarIconSize, option, widget);
+ const int frame = pixelMetric(PM_ToolBarFrameWidth, option, widget);
+ const int margin = pixelMetric(PM_ToolBarItemMargin, option, widget);
+ const int border = frame + margin;
+ const int spacing = pixelMetric(PM_ToolBarItemSpacing, option, widget);
+ const int toolBarButtonArea = toolbarWidth - extButtonWidth - spacing - 2*border;
+ const int numberOfVisibleButtons = toolBarButtonArea / toolBarButtonWidth;
+ // new extension button place is after border and all the other visible buttons (with spacings)
+ const int newXForExtensionButton = numberOfVisibleButtons * toolBarButtonWidth + (numberOfVisibleButtons-1)*spacing + border;
+ painter->save();
+ painter->setClipping(false);
+ tool.rect.translate(-newXForExtensionButton,0);
+ painter->restore();*/
+ }
+
+ if (toolBar){
+ /*if (toolBar->orientation() == Qt::Vertical){
+ // todo: I'd like to make all vertical buttons the same size, but again the painter
+ // prefers to use clipping for button rects, even though clipping has been set off.
+ painter->save();
+ painter->setClipping(false);
+
+ const int origWidth = tool.rect.width();
+ const int newWidth = toolBar->width()-2*pixelMetric(PM_ToolBarFrameWidth, option, widget);
+ painter->translate(origWidth-newWidth,0);
+ tool.rect.translate(origWidth-tool.rect.width(),0);
+ tool.rect.setWidth(newWidth);
+
+ if (option->state & QStyle::State_Sunken)
+ QS60StylePrivate::drawSkinElement(QS60StylePrivate::SE_ToolBarButtonPressed, painter, tool.rect, flags);
+ else
+ QS60StylePrivate::drawSkinElement(QS60StylePrivate::SE_ToolBarButton, painter, tool.rect, flags);
+
+ }*/
+ if (option->state & QStyle::State_Sunken)
+ QS60StylePrivate::drawSkinElement(QS60StylePrivate::SE_ToolBarButtonPressed, painter, tool.rect, flags);
+ else
+ QS60StylePrivate::drawSkinElement(QS60StylePrivate::SE_ToolBarButton, painter, tool.rect, flags);
+ /*
+ if (toolBar->orientation() == Qt::Vertical)
+ painter->restore();
+ */
+ } else {
+ drawPrimitive(PE_PanelButtonTool, &tool, painter, widget);
+ }
+ }
+ }
+
+ if (toolBtn->features & QStyleOptionToolButton::Arrow) {
+ QStyle::PrimitiveElement pe;
+ switch (toolBtn->arrowType) {
+ case Qt::LeftArrow:
+ pe = QStyle::PE_IndicatorArrowLeft;
+ break;
+ case Qt::RightArrow:
+ pe = QStyle::PE_IndicatorArrowRight;
+ break;
+ case Qt::UpArrow:
+ pe = QStyle::PE_IndicatorArrowUp;
+ break;
+ case Qt::DownArrow:
+ pe = QStyle::PE_IndicatorArrowDown;
+ break;
+ default:
+ break; }
+ toolButton.rect = button;
+ drawPrimitive(pe, &toolButton, painter, widget);
+ }
+
+ if (toolBtn->text.length()>0 ||
+ !toolBtn->icon.isNull()) {
+ const int frameWidth = pixelMetric(PM_DefaultFrameWidth, option, widget);
+ toolButton.rect = button.adjusted(frameWidth, frameWidth, -frameWidth, -frameWidth);
+ drawControl(CE_ToolButtonLabel, &toolButton, painter, widget);
+ }
+ }
+ break;
+#endif //QT_NO_TOOLBUTTON
+#ifndef QT_NO_SPINBOX
+ case CC_SpinBox:
+ if (const QStyleOptionSpinBox *spinBox = qstyleoption_cast<const QStyleOptionSpinBox *>(option)) {
+ QStyleOptionSpinBox copy = *spinBox;
+ PrimitiveElement pe;
+
+ if (spinBox->subControls & SC_SpinBoxUp) {
+ copy.subControls = SC_SpinBoxUp;
+ QPalette spinBoxPal = spinBox->palette;
+ if (!(spinBox->stepEnabled & QAbstractSpinBox::StepUpEnabled)) {
+ spinBoxPal.setCurrentColorGroup(QPalette::Disabled);
+ copy.state &= ~State_Enabled;
+ copy.palette = spinBoxPal;
+ }
+
+ if (spinBox->activeSubControls == SC_SpinBoxUp && (spinBox->state & State_Sunken)) {
+ copy.state |= State_On;
+ copy.state |= State_Sunken;
+ } else {
+ copy.state |= State_Raised;
+ copy.state &= ~State_Sunken;
+ }
+ pe = (spinBox->buttonSymbols == QAbstractSpinBox::PlusMinus) ?
+ PE_IndicatorSpinPlus :
+ PE_IndicatorSpinUp;
+
+ copy.rect = subControlRect(CC_SpinBox, spinBox, SC_SpinBoxUp, widget);
+ drawPrimitive(PE_PanelButtonBevel, &copy, painter, widget);
+ copy.rect.adjust(1, 1, -1, -1);
+ drawPrimitive(pe, &copy, painter, widget);
+ }
+
+ if (spinBox->subControls & SC_SpinBoxDown) {
+ copy.subControls = SC_SpinBoxDown;
+ copy.state = spinBox->state;
+ QPalette spinBoxPal = spinBox->palette;
+ if (!(spinBox->stepEnabled & QAbstractSpinBox::StepDownEnabled)) {
+ spinBoxPal.setCurrentColorGroup(QPalette::Disabled);
+ copy.state &= ~State_Enabled;
+ copy.palette = spinBoxPal;
+ }
+
+ if (spinBox->activeSubControls == SC_SpinBoxDown && (spinBox->state & State_Sunken)) {
+ copy.state |= State_On;
+ copy.state |= State_Sunken;
+ } else {
+ copy.state |= State_Raised;
+ copy.state &= ~State_Sunken;
+ }
+ pe = (spinBox->buttonSymbols == QAbstractSpinBox::PlusMinus) ?
+ PE_IndicatorSpinMinus :
+ PE_IndicatorSpinDown;
+
+ copy.rect = subControlRect(CC_SpinBox, spinBox, SC_SpinBoxDown, widget);
+ drawPrimitive(PE_PanelButtonBevel, &copy, painter, widget);
+ copy.rect.adjust(1, 1, -1, -1);
+ drawPrimitive(pe, &copy, painter, widget);
+ }
+ }
+ break;
+#endif //QT_NO_SPINBOX
+#ifndef QT_NO_GROUPBOX
+ case CC_GroupBox:
+ if (const QStyleOptionGroupBox *groupBox = qstyleoption_cast<const QStyleOptionGroupBox *>(option)) {
+ // Draw frame
+ const QRect textRect = subControlRect(CC_GroupBox, option, SC_GroupBoxLabel, widget);
+ const QRect checkBoxRect = subControlRect(CC_GroupBox, option, SC_GroupBoxCheckBox, widget);
+ if (groupBox->subControls & QStyle::SC_GroupBoxFrame) {
+ QStyleOptionFrameV2 frame;
+ frame.QStyleOption::operator=(*groupBox);
+ frame.features = groupBox->features;
+ frame.lineWidth = groupBox->lineWidth;
+ frame.midLineWidth = groupBox->midLineWidth;
+ frame.rect = subControlRect(CC_GroupBox, option, SC_GroupBoxFrame, widget);
+ drawPrimitive(PE_FrameGroupBox, &frame, painter, widget);
+ }
+
+ // Draw title
+ if ((groupBox->subControls & QStyle::SC_GroupBoxLabel) && !groupBox->text.isEmpty()) {
+ const QColor textColor = groupBox->textColor;
+ painter->save();
+
+ if (textColor.isValid())
+ painter->setPen(textColor);
+ int alignment = int(groupBox->textAlignment);
+ if (!styleHint(QStyle::SH_UnderlineShortcut, option, widget))
+ alignment |= Qt::TextHideMnemonic;
+
+ drawItemText(painter, textRect, Qt::TextShowMnemonic | Qt::AlignHCenter | Qt::AlignVCenter | alignment,
+ groupBox->palette, groupBox->state & State_Enabled, groupBox->text,
+ textColor.isValid() ? QPalette::NoRole : QPalette::WindowText);
+ painter->restore();
+ }
+
+ // Draw checkbox
+ if (groupBox->subControls & SC_GroupBoxCheckBox) {
+ QStyleOptionButton box;
+ box.QStyleOption::operator=(*groupBox);
+ box.rect = checkBoxRect;
+ drawPrimitive(PE_IndicatorCheckBox, &box, painter, widget);
+ }
+ }
+ break;
+#endif //QT_NO_GROUPBOX
+ default:
+ QCommonStyle::drawComplexControl(control, option, painter, widget);
+ }
+}
+
+/*!
+ \reimp
+*/
+void QS60Style::drawControl(ControlElement element, const QStyleOption *option, QPainter *painter, const QWidget *widget) const
+{
+ Q_D(const QS60Style);
+ const QS60StylePrivate::SkinElementFlags flags = (option->state & State_Enabled) ? QS60StylePrivate::SF_StateEnabled : QS60StylePrivate::SF_StateDisabled;
+ switch (element) {
+ case CE_PushButton:
+ if (const QStyleOptionButton *btn = qstyleoption_cast<const QStyleOptionButton *>(option)) {
+
+ drawControl(CE_PushButtonBevel, btn, painter, widget);
+ QStyleOptionButton subopt = *btn;
+ subopt.rect = subElementRect(SE_PushButtonContents, btn, widget);
+
+ drawControl(CE_PushButtonLabel, &subopt, painter, widget);
+ }
+ break;
+ case CE_PushButtonBevel:
+ if (const QStyleOptionButton *button = qstyleoption_cast<const QStyleOptionButton *>(option)) {
+ const bool isDisabled = !(option->state & QStyle::State_Enabled);
+ const bool isFlat = button->features & QStyleOptionButton::Flat;
+ QS60StyleEnums::SkinParts skinPart;
+ QS60StylePrivate::SkinElements skinElement;
+ if (!isDisabled) {
+ const bool isPressed = (option->state & QStyle::State_Sunken) ||
+ (option->state & QStyle::State_On);
+ if (isFlat) {
+ skinPart =
+ isPressed ? QS60StyleEnums::SP_QsnFrButtonTbCenterPressed : QS60StyleEnums::SP_QsnFrButtonTbCenter;
+ } else {
+ skinElement =
+ isPressed ? QS60StylePrivate::SE_ButtonPressed : QS60StylePrivate::SE_ButtonNormal;
+ }
+ } else {
+ if (isFlat)
+ skinPart =QS60StyleEnums::SP_QsnFrButtonCenterInactive;
+ else
+ skinElement = QS60StylePrivate::SE_ButtonInactive;
+ }
+ if (isFlat)
+ QS60StylePrivate::drawSkinPart(skinPart, painter, option->rect, flags);
+ else
+ QS60StylePrivate::drawSkinElement(skinElement, painter, option->rect, flags);
+ }
+ break;
+#ifndef QT_NO_TOOLBUTTON
+ case CE_ToolButtonLabel:
+ if (const QStyleOptionToolButton *toolBtn = qstyleoption_cast<const QStyleOptionToolButton *>(option)) {
+ QStyleOptionToolButton optionToolButton = *toolBtn;
+
+ if (!optionToolButton.icon.isNull() && (optionToolButton.state & QStyle::State_Sunken)
+ && (optionToolButton.state & State_Enabled)) {
+
+ const QIcon::State state = optionToolButton.state & State_On ? QIcon::On : QIcon::Off;
+ const QPixmap pm(optionToolButton.icon.pixmap(optionToolButton.rect.size().boundedTo(optionToolButton.iconSize),
+ QIcon::Normal, state));
+ optionToolButton.icon = generatedIconPixmap(QIcon::Selected, pm, &optionToolButton);
+ }
+
+ QCommonStyle::drawControl(element, &optionToolButton, painter, widget);
+ }
+ break;
+#endif //QT_NO_TOOLBUTTON
+#ifndef QT_NO_COMBOBOX
+ case CE_ComboBoxLabel:
+ if (const QStyleOptionComboBox *comboBox = qstyleoption_cast<const QStyleOptionComboBox *>(option)) {
+ QStyleOption optionComboBox = *comboBox;
+ optionComboBox.palette.setColor(QPalette::Active, QPalette::WindowText,
+ optionComboBox.palette.text().color() );
+ optionComboBox.palette.setColor(QPalette::Inactive, QPalette::WindowText,
+ optionComboBox.palette.text().color() );
+ QRect editRect = subControlRect(CC_ComboBox, comboBox, SC_ComboBoxEditField, widget);
+ painter->save();
+ painter->setClipRect(editRect);
+
+ if (!comboBox->currentIcon.isNull()) {
+ QIcon::Mode mode = comboBox->state & State_Enabled ? QIcon::Normal : QIcon::Disabled;
+ QPixmap pixmap = comboBox->currentIcon.pixmap(comboBox->iconSize, mode);
+ QRect iconRect(editRect);
+ iconRect.setWidth(comboBox->iconSize.width() + 4);
+ iconRect = alignedRect(comboBox->direction,
+ Qt::AlignLeft | Qt::AlignVCenter,
+ iconRect.size(), editRect);
+ if (comboBox->editable)
+ painter->fillRect(iconRect, optionComboBox.palette.brush(QPalette::Base));
+ drawItemPixmap(painter, iconRect, Qt::AlignCenter, pixmap);
+
+ if (comboBox->direction == Qt::RightToLeft)
+ editRect.translate(-4 - comboBox->iconSize.width(), 0);
+ else
+ editRect.translate(comboBox->iconSize.width() + 4, 0);
+ }
+ if (!comboBox->currentText.isEmpty() && !comboBox->editable) {
+ QCommonStyle::drawItemText(painter,
+ editRect.adjusted(QS60StylePrivate::pixelMetric(PM_Custom_FrameCornerWidth), 0, -1, 0),
+ visualAlignment(comboBox->direction, Qt::AlignLeft | Qt::AlignVCenter),
+ comboBox->palette, comboBox->state & State_Enabled, comboBox->currentText);
+ }
+ painter->restore();
+ }
+ break;
+#endif //QT_NO_COMBOBOX
+#ifndef QT_NO_ITEMVIEWS
+ case CE_ItemViewItem:
+ if (const QStyleOptionViewItemV4 *vopt = qstyleoption_cast<const QStyleOptionViewItemV4 *>(option)) {
+ QStyleOptionViewItemV4 voptAdj = *vopt;
+ painter->save();
+
+ painter->setClipRect(voptAdj.rect);
+ const bool isSelected = (voptAdj.state & QStyle::State_HasFocus);
+
+ bool isVisible = false;
+ int scrollBarWidth = 0;
+ QList<QScrollBar *> scrollBars = qFindChildren<QScrollBar *>(widget);
+ for (int i = 0; i < scrollBars.size(); ++i) {
+ QScrollBar *scrollBar = scrollBars.at(i);
+ if (scrollBar && scrollBar->orientation() == Qt::Vertical) {
+ isVisible = scrollBar->isVisible();
+ scrollBarWidth = scrollBar->size().width();
+ break;
+ }
+ }
+
+ int rightValue = widget ? widget->contentsRect().right() : 0;
+
+ if (isVisible)
+ rightValue -= scrollBarWidth;
+
+ if (voptAdj.rect.right() > rightValue)
+ voptAdj.rect.setRight(rightValue);
+
+ const QRect iconRect = subElementRect(SE_ItemViewItemDecoration, &voptAdj, widget);
+ QRect textRect = subElementRect(SE_ItemViewItemText, &voptAdj, widget);
+
+ // draw themed background for table unless background brush has been defined.
+ if (vopt->backgroundBrush == Qt::NoBrush) {
+ const QStyleOptionViewItemV4 *tableOption = qstyleoption_cast<const QStyleOptionViewItemV4 *>(option);
+ const QTableView *table = qobject_cast<const QTableView *>(widget);
+ if (table && tableOption) {
+ const QModelIndex index = tableOption->index;
+ //todo: Draw cell background only once - for the first cell.
+ QStyleOptionViewItemV4 voptAdj2 = voptAdj;
+ const QModelIndex indexFirst = table->model()->index(0,0);
+ const QModelIndex indexLast = table->model()->index(
+ table->model()->rowCount()-1,table->model()->columnCount()-1);
+ if (table->viewport())
+ voptAdj2.rect = QRect( table->visualRect(indexFirst).topLeft(),
+ table->visualRect(indexLast).bottomRight()).intersect(table->viewport()->rect());
+ drawPrimitive(PE_PanelItemViewItem, &voptAdj2, painter, widget);
+ }
+ } else { QCommonStyle::drawPrimitive(PE_PanelItemViewItem, option, painter, widget);}
+
+ // draw the focus rect
+ if (isSelected) {
+ const QRect highlightRect = option->rect.adjusted(1,1,-1,-1);
+ QS60StylePrivate::drawSkinElement(QS60StylePrivate::SE_ListHighlight, painter, highlightRect, flags);
+ }
+
+ // draw the icon
+ const QIcon::Mode mode = (voptAdj.state & QStyle::State_Enabled) ? QIcon::Normal : QIcon::Disabled;
+ const QIcon::State state = voptAdj.state & QStyle::State_Open ? QIcon::On : QIcon::Off;
+ voptAdj.icon.paint(painter, iconRect, voptAdj.decorationAlignment, mode, state);
+
+ // Draw selection check mark. Show check mark only in multi selection modes.
+ if (const QListView *listView = (qobject_cast<const QListView *>(widget))) {
+ const bool singleSelection =
+ listView &&
+ (listView->selectionMode() == QAbstractItemView::SingleSelection ||
+ listView->selectionMode() == QAbstractItemView::NoSelection);
+ const QRect selectionRect = subElementRect(SE_ItemViewItemCheckIndicator, &voptAdj, widget);
+ if (voptAdj.state & QStyle::State_Selected && !singleSelection) {
+ QStyleOptionViewItemV4 option(voptAdj);
+ option.rect = selectionRect;
+ // Draw selection mark.
+ drawPrimitive(QStyle::PE_IndicatorViewItemCheck, &option, painter, widget);
+ if ( textRect.right() > selectionRect.left() )
+ textRect.setRight(selectionRect.left());
+ } else if (singleSelection &&
+ voptAdj.features & QStyleOptionViewItemV2::HasCheckIndicator) {
+ // draw the check mark
+ if (selectionRect.isValid()) {
+ QStyleOptionViewItemV4 option(*vopt);
+ option.rect = selectionRect;
+ option.state = option.state & ~QStyle::State_HasFocus;
+
+ switch (vopt->checkState) {
+ case Qt::Unchecked:
+ option.state |= QStyle::State_Off;
+ break;
+ case Qt::PartiallyChecked:
+ option.state |= QStyle::State_NoChange;
+ break;
+ case Qt::Checked:
+ option.state |= QStyle::State_On;
+ break;
+ }
+ drawPrimitive(QStyle::PE_IndicatorViewItemCheck, &option, painter, widget);
+ }
+ }
+ }
+
+ // draw the text
+ if (!voptAdj.text.isEmpty()) {
+ const QStyleOptionViewItemV4 *tableOption = qstyleoption_cast<const QStyleOptionViewItemV4 *>(option);
+ if (isSelected) {
+ if (qobject_cast<const QTableView *>(widget) && tableOption)
+ voptAdj.palette.setColor(
+ QPalette::Text, QS60StylePrivate::s60Color(QS60StyleEnums::CL_QsnTextColors, 11, 0));
+ else
+ voptAdj.palette.setColor(
+ QPalette::Text, QS60StylePrivate::s60Color(QS60StyleEnums::CL_QsnTextColors, 10, 0));
+ }
+ painter->setPen(voptAdj.palette.text().color());
+ d->viewItemDrawText(painter, &voptAdj, textRect);
+ }
+ painter->restore();
+ }
+ break;
+#endif // QT_NO_ITEMVIEWS
+#ifndef QT_NO_TABBAR
+ case CE_TabBarTabShape:
+ if (const QStyleOptionTabV3 *optionTab = qstyleoption_cast<const QStyleOptionTabV3 *>(option)) {
+ QStyleOptionTabV3 optionTabAdj = *optionTab;
+ const bool isSelected = optionTab->state & QStyle::State_Selected;
+ const bool directionMirrored = (optionTab->direction == Qt::RightToLeft);
+ QS60StylePrivate::SkinElements skinElement;
+ switch (optionTab->shape) {
+ case QTabBar::TriangularEast:
+ case QTabBar::RoundedEast:
+ skinElement = isSelected ? QS60StylePrivate::SE_TabBarTabEastActive:
+ QS60StylePrivate::SE_TabBarTabEastInactive;
+ break;
+ case QTabBar::TriangularSouth:
+ case QTabBar::RoundedSouth:
+ skinElement = isSelected ? QS60StylePrivate::SE_TabBarTabSouthActive:
+ QS60StylePrivate::SE_TabBarTabSouthInactive;
+ break;
+ case QTabBar::TriangularWest:
+ case QTabBar::RoundedWest:
+ skinElement = isSelected ? QS60StylePrivate::SE_TabBarTabWestActive:
+ QS60StylePrivate::SE_TabBarTabWestInactive;
+ break;
+ case QTabBar::TriangularNorth:
+ case QTabBar::RoundedNorth:
+ default:
+ skinElement = isSelected ? QS60StylePrivate::SE_TabBarTabNorthActive:
+ QS60StylePrivate::SE_TabBarTabNorthInactive;
+ break;
+ }
+ if (skinElement==QS60StylePrivate::SE_TabBarTabEastInactive||
+ skinElement==QS60StylePrivate::SE_TabBarTabNorthInactive||
+ skinElement==QS60StylePrivate::SE_TabBarTabSouthInactive||
+ skinElement==QS60StylePrivate::SE_TabBarTabWestInactive||
+ skinElement==QS60StylePrivate::SE_TabBarTabEastActive||
+ skinElement==QS60StylePrivate::SE_TabBarTabNorthActive||
+ skinElement==QS60StylePrivate::SE_TabBarTabSouthActive||
+ skinElement==QS60StylePrivate::SE_TabBarTabWestActive) {
+ const int borderThickness =
+ QS60StylePrivate::pixelMetric(QStyle::PM_DefaultFrameWidth);
+ const int tabOverlap =
+ QS60StylePrivate::pixelMetric(QStyle::PM_TabBarTabOverlap) - borderThickness;
+ //todo: draw navi wipe behind tabbar - must be drawn with first draw
+
+ if (skinElement==QS60StylePrivate::SE_TabBarTabEastInactive||
+ skinElement==QS60StylePrivate::SE_TabBarTabEastActive||
+ skinElement==QS60StylePrivate::SE_TabBarTabWestInactive||
+ skinElement==QS60StylePrivate::SE_TabBarTabWestActive){
+ optionTabAdj.rect.adjust(0, 0, 0, tabOverlap);
+ } else {
+ if (directionMirrored)
+ optionTabAdj.rect.adjust(-tabOverlap, 0, 0, 0);
+ else
+ optionTabAdj.rect.adjust(0, 0, tabOverlap, 0);
+ }
+ }
+ QS60StylePrivate::drawSkinElement(skinElement, painter, optionTabAdj.rect, flags);
+ }
+ break;
+ case CE_TabBarTabLabel:
+ if (const QStyleOptionTabV3 *tab = qstyleoption_cast<const QStyleOptionTabV3 *>(option)) {
+ QStyleOptionTabV3 optionTab = *tab;
+ QRect tr = optionTab.rect;
+ const bool directionMirrored = (optionTab.direction == Qt::RightToLeft);
+ const int borderThickness = QS60StylePrivate::pixelMetric(QStyle::PM_DefaultFrameWidth);
+ const int tabOverlap =
+ QS60StylePrivate::pixelMetric(QStyle::PM_TabBarTabOverlap) - borderThickness;
+ const QRect windowRect = painter->window();
+
+ switch (tab->shape) {
+ case QTabBar::TriangularWest:
+ case QTabBar::RoundedWest:
+ case QTabBar::TriangularEast:
+ case QTabBar::RoundedEast:
+ tr.adjust(0, 0, 0, tabOverlap);
+ break;
+ case QTabBar::TriangularSouth:
+ case QTabBar::RoundedSouth:
+ case QTabBar::TriangularNorth:
+ case QTabBar::RoundedNorth:
+ default:
+ if (directionMirrored)
+ tr.adjust(-tabOverlap, 0, 0, 0);
+ else
+ tr.adjust(0, 0, tabOverlap, 0);
+ break;
+ }
+ painter->save();
+ QFont f = painter->font();
+ f.setPointSizeF(f.pointSizeF() * KTabFontMul);
+ painter->setFont(f);
+
+ if (option->state & QStyle::State_Selected){
+ optionTab.palette.setColor(QPalette::Active, QPalette::WindowText,
+ QS60StylePrivate::s60Color(QS60StyleEnums::CL_QsnTextColors, 3, option));
+ }
+
+ const bool verticalTabs = optionTab.shape == QTabBar::RoundedEast
+ || optionTab.shape == QTabBar::RoundedWest
+ || optionTab.shape == QTabBar::TriangularEast
+ || optionTab.shape == QTabBar::TriangularWest;
+ const bool selected = optionTab.state & State_Selected;
+ if (verticalTabs) {
+ painter->save();
+ int newX, newY, newRotation;
+ if (optionTab.shape == QTabBar::RoundedEast || optionTab.shape == QTabBar::TriangularEast) {
+ newX = tr.width();
+ newY = tr.y();
+ newRotation = 90;
+ } else {
+ newX = 0;
+ newY = tr.y() + tr.height();
+ newRotation = -90;
+ }
+ tr.setRect(0, 0, tr.height(), tr.width());
+ QTransform m;
+ m.translate(newX, newY);
+ m.rotate(newRotation);
+ painter->setTransform(m, true);
+ }
+ tr.adjust(0, 0, pixelMetric(QStyle::PM_TabBarTabShiftHorizontal, tab, widget),
+ pixelMetric(QStyle::PM_TabBarTabShiftVertical, tab, widget));
+
+ if (selected) {
+ tr.setBottom(tr.bottom() - pixelMetric(QStyle::PM_TabBarTabShiftVertical, tab, widget));
+ tr.setRight(tr.right() - pixelMetric(QStyle::PM_TabBarTabShiftHorizontal, tab, widget));
+ }
+
+ int alignment = Qt::AlignCenter | Qt::TextShowMnemonic;
+ if (!styleHint(SH_UnderlineShortcut, &optionTab, widget))
+ alignment |= Qt::TextHideMnemonic;
+ if (!optionTab.icon.isNull()) {
+ QSize iconSize = optionTab.iconSize;
+ int iconExtent = pixelMetric(PM_TabBarIconSize);
+ if (iconSize.height() > iconExtent || iconSize.width() > iconExtent)
+ iconSize = QSize(iconExtent, iconExtent);
+ QPixmap tabIcon = optionTab.icon.pixmap(iconSize,
+ (optionTab.state & State_Enabled) ? QIcon::Normal : QIcon::Disabled);
+ if (tab->text.isEmpty())
+ painter->drawPixmap(tr.center().x() - (tabIcon.height() >>1),
+ tr.center().y() - (tabIcon.height() >>1),
+ tabIcon);
+ else
+ painter->drawPixmap(tr.left() + tabOverlap,
+ tr.center().y() - (tabIcon.height() >>1),
+ tabIcon);
+ tr.setLeft(tr.left() + iconSize.width() + 4);
+ }
+
+ QCommonStyle::drawItemText(painter, tr, alignment, optionTab.palette, tab->state & State_Enabled, tab->text, QPalette::WindowText);
+ if (verticalTabs)
+ painter->restore();
+
+ painter->restore();
+ }
+ break;
+#endif // QT_NO_TABBAR
+#ifndef QT_NO_PROGRESSBAR
+ case CE_ProgressBarContents:
+ if (const QStyleOptionProgressBarV2 *optionProgressBar = qstyleoption_cast<const QStyleOptionProgressBarV2 *>(option)) {
+ QRect progressRect = optionProgressBar->rect;
+
+ if (optionProgressBar->minimum == optionProgressBar->maximum && optionProgressBar->minimum == 0) {
+ // busy indicator
+ const QS60StylePrivate::SkinElementFlag orientationFlag = optionProgressBar->orientation == Qt::Horizontal ?
+ QS60StylePrivate::SF_PointNorth : QS60StylePrivate::SF_PointWest;
+ QS60StylePrivate::drawSkinPart(QS60StyleEnums::SP_QgnGrafBarWait, painter, progressRect, flags | orientationFlag);
+ } else {
+ const qreal progressFactor = (optionProgressBar->minimum == optionProgressBar->maximum) ? 1.0
+ : (qreal)optionProgressBar->progress / optionProgressBar->maximum;
+ if (optionProgressBar->orientation == Qt::Horizontal) {
+ progressRect.setWidth(int(progressRect.width() * progressFactor));
+ if(optionProgressBar->direction == Qt::RightToLeft)
+ progressRect.translate(optionProgressBar->rect.width()-progressRect.width(),0);
+ progressRect.adjust(1, 0, -1, 0);
+ } else {
+ progressRect.adjust(0, 1, 0, -1);
+ progressRect.setTop(progressRect.bottom() - int(progressRect.height() * progressFactor));
+ }
+
+ const QS60StylePrivate::SkinElements skinElement = optionProgressBar->orientation == Qt::Horizontal ?
+ QS60StylePrivate::SE_ProgressBarIndicatorHorizontal : QS60StylePrivate::SE_ProgressBarIndicatorVertical;
+ QS60StylePrivate::drawSkinElement(skinElement, painter, progressRect, flags);
+ }
+ }
+ break;
+ case CE_ProgressBarGroove:
+ if (const QStyleOptionProgressBarV2 *optionProgressBar = qstyleoption_cast<const QStyleOptionProgressBarV2 *>(option)) {
+ const QS60StylePrivate::SkinElements skinElement = optionProgressBar->orientation == Qt::Horizontal ?
+ QS60StylePrivate::SE_ProgressBarGrooveHorizontal : QS60StylePrivate::SE_ProgressBarGrooveVertical;
+ QS60StylePrivate::drawSkinElement(skinElement, painter, option->rect, flags);
+ }
+ break;
+ case CE_ProgressBarLabel:
+ if (const QStyleOptionProgressBarV2 *progressbar = qstyleoption_cast<const QStyleOptionProgressBarV2 *>(option)) {
+ QStyleOptionProgressBarV2 optionProgressBar = *progressbar;
+ QCommonStyle::drawItemText(painter, progressbar->rect, flags | Qt::AlignCenter | Qt::TextSingleLine, optionProgressBar.palette,
+ progressbar->state & State_Enabled, progressbar->text, QPalette::WindowText);
+ }
+ break;
+#endif // QT_NO_PROGRESSBAR
+#ifndef QT_NO_MENU
+ case CE_MenuItem:
+ if (const QStyleOptionMenuItem *menuItem = qstyleoption_cast<const QStyleOptionMenuItem *>(option)) {
+ QStyleOptionMenuItem optionMenuItem = *menuItem;
+
+ bool drawSubMenuIndicator = false;
+ switch(menuItem->menuItemType) {
+ case QStyleOptionMenuItem::Scroller:
+ case QStyleOptionMenuItem::Separator:
+ return; // no separators or scrollers in S60 menus
+ case QStyleOptionMenuItem::SubMenu:
+ drawSubMenuIndicator = true;
+ break;
+ default:
+ break;
+ }
+ const bool enabled = optionMenuItem.state & State_Enabled;
+ const bool checkable = optionMenuItem.checkType != QStyleOptionMenuItem::NotCheckable;
+
+ uint text_flags = Qt::AlignLeading | Qt::TextShowMnemonic | Qt::TextDontClip
+ | Qt::TextSingleLine | Qt::AlignVCenter;
+ if (!styleHint(SH_UnderlineShortcut, menuItem, widget))
+ text_flags |= Qt::TextHideMnemonic;
+
+ QRect iconRect =
+ subElementRect(SE_ItemViewItemDecoration, &optionMenuItem, widget);
+ QRect textRect = subElementRect(SE_ItemViewItemText, &optionMenuItem, widget);
+
+ if ((option->state & State_Selected) && (option->state & State_Enabled))
+ QS60StylePrivate::drawSkinElement(QS60StylePrivate::SE_ListHighlight, painter, option->rect, flags);
+
+ //todo: move the vertical spacing stuff into subElementRect
+ const int vSpacing = QS60StylePrivate::pixelMetric(QStyle::PM_LayoutVerticalSpacing);
+ if (checkable){
+ QStyleOptionMenuItem optionCheckBox;
+ optionCheckBox.QStyleOption::operator=(*menuItem);
+ optionCheckBox.rect.setWidth(pixelMetric(PM_IndicatorWidth));
+ optionCheckBox.rect.setHeight(pixelMetric(PM_IndicatorHeight));
+ const int moveByX = optionCheckBox.rect.width()+vSpacing;
+ if (optionMenuItem.direction == Qt::LeftToRight) {
+ textRect.translate(moveByX,0);
+ iconRect.translate(moveByX, 0);
+ iconRect.setWidth(iconRect.width()+vSpacing);
+ textRect.setWidth(textRect.width()-moveByX-vSpacing);
+ } else {
+ textRect.setWidth(textRect.width()-moveByX);
+ iconRect.setWidth(iconRect.width()+vSpacing);
+ iconRect.translate(-optionCheckBox.rect.width()-vSpacing, 0);
+ optionCheckBox.rect.translate(textRect.width()+iconRect.width(),0);
+ }
+ drawPrimitive(PE_IndicatorMenuCheckMark, &optionCheckBox, painter, widget);
+ }
+ //draw icon and/or checkState
+ QPixmap pix = menuItem->icon.pixmap(pixelMetric(PM_SmallIconSize),
+ enabled ? QIcon::Normal : QIcon::Disabled);
+ const bool itemWithIcon = !pix.isNull();
+ if (itemWithIcon) {
+ drawItemPixmap(painter, iconRect, text_flags, pix);
+ if (optionMenuItem.direction == Qt::LeftToRight)
+ textRect.translate(vSpacing,0);
+ else
+ textRect.translate(-vSpacing,0);
+ textRect.setWidth(textRect.width()-vSpacing);
+ }
+
+ //draw indicators
+ if (drawSubMenuIndicator) {
+ QStyleOptionMenuItem arrowOptions;
+ arrowOptions.QStyleOption::operator=(*menuItem);
+ const int indicatorWidth = (pixelMetric(PM_ListViewIconSize, option, widget)>>1) +
+ pixelMetric(QStyle::PM_LayoutVerticalSpacing, option, widget);
+ if (optionMenuItem.direction == Qt::LeftToRight)
+ arrowOptions.rect.setLeft(textRect.right());
+ arrowOptions.rect.setWidth(indicatorWidth);
+ //by default sub menu indicator in S60 points to east,so here icon
+ // direction is set to north (and south when in RightToLeft)
+ const QS60StylePrivate::SkinElementFlag arrowDirection = (arrowOptions.direction == Qt::LeftToRight) ?
+ QS60StylePrivate::SF_PointNorth : QS60StylePrivate::SF_PointSouth;
+ QS60StylePrivate::drawSkinPart(QS60StyleEnums::SP_QgnIndiSubMenu, painter, arrowOptions.rect,
+ (flags | QS60StylePrivate::SF_ColorSkinned | arrowDirection));
+ }
+
+ //draw text
+ if (!enabled){
+ //In s60, if something becomes disabled, it is removed from menu, so no native look-alike available.
+ optionMenuItem.palette.setColor(QPalette::Disabled, QPalette::Text, QS60StylePrivate::lighterColor(
+ optionMenuItem.palette.color(QPalette::Disabled, QPalette::Text)));
+ painter->save();
+ painter->setOpacity(0.5);
+ }
+ QCommonStyle::drawItemText(painter, textRect, text_flags,
+ optionMenuItem.palette, enabled,
+ optionMenuItem.text, QPalette::Text);
+ if (!enabled)
+ painter->restore();
+ }
+ break;
+ case CE_MenuEmptyArea:
+ break;
+#endif //QT_NO_MENU
+
+#ifndef QT_NO_MENUBAR
+ case CE_MenuBarEmptyArea:
+ break;
+#endif //QT_NO_MENUBAR
+
+ case CE_HeaderSection:
+ if ( const QStyleOptionHeader *header = qstyleoption_cast<const QStyleOptionHeader *>(option)) {
+ painter->save();
+ QPen linePen = QPen(QS60StylePrivate::s60Color(QS60StyleEnums::CL_QsnLineColors, 1, header));
+ const int penWidth = (header->orientation == Qt::Horizontal) ?
+ linePen.width()+QS60StylePrivate::pixelMetric(PM_Custom_BoldLineWidth)
+ : linePen.width()+QS60StylePrivate::pixelMetric(PM_Custom_ThinLineWidth);
+ linePen.setWidth(penWidth);
+ painter->setPen(linePen);
+ if (header->orientation == Qt::Horizontal){
+ painter->drawLine(header->rect.bottomLeft(), header->rect.bottomRight());
+ } else {
+ if ( header->direction == Qt::LeftToRight ) {
+ painter->drawLine(header->rect.topRight(), header->rect.bottomRight());
+ } else {
+ painter->drawLine(header->rect.topLeft(), header->rect.bottomLeft());
+ }
+ }
+ painter->restore();
+ }
+ break;
+ case CE_HeaderEmptyArea: // no need to draw this
+ break;
+ case CE_Header:
+ if ( const QStyleOptionHeader *header = qstyleoption_cast<const QStyleOptionHeader *>(option)) {
+ drawControl(CE_HeaderSection, header, painter, widget);
+ QStyleOptionHeader subopt = *header;
+ subopt.rect = subElementRect(SE_HeaderLabel, header, widget);
+ if (subopt.rect.isValid())
+ drawControl(CE_HeaderLabel, &subopt, painter, widget);
+ if (header->sortIndicator != QStyleOptionHeader::None) {
+ subopt.rect = subElementRect(SE_HeaderArrow, option, widget);
+ drawPrimitive(PE_IndicatorHeaderArrow, &subopt, painter, widget);
+ }
+ }
+ break;
+#ifndef QT_NO_TOOLBAR
+ case CE_ToolBar:
+ if (const QStyleOptionToolBar *toolBar = qstyleoption_cast<const QStyleOptionToolBar *>(option)) {
+ const QToolBar *tbWidget = qobject_cast<const QToolBar *>(widget);
+
+ //toolbar within a toolbar, skip
+ if (!tbWidget || (widget && qobject_cast<QToolBar *>(widget->parentWidget())))
+ break;
+
+ // Normally in S60 5.0+ there is no background for toolbar, but in some cases with versatile QToolBar,
+ // it looks a bit strange. So, lets fillRect with Button.
+ if (!QS60StylePrivate::isToolBarBackground()) {
+ QList<QAction *> actions = tbWidget->actions();
+ bool justToolButtonsInToolBar = true;
+ for (int i = 0; i < actions.size(); ++i) {
+ QWidget *childWidget = tbWidget->widgetForAction(actions.at(i));
+ const QToolButton *button = qobject_cast<const QToolButton *>(childWidget);
+ if (!button){
+ justToolButtonsInToolBar = false;
+ }
+ }
+
+ // Draw frame background
+ // for vertical toolbars with text only and
+ // for toolbars with extension buttons and
+ // for toolbars with widgets in them.
+ if (!justToolButtonsInToolBar ||
+ (tbWidget &&
+ (tbWidget->orientation() == Qt::Vertical) &&
+ (tbWidget->toolButtonStyle() == Qt::ToolButtonTextOnly))) {
+ painter->save();
+ if (widget)
+ painter->setBrush(widget->palette().button());
+ painter->setOpacity(0.3);
+ painter->fillRect(toolBar->rect, painter->brush());
+ painter->restore();
+ }
+ } else {
+ QS60StylePrivate::drawSkinElement(QS60StylePrivate::SE_ToolBar, painter, toolBar->rect, flags);
+ }
+ }
+ break;
+#endif //QT_NO_TOOLBAR
+ case CE_ShapedFrame:
+ if (qobject_cast<const QTextEdit *>(widget)) {
+ QS60StylePrivate::drawSkinElement(QS60StylePrivate::SE_Editor, painter, option->rect, flags);
+ } else if (qobject_cast<const QTableView *>(widget)) {
+ QS60StylePrivate::drawSkinElement(QS60StylePrivate::SE_TableItem, painter, option->rect, flags);
+ } else if (const QHeaderView *header = qobject_cast<const QHeaderView *>(widget)) {
+ if (header->orientation() == Qt::Horizontal) {
+ QRect headerRect = option->rect;
+ const int frameWidth = QS60StylePrivate::pixelMetric(PM_DefaultFrameWidth);
+ headerRect.adjust(0,frameWidth,-2*frameWidth,0);
+ QS60StylePrivate::drawSkinElement(QS60StylePrivate::SE_TableHeaderItem, painter, headerRect, flags);
+ } else {
+ //todo: update to horizontal table graphic
+ QS60StylePrivate::drawSkinElement(QS60StylePrivate::SE_TableHeaderItem, painter, option->rect, flags | QS60StylePrivate::SF_PointWest);
+ }
+ } else if (qobject_cast<const QFrame *>(widget)) {
+ QCommonStyle::drawControl(element, option, painter, widget);
+ }
+ break;
+ case CE_MenuScroller:
+ break;
+ case CE_FocusFrame:
+ {
+ // The pen width should nearly fill the layoutspacings around the widget
+ const int penWidth =
+ qMin(pixelMetric(QS60Style::PM_LayoutVerticalSpacing), pixelMetric(QS60Style::PM_LayoutHorizontalSpacing))
+ - 2; // But keep 1 pixel distance to the focus widget and 1 pixel to the adjacent widgets
+
+#ifdef QT_KEYPAD_NAVIGATION
+ bool editFocus = false;
+ if (const QFocusFrame *focusFrame = qobject_cast<const QFocusFrame*>(widget)) {
+ if (focusFrame->widget() && focusFrame->widget()->hasEditFocus())
+ editFocus = true;
+ }
+ const qreal opacity = editFocus ? 0.65 : 0.45; // Trial and error factors. Feel free to improve.
+#else
+ const qreal opacity = 0.5;
+#endif
+ // Because of Qts coordinate system, we need to tweak the rect by .5 pixels, otherwise it gets blurred.
+ const qreal rectAdjustment = (penWidth % 2) ? -.5 : 0;
+
+ // Make sure that the pen stroke is inside the rect
+ const QRectF adjustedRect =
+ QRectF(option->rect).adjusted(
+ rectAdjustment + penWidth,
+ rectAdjustment + penWidth,
+ -rectAdjustment - penWidth,
+ -rectAdjustment - penWidth
+ );
+
+ const qreal roundRectRadius = penWidth * goldenRatio;
+
+ painter->save();
+ painter->setRenderHint(QPainter::Antialiasing);
+ painter->setOpacity(opacity);
+ painter->setPen(QPen(option->palette.color(QPalette::Highlight), penWidth));
+ painter->drawRoundedRect(adjustedRect, roundRectRadius, roundRectRadius);
+ painter->restore();
+ }
+ break;
+ default:
+ QCommonStyle::drawControl(element, option, painter, widget);
+ }
+}
+
+/*!
+ \reimp
+*/
+void QS60Style::drawPrimitive(PrimitiveElement element, const QStyleOption *option, QPainter *painter, const QWidget *widget) const
+{
+ const QS60StylePrivate::SkinElementFlags flags = (option->state & State_Enabled) ? QS60StylePrivate::SF_StateEnabled : QS60StylePrivate::SF_StateDisabled;
+ switch (element) {
+#ifndef QT_NO_LINEEDIT
+ case PE_PanelLineEdit:
+ if (const QStyleOptionFrame *lineEdit = qstyleoption_cast<const QStyleOptionFrame *>(option)) {
+#ifndef QT_NO_COMBOBOX
+ if (widget && qobject_cast<const QComboBox *>(widget->parentWidget()))
+ break;
+#endif
+ QS60StylePrivate::drawSkinElement(QS60StylePrivate::SE_FrameLineEdit,
+ painter, option->rect, flags);
+ }
+ break;
+#endif // QT_NO_LINEEDIT
+ case PE_IndicatorCheckBox:
+ {
+ const QRect indicatorRect = option->rect;
+ // Draw checkbox indicator as color skinned graphics.
+ const QS60StyleEnums::SkinParts skinPart = (option->state & QStyle::State_On) ?
+ QS60StyleEnums::SP_QgnIndiCheckboxOn : QS60StyleEnums::SP_QgnIndiCheckboxOff;
+ QS60StylePrivate::drawSkinPart(skinPart, painter, indicatorRect,
+ (flags | QS60StylePrivate::SF_ColorSkinned));
+ }
+ break;
+ case PE_IndicatorViewItemCheck:
+#ifndef QT_NO_ITEMVIEWS
+ if (const QListView *listItem = (qobject_cast<const QListView *>(widget))) {
+ if (const QStyleOptionViewItemV4 *vopt = qstyleoption_cast<const QStyleOptionViewItemV4 *>(option)) {
+ const bool checkBoxVisible = vopt->features & QStyleOptionViewItemV2::HasCheckIndicator;
+ const bool singleSelection = listItem->selectionMode() ==
+ QAbstractItemView::SingleSelection || listItem->selectionMode() == QAbstractItemView::NoSelection;
+ // draw either checkbox at the beginning
+ if (checkBoxVisible && singleSelection) {
+ drawPrimitive(PE_IndicatorCheckBox, option, painter, widget);
+ // ... or normal "tick" selection at the end.
+ } else if (option->state & QStyle::State_Selected) {
+ QRect tickRect = option->rect;
+ const int frameBorderWidth = QS60StylePrivate::pixelMetric(PM_Custom_FrameCornerWidth);
+ // adjust tickmark rect to exclude frame border
+ tickRect.adjust(0,-frameBorderWidth,0,-frameBorderWidth);
+ QS60StyleEnums::SkinParts skinPart = QS60StyleEnums::SP_QgnIndiMarkedAdd;
+ QS60StylePrivate::drawSkinPart(skinPart, painter, tickRect,
+ (flags | QS60StylePrivate::SF_ColorSkinned));
+ }
+ }
+ }
+#endif //QT_NO_ITEMVIEWS
+ break;
+ case PE_IndicatorRadioButton: {
+ QRect buttonRect = option->rect;
+ //there is empty (a. 33%) space in svg graphics for radiobutton
+ const qreal reduceWidth = (qreal)buttonRect.width()/3.0;
+ const qreal rectWidth = (qreal)option->rect.width() != 0 ? option->rect.width() : 1.0;
+ // Try to occupy the full area
+ const qreal scaler = 1 + (reduceWidth/rectWidth);
+ buttonRect.setWidth((int)((buttonRect.width()-reduceWidth) * scaler));
+ buttonRect.setHeight((int)(buttonRect.height() * scaler));
+ // move the rect up for half of the new height-gain
+ const int newY = (buttonRect.bottomRight().y() - option->rect.bottomRight().y()) >> 1 ;
+ buttonRect.adjust(0,-newY,0,-newY);
+
+ // Draw radiobutton indicator as color skinned graphics.
+ QS60StyleEnums::SkinParts skinPart = (option->state & QStyle::State_On) ?
+ QS60StyleEnums::SP_QgnIndiRadiobuttOn : QS60StyleEnums::SP_QgnIndiRadiobuttOff;
+ QS60StylePrivate::drawSkinPart(skinPart, painter, buttonRect,
+ (flags | QS60StylePrivate::SF_ColorSkinned));
+ }
+ break;
+ case PE_PanelButtonCommand:
+ case PE_PanelButtonTool:
+ case PE_PanelButtonBevel:
+ case PE_FrameButtonBevel: {
+ const bool isPressed = option->state & QStyle::State_Sunken;
+ const QS60StylePrivate::SkinElements skinElement =
+ isPressed ? QS60StylePrivate::SE_ButtonPressed : QS60StylePrivate::SE_ButtonNormal;
+ QS60StylePrivate::drawSkinElement(skinElement, painter, option->rect, flags);
+ }
+ break;
+#ifndef QT_NO_TOOLBUTTON
+ case PE_IndicatorArrowDown:
+ case PE_IndicatorArrowLeft:
+ case PE_IndicatorArrowRight:
+ case PE_IndicatorArrowUp: {
+ QS60StyleEnums::SkinParts skinPart;
+ if (element==PE_IndicatorArrowDown)
+ skinPart = QS60StyleEnums::SP_QgnGrafScrollArrowDown;
+ else if (element==PE_IndicatorArrowLeft)
+ skinPart = QS60StyleEnums::SP_QgnGrafScrollArrowLeft;
+ else if (element==PE_IndicatorArrowRight)
+ skinPart = QS60StyleEnums::SP_QgnGrafScrollArrowRight;
+ else if (element==PE_IndicatorArrowUp)
+ skinPart = QS60StyleEnums::SP_QgnGrafScrollArrowUp;
+
+ QS60StylePrivate::drawSkinPart(skinPart, painter, option->rect, flags);
+ }
+ break;
+#endif //QT_NO_TOOLBUTTON
+#ifndef QT_NO_SPINBOX
+ case PE_IndicatorSpinDown:
+ case PE_IndicatorSpinUp:
+ if (const QStyleOptionSpinBox *spinBox = qstyleoption_cast<const QStyleOptionSpinBox *>(option)) {
+ QStyleOptionSpinBox optionSpinBox = *spinBox;
+ const QS60StyleEnums::SkinParts part = (element == PE_IndicatorSpinUp) ?
+ QS60StyleEnums::SP_QgnGrafScrollArrowUp :
+ QS60StyleEnums::SP_QgnGrafScrollArrowDown;
+ const int adjustment = qMin(optionSpinBox.rect.width(), optionSpinBox.rect.height())/6;
+ optionSpinBox.rect.translate(0, (element == PE_IndicatorSpinDown) ? adjustment : -adjustment );
+ QS60StylePrivate::drawSkinPart(part, painter, optionSpinBox.rect,flags);
+ }
+#ifndef QT_NO_COMBOBOX
+ else if (const QStyleOptionFrame *cmb = qstyleoption_cast<const QStyleOptionFrame *>(option)) {
+ // We want to draw down arrow here for comboboxes as well.
+ const QS60StyleEnums::SkinParts part = QS60StyleEnums::SP_QgnGrafScrollArrowDown;
+ QStyleOptionFrame comboBox = *cmb;
+ const int adjustment = qMin(comboBox.rect.width(), comboBox.rect.height())/6;
+ comboBox.rect.translate(0, (element == PE_IndicatorSpinDown) ? adjustment : -adjustment );
+ QS60StylePrivate::drawSkinPart(part, painter, comboBox.rect,flags);
+ }
+#endif //QT_NO_COMBOBOX
+ break;
+ case PE_IndicatorSpinMinus:
+ case PE_IndicatorSpinPlus:
+ if (const QStyleOptionSpinBox *spinBox = qstyleoption_cast<const QStyleOptionSpinBox *>(option)) {
+ QStyleOptionSpinBox optionSpinBox = *spinBox;
+ QCommonStyle::drawPrimitive(element, &optionSpinBox, painter, widget);
+ }
+#ifndef QT_NO_COMBOBOX
+ else if (const QStyleOptionFrame *cmb = qstyleoption_cast<const QStyleOptionFrame *>(option)) {
+ // We want to draw down arrow here for comboboxes as well.
+ QStyleOptionFrame comboBox = *cmb;
+ const int frameWidth = QS60StylePrivate::pixelMetric(PM_DefaultFrameWidth);
+ comboBox.rect.adjust(0,frameWidth,0,-frameWidth);
+ QCommonStyle::drawPrimitive(element, &comboBox, painter, widget);
+ }
+#endif //QT_NO_COMBOBOX
+ break;
+#endif //QT_NO_SPINBOX
+ case PE_Widget:
+ if (QS60StylePrivate::drawsOwnThemeBackground(widget)
+#ifndef QT_NO_COMBOBOX
+ || qobject_cast<const QComboBoxListView *>(widget)
+#endif //QT_NO_COMBOBOX
+#ifndef QT_NO_MENU
+ || qobject_cast<const QMenu *> (widget)
+#endif //QT_NO_MENU
+ ) {
+ QS60StylePrivate::SkinElements skinElement = QS60StylePrivate::SE_OptionsMenu;
+ QS60StylePrivate::drawSkinElement(skinElement, painter, option->rect, flags);
+ }
+ break;
+ case PE_FrameWindow:
+ case PE_FrameTabWidget:
+ if (const QStyleOptionTabWidgetFrame *tabFrame = qstyleoption_cast<const QStyleOptionTabWidgetFrame *>(option)) {
+ QStyleOptionTabWidgetFrame optionTabFrame = *tabFrame;
+ QS60StylePrivate::drawSkinElement(QS60StylePrivate::SE_PanelBackground, painter, optionTabFrame.rect, flags);
+ }
+ break;
+ case PE_IndicatorHeaderArrow:
+ if (const QStyleOptionHeader *header = qstyleoption_cast<const QStyleOptionHeader *>(option)) {
+ if (header->sortIndicator & QStyleOptionHeader::SortUp)
+ drawPrimitive(PE_IndicatorArrowUp, header, painter, widget);
+ else if (header->sortIndicator & QStyleOptionHeader::SortDown)
+ drawPrimitive(PE_IndicatorArrowDown, header, painter, widget);
+ } // QStyleOptionHeader::None is not drawn => not needed
+ break;
+#ifndef QT_NO_GROUPBOX
+ case PE_FrameGroupBox:
+ if (const QStyleOptionFrameV2 *frame = qstyleoption_cast<const QStyleOptionFrameV2 *>(option))
+ QS60StylePrivate::drawSkinElement(QS60StylePrivate::SE_SettingsList, painter, frame->rect, flags);
+ break;
+#endif //QT_NO_GROUPBOX
+
+ // Qt3 primitives are not supported
+ case PE_Q3CheckListController:
+ case PE_Q3CheckListExclusiveIndicator:
+ case PE_Q3CheckListIndicator:
+ case PE_Q3DockWindowSeparator:
+ case PE_Q3Separator:
+ Q_ASSERT(false);
+ break;
+ case PE_Frame:
+ break;
+#ifndef QT_NO_ITEMVIEWS
+ case PE_PanelItemViewItem:
+ case PE_PanelItemViewRow: // ### Qt 5: remove
+ break;
+#endif //QT_NO_ITEMVIEWS
+
+ case PE_IndicatorMenuCheckMark:
+ if (const QStyleOptionMenuItem *checkBox = qstyleoption_cast<const QStyleOptionMenuItem *>(option)){
+ QStyleOptionMenuItem optionCheckBox = *checkBox;
+ if (optionCheckBox.checked)
+ optionCheckBox.state = (optionCheckBox.state | State_On);
+ drawPrimitive(PE_IndicatorCheckBox, &optionCheckBox, painter, widget);
+ }
+ break;
+#ifndef QT_NO_TOOLBAR
+ case PE_IndicatorToolBarHandle:
+ // no toolbar handles in S60/AVKON UI
+ case PE_IndicatorToolBarSeparator:
+ // no separators in S60/AVKON UI
+ break;
+#endif //QT_NO_TOOLBAR
+
+ case PE_PanelMenuBar:
+ case PE_FrameMenu:
+ break; //disable frame in menu
+
+ case PE_IndicatorBranch:
+#if defined(Q_WS_S60)
+ // 3.1 AVKON UI does not have tree view component, use common style for drawing there
+ if (QSysInfo::s60Version() == QSysInfo::SV_S60_3_1) {
+#else
+ if (true) {
+#endif
+ QCommonStyle::drawPrimitive(element, option, painter, widget);
+ } else {
+ const bool rightLine = option->state & State_Item;
+ const bool downLine = option->state & State_Sibling;
+ const bool upLine = option->state & (State_Open | State_Children | State_Item | State_Sibling);
+
+ QS60StyleEnums::SkinParts skinPart;
+ bool drawSkinPart = false;
+ if (rightLine && downLine && upLine) {
+ skinPart = QS60StyleEnums::SP_QgnIndiHlLineBranch;
+ drawSkinPart = true;
+ } else if (rightLine && upLine) {
+ skinPart = QS60StyleEnums::SP_QgnIndiHlLineEnd;
+ drawSkinPart = true;
+ } else if (upLine && downLine) {
+ skinPart = QS60StyleEnums::SP_QgnIndiHlLineStraight;
+ drawSkinPart = true;
+ }
+
+ if ( drawSkinPart )
+ QS60StylePrivate::drawSkinPart(skinPart, painter, option->rect, flags);
+
+ if (option->state & State_Children) {
+ QS60StyleEnums::SkinParts skinPart =
+ (option->state & State_Open) ? QS60StyleEnums::SP_QgnIndiHlColSuper : QS60StyleEnums::SP_QgnIndiHlExpSuper;
+ int minDimension = qMin(option->rect.width(), option->rect.height());
+ const int resizeValue = minDimension >> 1;
+ minDimension += resizeValue; // Adjust the icon bigger because of empty space in svg icon.
+ QRect iconRect(option->rect.topLeft(), QSize(minDimension, minDimension));
+ int verticalMagic(0);
+ // magic values for positioning svg icon.
+ if (option->rect.width() <= option->rect.height())
+ verticalMagic = 3;
+ iconRect.translate(3, verticalMagic - resizeValue);
+ QS60StylePrivate::drawSkinPart(skinPart, painter, iconRect, flags);
+ }
+ }
+ break;
+
+ // todo: items are below with #ifdefs "just in case". in final version, remove all non-required cases
+ case PE_FrameLineEdit:
+ case PE_IndicatorButtonDropDown:
+ case PE_IndicatorDockWidgetResizeHandle:
+ case PE_PanelTipLabel:
+ case PE_PanelScrollAreaCorner:
+
+#ifndef QT_NO_TABBAR
+ case PE_IndicatorTabTear: // No tab tear in S60
+#endif // QT_NO_TABBAR
+ case PE_FrameDefaultButton:
+#ifndef QT_NO_DOCKWIDGET
+ case PE_FrameDockWidget:
+#endif //QT_NO_DOCKWIDGET
+#ifndef QT_NO_PROGRESSBAR
+ case PE_IndicatorProgressChunk:
+#endif //QT_NO_PROGRESSBAR
+#ifndef QT_NO_TOOLBAR
+ case PE_PanelToolBar:
+#endif //QT_NO_TOOLBAR
+#ifndef QT_NO_COLUMNVIEW
+ case PE_IndicatorColumnViewArrow:
+ case PE_IndicatorItemViewItemDrop:
+#endif //QT_NO_COLUMNVIEW
+ case PE_FrameTabBarBase: // since tabs are in S60 always in navipane, let's use common style for tab base in Qt.
+ default:
+ QCommonStyle::drawPrimitive(element, option, painter, widget);
+ }
+}
+
+/*! \reimp */
+int QS60Style::pixelMetric(PixelMetric metric, const QStyleOption *option, const QWidget *widget) const
+{
+ int metricValue = QS60StylePrivate::pixelMetric(metric);
+ if (metricValue == KNotFound)
+ metricValue = QCommonStyle::pixelMetric(metric, option, widget);
+
+ if (metric == PM_SubMenuOverlap && widget){
+ const QMenu *menu = qobject_cast<const QMenu *>(widget);
+ if (menu && menu->activeAction() && menu->activeAction()->menu()) {
+ const int menuWidth = menu->activeAction()->menu()->sizeHint().width();
+ metricValue = -menuWidth;
+ }
+ }
+ return metricValue;
+}
+
+/*! \reimp */
+QSize QS60Style::sizeFromContents(ContentsType ct, const QStyleOption *opt,
+ const QSize &csz, const QWidget *widget) const
+{
+ QSize sz(csz);
+ switch (ct) {
+ case CT_PushButton:
+ sz = QCommonStyle::sizeFromContents( ct, opt, csz, widget);
+ if (const QAbstractButton *buttonWidget = (qobject_cast<const QAbstractButton *>(widget)))
+ if (buttonWidget->isCheckable())
+ sz += QSize(pixelMetric(PM_IndicatorWidth) + pixelMetric(PM_CheckBoxLabelSpacing), 0);
+ break;
+ case CT_LineEdit:
+ if (const QStyleOptionFrame *f = qstyleoption_cast<const QStyleOptionFrame *>(opt))
+ sz += QSize(2*f->lineWidth, 4*f->lineWidth);
+ break;
+ default:
+ sz = QCommonStyle::sizeFromContents( ct, opt, csz, widget);
+ break;
+ }
+ return sz;
+}
+
+/*! \reimp */
+int QS60Style::styleHint(StyleHint sh, const QStyleOption *opt, const QWidget *widget,
+ QStyleHintReturn *hret) const
+{
+ int retValue = -1;
+ switch (sh) {
+ case SH_Table_GridLineColor:
+ retValue = QS60StylePrivate::s60Color(QS60StyleEnums::CL_QsnLineColors,2,0).rgb();
+ break;
+ case SH_GroupBox_TextLabelColor:
+ retValue = QS60StylePrivate::s60Color(QS60StyleEnums::CL_QsnTextColors,6,0).rgb();
+ break;
+ case SH_ScrollBar_ScrollWhenPointerLeavesControl:
+ retValue = true;
+ break;
+ case SH_Slider_SnapToValue:
+ retValue = true;
+ break;
+ case SH_Slider_StopMouseOverSlider:
+ retValue = true;
+ break;
+ case SH_LineEdit_PasswordCharacter:
+ retValue = '*';
+ break;
+ case SH_ComboBox_PopupFrameStyle:
+ retValue = QFrame::NoFrame | QFrame::Plain;
+ break;
+ case SH_Dial_BackgroundRole:
+ retValue = QPalette::Base;
+ break;
+ case SH_ItemView_ActivateItemOnSingleClick:
+ retValue = true;
+ break;
+ case SH_ProgressDialog_TextLabelAlignment:
+ retValue = (QApplication::layoutDirection() == Qt::LeftToRight) ?
+ Qt::AlignLeft :
+ Qt::AlignRight;
+ break;
+ case SH_Menu_SubMenuPopupDelay:
+ retValue = 300;
+ break;
+ case SH_Menu_Scrollable:
+ retValue = true;
+ break;
+ case SH_Menu_SelectionWrap:
+ retValue = true;
+ break;
+ case SH_ItemView_ShowDecorationSelected:
+ retValue = true;
+ break;
+ case SH_ToolBar_Movable:
+ retValue = false;
+ break;
+ case SH_BlinkCursorWhenTextSelected:
+ retValue = true;
+ break;
+ case SH_UnderlineShortcut:
+ retValue = 0;
+ break;
+ case SH_RequestSoftwareInputPanel:
+ retValue = RSIP_OnMouseClickAndAlreadyFocused;
+ break;
+ default:
+ break;
+ }
+ if (retValue == -1)
+ retValue = QCommonStyle::styleHint(sh, opt, widget, hret);
+ return retValue;
+}
+
+/*! \reimp */
+QRect QS60Style::subControlRect(ComplexControl control, const QStyleOptionComplex *option, SubControl scontrol, const QWidget *widget) const
+{
+ QRect ret;
+ switch (control) {
+#ifndef QT_NO_SCROLLBAR
+ // This implementation of subControlRect(CC_ScrollBar..) basically just removes the SC_ScrollBarSubLine and SC_ScrollBarAddLine
+ case CC_ScrollBar:
+ if (const QStyleOptionSlider *scrollbarOption = qstyleoption_cast<const QStyleOptionSlider *>(option)) {
+ const QRect scrollBarRect = scrollbarOption->rect;
+ const bool isHorizontal = scrollbarOption->orientation == Qt::Horizontal;
+ const int maxlen = isHorizontal ? scrollBarRect.width() : scrollBarRect.height();
+ int sliderlen;
+
+ // calculate slider length
+ if (scrollbarOption->maximum != scrollbarOption->minimum) {
+ const uint range = scrollbarOption->maximum - scrollbarOption->minimum;
+ sliderlen = (qint64(scrollbarOption->pageStep) * maxlen) / (range + scrollbarOption->pageStep);
+
+ const int slidermin = pixelMetric(PM_ScrollBarSliderMin, scrollbarOption, widget);
+ if (sliderlen < slidermin || range > (INT_MAX>>1))
+ sliderlen = slidermin;
+ if (sliderlen > maxlen)
+ sliderlen = maxlen;
+ } else {
+ sliderlen = maxlen;
+ }
+
+ const int sliderstart = sliderPositionFromValue(scrollbarOption->minimum,
+ scrollbarOption->maximum,
+ scrollbarOption->sliderPosition,
+ maxlen - sliderlen,
+ scrollbarOption->upsideDown);
+
+ switch (scontrol) {
+ case SC_ScrollBarSubPage: // between top/left button and slider
+ if (isHorizontal)
+ ret.setRect(0, 0, sliderstart, scrollBarRect.height());
+ else
+ ret.setRect(0, 0, scrollBarRect.width(), sliderstart);
+ break;
+ case SC_ScrollBarAddPage: { // between bottom/right button and slider
+ const int addPageLength = sliderstart + sliderlen;
+ if (isHorizontal)
+ ret = scrollBarRect.adjusted(addPageLength, 0, 0, 0);
+ else
+ ret = scrollBarRect.adjusted(0, addPageLength, 0, 0);
+ }
+ break;
+ case SC_ScrollBarGroove:
+ ret = scrollBarRect;
+ break;
+ case SC_ScrollBarSlider:
+ if (scrollbarOption->orientation == Qt::Horizontal)
+ ret.setRect(sliderstart, 0, sliderlen, scrollBarRect.height());
+ else
+ ret.setRect(0, sliderstart, scrollBarRect.width(), sliderlen);
+ break;
+ case SC_ScrollBarSubLine: // top/left button
+ case SC_ScrollBarAddLine: // bottom/right button
+ default:
+ break;
+ }
+ ret = visualRect(scrollbarOption->direction, scrollBarRect, ret);
+ }
+ break;
+#endif // QT_NO_SCROLLBAR
+ case CC_SpinBox:
+ if (const QStyleOptionSpinBox *spinbox = qstyleoption_cast<const QStyleOptionSpinBox *>(option)) {
+ const int frameThickness = spinbox->frame ? pixelMetric(PM_SpinBoxFrameWidth, spinbox, widget) : 0;
+ const int buttonMargin = spinbox->frame ? 2 : 0;
+ const int buttonWidth = QS60StylePrivate::pixelMetric(QStyle::PM_ButtonIconSize) + 2*buttonMargin;
+ QSize buttonSize;
+ buttonSize.setHeight(qMax(8, spinbox->rect.height() - frameThickness));
+ buttonSize.setWidth(buttonWidth);
+ buttonSize = buttonSize.expandedTo(QApplication::globalStrut());
+
+ const int y = frameThickness + spinbox->rect.y();
+ const int x = spinbox->rect.x() + spinbox->rect.width() - frameThickness - 2*buttonSize.width();
+
+ switch (scontrol) {
+ case SC_SpinBoxUp:
+ if (spinbox->buttonSymbols == QAbstractSpinBox::NoButtons)
+ return QRect();
+ ret = QRect(x, y, buttonWidth, buttonSize.height());
+ break;
+ case SC_SpinBoxDown:
+ if (spinbox->buttonSymbols == QAbstractSpinBox::NoButtons)
+ return QRect();
+ ret = QRect(x+buttonSize.width(), y, buttonWidth, buttonSize.height());
+ break;
+ case SC_SpinBoxEditField:
+ if (spinbox->buttonSymbols == QAbstractSpinBox::NoButtons)
+ ret = QRect(
+ frameThickness,
+ frameThickness,
+ spinbox->rect.width() - 2*frameThickness,
+ spinbox->rect.height() - 2*frameThickness);
+ else
+ ret = QRect(
+ frameThickness,
+ frameThickness,
+ x - frameThickness,
+ spinbox->rect.height() - 2*frameThickness);
+ break;
+ case SC_SpinBoxFrame:
+ ret = spinbox->rect;
+ break;
+ default:
+ break;
+ }
+ ret = visualRect(spinbox->direction, spinbox->rect, ret);
+ }
+ break;
+ case CC_ComboBox:
+ if (const QStyleOptionComboBox *cmb = qstyleoption_cast<const QStyleOptionComboBox *>(option)) {
+ ret = cmb->rect;
+ const int width = cmb->rect.width();
+ const int height = cmb->rect.height();
+ const int buttonMargin = cmb->frame ? 2 : 0;
+ // lets use spinbox frame here as well, as no combobox specific value available.
+ const int frameThickness = cmb->frame ? pixelMetric(PM_SpinBoxFrameWidth, cmb, widget) : 0;
+ const int buttonWidth = QS60StylePrivate::pixelMetric(QStyle::PM_ButtonIconSize);
+ const int xposMod = (cmb->rect.x()) + width - buttonMargin - buttonWidth;
+ const int ypos = cmb->rect.y();
+
+ QSize buttonSize;
+ buttonSize.setHeight(qMax(8, (cmb->rect.height()>>1) - frameThickness)); //minimum of 8 pixels
+ buttonSize.setWidth(buttonWidth+2*buttonMargin);
+ buttonSize = buttonSize.expandedTo(QApplication::globalStrut());
+ switch (scontrol) {
+ case SC_ComboBoxArrow:
+ ret.setRect(xposMod, ypos + buttonMargin, buttonWidth, height - 2*buttonMargin);
+ break;
+ case SC_ComboBoxEditField: {
+ const int withFrameX = cmb->rect.x() + cmb->rect.width() - frameThickness - buttonSize.width();
+ ret = QRect(
+ frameThickness,
+ frameThickness,
+ withFrameX - frameThickness,
+ cmb->rect.height() - 2*frameThickness);
+ }
+ break;
+ default:
+ break;
+ }
+ }
+ break;
+ case CC_GroupBox:
+ if (const QStyleOptionGroupBox *groupBox = qstyleoption_cast<const QStyleOptionGroupBox *>(option)) {
+ ret = QCommonStyle::subControlRect(control, option, scontrol, widget);
+ switch (scontrol) {
+ case SC_GroupBoxCheckBox: //fallthrough
+ case SC_GroupBoxLabel: {
+ //slightly indent text and boxes, so that dialog border does not mess with them.
+ const int horizontalSpacing =
+ QS60StylePrivate::pixelMetric(QStyle::PM_LayoutHorizontalSpacing);
+ ret.adjust(2,horizontalSpacing-3,0,0);
+ }
+ break;
+ case SC_GroupBoxFrame: {
+ const QRect textBox = subControlRect(control, option, SC_GroupBoxLabel, widget);
+ const int tbHeight = textBox.height();
+ ret.translate(0, -ret.y());
+ // include title to within the groupBox frame
+ ret.setHeight(ret.height()+tbHeight);
+ if (widget && ret.bottom() > widget->rect().bottom())
+ ret.setBottom(widget->rect().bottom());
+ }
+ break;
+ default:
+ break;
+ }
+ }
+ break;
+ default:
+ ret = QCommonStyle::subControlRect(control, option, scontrol, widget);
+ }
+ return ret;
+}
+
+/*!
+ \reimp
+*/
+QRect QS60Style::subElementRect(SubElement element, const QStyleOption *opt, const QWidget *widget) const
+{
+ QRect ret;
+ switch (element) {
+ case SE_LineEditContents: {
+ // in S60 the input text box doesn't start from line Edit's TL, but
+ // a bit indented.
+ QRect lineEditRect = opt->rect;
+ const int adjustment = opt->rect.height()>>2;
+ lineEditRect.adjust(adjustment,0,0,0);
+ ret = lineEditRect;
+ }
+ break;
+ case SE_TabBarTearIndicator:
+ ret = QRect(0,0,0,0);
+ break;
+ case SE_TabWidgetTabBar:
+ if (const QStyleOptionTabWidgetFrame *optionTab = qstyleoption_cast<const QStyleOptionTabWidgetFrame *>(opt)) {
+ ret = QCommonStyle::subElementRect(element, opt, widget);
+
+ if (const QStyleOptionTabWidgetFrame *twf = qstyleoption_cast<const QStyleOptionTabWidgetFrame *>(opt)) {
+ const int tabOverlapNoBorder =
+ QS60StylePrivate::pixelMetric(QStyle::PM_TabBarTabOverlap);
+ const int tabOverlap =
+ tabOverlapNoBorder-QS60StylePrivate::pixelMetric(QStyle::PM_DefaultFrameWidth);
+ const QTabWidget *tab = qobject_cast<const QTabWidget *>(widget);
+ int gain = (tab) ? tabOverlap * tab->count() : 0;
+ switch (twf->shape) {
+ case QTabBar::RoundedNorth:
+ case QTabBar::TriangularNorth:
+ case QTabBar::RoundedSouth:
+ case QTabBar::TriangularSouth: {
+ if (widget) {
+ // make sure that gain does not set the rect outside of widget boundaries
+ if (twf->direction == Qt::RightToLeft) {
+ if ((ret.left() - gain) < widget->rect().left())
+ gain = widget->rect().left()-ret.left();
+ ret.adjust(-gain,0,0,0);
+ } else {
+ if ((ret.right() + gain) > widget->rect().right())
+ gain = widget->rect().right()-ret.right();
+ ret.adjust(0,0,gain,0);
+ }
+ }
+ break;
+ }
+ default: {
+ if (widget) {
+ if ((ret.bottom() + gain) > widget->rect().bottom())
+ gain = widget->rect().bottom()-ret.bottom();
+ ret.adjust(0,0,0,gain);
+ }
+ break;
+ }
+ }
+ }
+ }
+ break;
+ case SE_ItemViewItemText:
+ case SE_ItemViewItemDecoration:
+ if (const QStyleOptionViewItemV4 *vopt = qstyleoption_cast<const QStyleOptionViewItemV4 *>(opt)) {
+ const QListWidget *listItem = qobject_cast<const QListWidget *>(widget);
+ const bool multiSelection = !listItem ? false :
+ listItem->selectionMode() == QAbstractItemView::MultiSelection ||
+ listItem->selectionMode() == QAbstractItemView::ExtendedSelection ||
+ listItem->selectionMode() == QAbstractItemView::ContiguousSelection;
+ ret = QCommonStyle::subElementRect(element, opt, widget);
+ // If both multiselect & check-state, then remove checkbox and move
+ // text and decoration towards the beginning
+ if (listItem &&
+ multiSelection &&
+ (vopt->features & QStyleOptionViewItemV2::HasCheckIndicator)) {
+ const int verticalSpacing =
+ QS60StylePrivate::pixelMetric(QStyle::PM_LayoutVerticalSpacing);
+ //const int horizontalSpacing = QS60StylePrivate::pixelMetric(QStyle::PM_LayoutHorizontalSpacing);
+ const int checkBoxRectWidth = subElementRect(SE_ItemViewItemCheckIndicator, opt, widget).width();
+ ret.adjust(-checkBoxRectWidth-verticalSpacing,0,-checkBoxRectWidth-verticalSpacing,0);
+ }
+ } else if (const QStyleOptionMenuItem *menuItem = qstyleoption_cast<const QStyleOptionMenuItem *>(opt)) {
+ const bool checkable = menuItem->checkType != QStyleOptionMenuItem::NotCheckable;
+ const int indicatorWidth = checkable ?
+ pixelMetric(PM_ListViewIconSize, opt, widget) :
+ pixelMetric(PM_SmallIconSize, opt, widget);
+ ret = menuItem->rect;
+
+ if (element == SE_ItemViewItemDecoration) {
+ if (menuItem->direction == Qt::RightToLeft)
+ ret.translate(ret.width()-indicatorWidth, 0);
+ ret.setWidth(indicatorWidth);
+ } else {
+ ret = menuItem->rect;
+ if (!menuItem->icon.isNull())
+ if (menuItem->direction == Qt::LeftToRight)
+ ret.adjust(indicatorWidth, 0, 0, 0);
+ else
+ ret.adjust(0, 0, -indicatorWidth, 0);
+
+ // Make room for submenu indicator
+ if (menuItem->menuItemType == QStyleOptionMenuItem::SubMenu){
+ // submenu indicator is very small, so lets halve the rect
+ if (menuItem->direction == Qt::LeftToRight)
+ ret.adjust(0,0,-(indicatorWidth >> 1),0);
+ else
+ ret.adjust((indicatorWidth >> 1),0,0,0);
+ }
+ }
+ }
+ break;
+ case SE_ItemViewItemCheckIndicator:
+ if (const QStyleOptionViewItemV4 *vopt = qstyleoption_cast<const QStyleOptionViewItemV4 *>(opt)) {
+ const QListWidget *listItem = qobject_cast<const QListWidget *>(widget);
+
+ const bool singleSelection = listItem &&
+ (listItem->selectionMode() == QAbstractItemView::SingleSelection ||
+ listItem->selectionMode() == QAbstractItemView::NoSelection);
+ const bool checkBoxOnly = (vopt->features & QStyleOptionViewItemV2::HasCheckIndicator) &&
+ listItem &&
+ singleSelection;
+
+ // Selection check mark rect.
+ const int indicatorWidth = QS60StylePrivate::pixelMetric(QStyle::PM_IndicatorWidth);
+ const int indicatorHeight = QS60StylePrivate::pixelMetric(QStyle::PM_IndicatorHeight);
+ const int spacing = QS60StylePrivate::pixelMetric(QStyle::PM_CheckBoxLabelSpacing);
+
+ const int itemHeight = opt->rect.height();
+ int heightOffset = 0;
+ if (indicatorHeight < itemHeight)
+ heightOffset = ((itemHeight - indicatorHeight)>>1);
+ if (checkBoxOnly) {
+ // Move rect and make it slightly smaller, so that
+ // a) highlight border does not cross the rect
+ // b) in s60 list checkbox is smaller than normal checkbox
+ //todo; magic three
+ ret.setRect(opt->rect.left()+3, opt->rect.top() + heightOffset,
+ indicatorWidth-3, indicatorHeight-3);
+ } else {
+ ret.setRect(opt->rect.right() - indicatorWidth - spacing, opt->rect.top() + heightOffset,
+ indicatorWidth, indicatorHeight);
+ }
+ } else {
+ ret = QCommonStyle::subElementRect(element, opt, widget);
+ }
+ break;
+ case SE_HeaderLabel:
+ ret = QCommonStyle::subElementRect(element, opt, widget);
+ if (qstyleoption_cast<const QStyleOptionHeader *>(opt)) {
+ // Subtract area needed for line
+ if (opt->state & State_Horizontal)
+ ret.setHeight(ret.height() - QS60StylePrivate::pixelMetric(PM_Custom_BoldLineWidth));
+ else
+ ret.setWidth(ret.width() - QS60StylePrivate::pixelMetric(PM_Custom_ThinLineWidth));
+ }
+ ret = visualRect(opt->direction, opt->rect, ret);
+ break;
+ default:
+ ret = QCommonStyle::subElementRect(element, opt, widget);
+ }
+ return ret;
+}
+
+/*!
+ \reimp
+ */
+void QS60Style::polish(QWidget *widget)
+{
+ Q_D(const QS60Style);
+ QCommonStyle::polish(widget);
+
+ if (!widget)
+ return;
+
+ if (false
+#ifndef QT_NO_SCROLLBAR
+ || qobject_cast<QScrollBar *>(widget)
+#endif
+ ) {
+ widget->setAttribute(Qt::WA_OpaquePaintEvent, false);
+ }
+
+ if (QS60StylePrivate::drawsOwnThemeBackground(widget)) {
+ widget->setAttribute(Qt::WA_StyledBackground);
+ } else if (false
+#ifndef QT_NO_MENU
+ || qobject_cast<const QMenu *> (widget)
+#endif // QT_NO_MENU
+ ) {
+ widget->setAttribute(Qt::WA_StyledBackground);
+ } else if (false
+#ifndef QT_NO_COMBOBOX
+ || qobject_cast<const QComboBoxListView *>(widget)
+#endif //QT_NO_COMBOBOX
+ ) {
+ widget->setAttribute(Qt::WA_StyledBackground);
+ }
+ d->setThemePalette(widget);
+ d->setFont(widget);
+}
+
+/*!
+ \reimp
+ */
+void QS60Style::unpolish(QWidget *widget)
+{
+ if (false
+ #ifndef QT_NO_SCROLLBAR
+ || qobject_cast<QScrollBar *>(widget)
+ #endif
+ )
+ widget->setAttribute(Qt::WA_OpaquePaintEvent);
+
+ if (QS60StylePrivate::drawsOwnThemeBackground(widget)) {
+ widget->setAttribute(Qt::WA_StyledBackground, false);
+ } else if (false
+#ifndef QT_NO_MENU
+ || qobject_cast<const QMenu *> (widget)
+#endif // QT_NO_MENU
+ ) {
+ widget->setAttribute(Qt::WA_StyledBackground, false);
+ } else if (false
+#ifndef QT_NO_COMBOBOX
+ || qobject_cast<const QComboBoxListView *>(widget)
+#endif //QT_NO_COMBOBOX
+ ) {
+ widget->setAttribute(Qt::WA_StyledBackground, false);
+ }
+
+ if (widget)
+ widget->setPalette(QPalette());
+
+ QCommonStyle::unpolish(widget);
+}
+
+/*!
+ \reimp
+ */
+void QS60Style::polish(QApplication *application)
+{
+ Q_D(QS60Style);
+ d->m_originalPalette = application->palette();
+ d->setThemePalette(application);
+}
+
+/*!
+ \reimp
+ */
+void QS60Style::unpolish(QApplication *application)
+{
+ Q_UNUSED(application)
+ Q_D(QS60Style);
+ const QPalette newPalette = QApplication::style()->standardPalette();
+ QApplication::setPalette(newPalette);
+ QApplicationPrivate::setSystemPalette(d->m_originalPalette);
+}
+
+/*!
+ Sets the style property \a name to the \a value.
+ */
+void QS60Style::setStyleProperty(const char *name, const QVariant &value)
+{
+ Q_D(QS60Style);
+ d->setStyleProperty_specific(name, value);
+}
+
+/*!
+ Returns the value of style property \a name.
+ */
+QVariant QS60Style::styleProperty(const char *name) const
+{
+ Q_D(const QS60Style);
+ return d->styleProperty_specific(name);
+}
+
+/*!
+ \reimp
+ */
+bool QS60Style::event(QEvent *e)
+{
+#ifdef QT_KEYPAD_NAVIGATION
+ if (QS60StylePrivate::isTouchSupported())
+ return false;
+ Q_D(QS60Style);
+ switch (e->type()) {
+ case QEvent::FocusIn:
+ if (QWidget *focusWidget = QApplication::focusWidget()) {
+ if (!d->m_focusFrame)
+ d->m_focusFrame = new QFocusFrame(focusWidget);
+ d->m_focusFrame->setWidget(focusWidget);
+ } else if (d->m_focusFrame) {
+ d->m_focusFrame->setWidget(0);
+ }
+ break;
+ case QEvent::FocusOut:
+ if (d->m_focusFrame)
+ d->m_focusFrame->setWidget(0);
+ break;
+ case QEvent::EnterEditFocus:
+ case QEvent::LeaveEditFocus:
+ if (d->m_focusFrame)
+ d->m_focusFrame->update();
+ break;
+ default:
+ break;
+ }
+#else
+ Q_UNUSED(e)
+#endif
+ return false;
+}
+
+/*!
+ \internal
+ */
+QIcon QS60Style::standardIconImplementation(StandardPixmap standardIcon,
+ const QStyleOption *option, const QWidget *widget) const
+{
+ const int iconDimension = QS60StylePrivate::pixelMetric(QStyle::PM_ToolBarIconSize);
+ const QRect iconSize = (!option) ? QRect(0,0,iconDimension,iconDimension) : option->rect;
+ QS60StyleEnums::SkinParts part;
+ QS60StylePrivate::SkinElementFlags adjustedFlags;
+ if (option)
+ adjustedFlags = (option->state & State_Enabled || option->state == 0) ?
+ QS60StylePrivate::SF_StateEnabled :
+ QS60StylePrivate::SF_StateDisabled;
+
+ switch(standardIcon) {
+ case QStyle::SP_MessageBoxWarning:
+ part = QS60StyleEnums::SP_QgnNoteWarning;
+ break;
+ case QStyle::SP_MessageBoxInformation:
+ part = QS60StyleEnums::SP_QgnNoteInfo;
+ break;
+ case QStyle::SP_MessageBoxCritical:
+ part = QS60StyleEnums::SP_QgnNoteError;
+ break;
+ case QStyle::SP_MessageBoxQuestion:
+ part = QS60StyleEnums::SP_QgnNoteQuery;
+ break;
+ case QStyle::SP_ArrowRight:
+ part = QS60StyleEnums::SP_QgnIndiNaviArrowRight;
+ break;
+ case QStyle::SP_ArrowLeft:
+ part = QS60StyleEnums::SP_QgnIndiNaviArrowLeft;
+ break;
+ case QStyle::SP_ArrowUp:
+ part = QS60StyleEnums::SP_QgnIndiNaviArrowLeft;
+ adjustedFlags |= QS60StylePrivate::SF_PointEast;
+ break;
+ case QStyle::SP_ArrowDown:
+ part = QS60StyleEnums::SP_QgnIndiNaviArrowLeft;
+ adjustedFlags |= QS60StylePrivate::SF_PointWest;
+ break;
+ case QStyle::SP_ArrowBack:
+ if (QApplication::layoutDirection() == Qt::RightToLeft)
+ return QS60Style::standardIcon(SP_ArrowRight, option, widget);
+ return QS60Style::standardIcon(SP_ArrowLeft, option, widget);
+ case QStyle::SP_ArrowForward:
+ if (QApplication::layoutDirection() == Qt::RightToLeft)
+ return QS60Style::standardIcon(SP_ArrowLeft, option, widget);
+ return QS60Style::standardIcon(SP_ArrowRight, option, widget);
+ case QStyle::SP_ComputerIcon:
+ part = QS60StyleEnums::SP_QgnPropPhoneMemcLarge;
+ break;
+ case QStyle::SP_DirClosedIcon:
+ part = QS60StyleEnums::SP_QgnPropFolderSmall;
+ break;
+ case QStyle::SP_DirOpenIcon:
+ part = QS60StyleEnums::SP_QgnPropFolderCurrent;
+ break;
+ case QStyle::SP_DirIcon:
+ part = QS60StyleEnums::SP_QgnPropFolderSmall;
+ break;
+ case QStyle::SP_FileDialogNewFolder:
+ part = QS60StyleEnums::SP_QgnPropFolderSmallNew;
+ break;
+ case QStyle::SP_FileIcon:
+ part = QS60StyleEnums::SP_QgnPropFileSmall;
+ break;
+ case QStyle::SP_TrashIcon:
+ part = QS60StyleEnums::SP_QgnNoteErased;
+ break;
+ case QStyle::SP_ToolBarHorizontalExtensionButton:
+ part = QS60StyleEnums::SP_QgnIndiSubMenu;
+ if (QApplication::layoutDirection() == Qt::RightToLeft)
+ adjustedFlags |= QS60StylePrivate::SF_PointSouth;
+ break;
+ case QStyle::SP_ToolBarVerticalExtensionButton:
+ adjustedFlags |= QS60StylePrivate::SF_PointEast;
+ part = QS60StyleEnums::SP_QgnIndiSubMenu;
+ break;
+
+ default:
+ return QCommonStyle::standardIconImplementation(standardIcon, option, widget);
+ }
+ const QS60StylePrivate::SkinElementFlags flags = adjustedFlags;
+ const QPixmap cachedPixMap(QS60StylePrivate::cachedPart(part, iconSize.size(), flags));
+ return cachedPixMap.isNull() ?
+ QCommonStyle::standardIconImplementation(standardIcon, option, widget) : QIcon(cachedPixMap);
+}
+
+extern QPoint qt_s60_fill_background_offset(const QWidget *targetWidget);
+
+bool qt_s60_fill_background(QPainter *painter, const QRegion &rgn, const QBrush &brush)
+{
+ const QPixmap backgroundTexture(QS60StylePrivate::backgroundTexture());
+ if (backgroundTexture.cacheKey() != brush.texture().cacheKey())
+ return false;
+
+ const QPaintDevice *target = painter->device();
+ if (target->devType() == QInternal::Widget) {
+ const QWidget *widget = static_cast<const QWidget *>(target);
+ const QVector<QRect> &rects = rgn.rects();
+ for (int i = 0; i < rects.size(); ++i) {
+ const QRect rect(rects.at(i));
+ painter->drawPixmap(rect.topLeft(), backgroundTexture,
+ rect.translated(qt_s60_fill_background_offset(widget)));
+ }
+ }
+ return true;
+}
+
+QT_END_NAMESPACE
+
+#endif // QT_NO_STYLE_S60 || QT_PLUGIN
diff --git a/src/gui/styles/qs60style.h b/src/gui/styles/qs60style.h
new file mode 100644
index 0000000..e8dfdd4
--- /dev/null
+++ b/src/gui/styles/qs60style.h
@@ -0,0 +1,110 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the QtGui of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.1, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QS60STYLE_H
+#define QS60STYLE_H
+
+#include <QtGui/qcommonstyle.h>
+
+QT_BEGIN_HEADER
+
+QT_BEGIN_NAMESPACE
+
+QT_MODULE(Gui)
+
+#if !defined(QT_NO_STYLE_S60)
+
+class QS60StylePrivate;
+
+class Q_GUI_EXPORT QS60Style : public QCommonStyle
+{
+ Q_OBJECT
+ Q_DECLARE_PRIVATE(QS60Style)
+
+public:
+ QS60Style();
+ ~QS60Style();
+
+ void drawComplexControl(ComplexControl control, const QStyleOptionComplex *option, QPainter *painter, const QWidget *widget = 0) const;
+ void drawControl(ControlElement element, const QStyleOption *option, QPainter *painter, const QWidget *widget = 0) const;
+ void drawPrimitive(PrimitiveElement element, const QStyleOption *option, QPainter *painter, const QWidget *widget = 0) const;
+ int pixelMetric(PixelMetric metric, const QStyleOption *option = 0, const QWidget *widget = 0) const;
+ QSize sizeFromContents(ContentsType ct, const QStyleOption *opt, const QSize &contentsSize, const QWidget *w = 0) const;
+ int styleHint(StyleHint sh, const QStyleOption *opt = 0, const QWidget *w = 0,
+ QStyleHintReturn *shret = 0) const;
+ QRect subControlRect(ComplexControl control, const QStyleOptionComplex *option, SubControl scontrol, const QWidget *widget = 0) const;
+ QRect subElementRect(SubElement element, const QStyleOption *opt, const QWidget *widget = 0) const;
+ void polish(QWidget *widget);
+ void unpolish(QWidget *widget);
+ void polish(QApplication *application);
+ void unpolish(QApplication *application);
+
+ void setStyleProperty(const char *name, const QVariant &value);
+ QVariant styleProperty(const char *name) const;
+
+ bool event(QEvent *e);
+
+#ifndef Q_WS_S60
+ static QStringList partKeys();
+ static QStringList colorListKeys();
+ void setS60Theme(const QHash<QString, QPicture> &parts,
+ const QHash<QPair<QString , int>, QColor> &colors);
+ bool loadS60ThemeFromBlob(const QString &blobFile);
+ bool saveS60ThemeToBlob(const QString &blobFile) const;
+#endif // !Q_WS_S60
+
+protected Q_SLOTS:
+ QIcon standardIconImplementation(
+ StandardPixmap standardIcon, const QStyleOption * option = 0, const QWidget * widget = 0 ) const;
+
+private:
+ Q_DISABLE_COPY(QS60Style)
+ friend class QStyleFactory;
+ friend class QApplication;
+};
+
+#endif // QT_NO_STYLE_S60
+
+QT_END_NAMESPACE
+
+QT_END_HEADER
+
+#endif // QS60STYLE_H
diff --git a/src/gui/styles/qs60style_p.h b/src/gui/styles/qs60style_p.h
new file mode 100644
index 0000000..1006435
--- /dev/null
+++ b/src/gui/styles/qs60style_p.h
@@ -0,0 +1,508 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the QtGui of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.1, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QS60STYLE_P_H
+#define QS60STYLE_P_H
+
+#include "qs60style.h"
+#include "qcommonstyle_p.h"
+#include <QtCore/qhash.h>
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+QT_BEGIN_NAMESPACE
+
+const int MAX_NON_CUSTOM_PIXELMETRICS = 92;
+const int CUSTOMVALUESCOUNT = 4;
+enum {
+ PM_Custom_FrameCornerWidth = MAX_NON_CUSTOM_PIXELMETRICS,
+ PM_Custom_FrameCornerHeight,
+ PM_Custom_BoldLineWidth,
+ PM_Custom_ThinLineWidth
+ };
+const int MAX_PIXELMETRICS = MAX_NON_CUSTOM_PIXELMETRICS + CUSTOMVALUESCOUNT;
+
+typedef struct {
+ unsigned short height;
+ unsigned short width;
+ int major_version;
+ int minor_version;
+ bool mirroring; // TODO: (nice to have) Use Qt::LayoutDirection
+ const char* layoutName;
+} layoutHeader;
+
+#ifdef Q_OS_SYMBIAN
+NONSHARABLE_CLASS (QS60StyleEnums)
+#else
+class QS60StyleEnums
+#endif
+: public QObject
+{
+#ifndef Q_WS_S60
+ Q_OBJECT
+ Q_ENUMS(FontCategories)
+ Q_ENUMS(SkinParts)
+ Q_ENUMS(ColorLists)
+#endif // !Q_WS_S60
+
+public:
+ // S60 look-and-feel font categories
+ enum FontCategories {
+ FC_Undefined,
+ FC_Primary,
+ FC_Secondary,
+ FC_Title,
+ FC_PrimarySmall,
+ FC_Digital
+ };
+
+ enum SkinParts {
+ SP_QgnGrafBarWait,
+ SP_QgnGrafBarFrameCenter,
+ SP_QgnGrafBarFrameSideL,
+ SP_QgnGrafBarFrameSideR,
+ SP_QgnGrafBarProgress,
+ SP_QgnGrafScrollArrowDown,
+ SP_QgnGrafScrollArrowLeft,
+ SP_QgnGrafScrollArrowRight,
+ SP_QgnGrafScrollArrowUp,
+ SP_QgnGrafTabActiveL,
+ SP_QgnGrafTabActiveM,
+ SP_QgnGrafTabActiveR,
+ SP_QgnGrafTabPassiveL,
+ SP_QgnGrafTabPassiveM,
+ SP_QgnGrafTabPassiveR,
+ SP_QgnIndiCheckboxOff,
+ SP_QgnIndiCheckboxOn,
+ SP_QgnIndiHlColSuper, // Available in S60 release 3.2 and later.
+ SP_QgnIndiHlExpSuper, // Available in S60 release 3.2 and later.
+ SP_QgnIndiHlLineBranch, // Available in S60 release 3.2 and later.
+ SP_QgnIndiHlLineEnd, // Available in S60 release 3.2 and later.
+ SP_QgnIndiHlLineStraight, // Available in S60 release 3.2 and later.
+ SP_QgnIndiMarkedAdd,
+ SP_QgnIndiNaviArrowLeft,
+ SP_QgnIndiNaviArrowRight,
+ SP_QgnIndiRadiobuttOff,
+ SP_QgnIndiRadiobuttOn,
+ SP_QgnIndiSliderEdit,
+ SP_QgnIndiSubMenu,
+ SP_QgnNoteErased,
+ SP_QgnNoteError,
+ SP_QgnNoteInfo,
+ SP_QgnNoteOk,
+ SP_QgnNoteQuery,
+ SP_QgnNoteWarning,
+ SP_QgnPropFileSmall,
+ SP_QgnPropFolderCurrent,
+ SP_QgnPropFolderSmall,
+ SP_QgnPropFolderSmallNew,
+ SP_QgnPropPhoneMemcLarge,
+ SP_QsnCpScrollHandleBottomPressed, //ScrollBar handle, pressed state
+ SP_QsnCpScrollHandleMiddlePressed,
+ SP_QsnCpScrollHandleTopPressed,
+ SP_QsnBgScreen,
+ SP_QsnCpScrollBgBottom,
+ SP_QsnCpScrollBgMiddle,
+ SP_QsnCpScrollBgTop,
+ SP_QsnCpScrollHandleBottom,
+ SP_QsnCpScrollHandleMiddle,
+ SP_QsnCpScrollHandleTop,
+ SP_QsnFrButtonTbCornerTl, // Button, normal state
+ SP_QsnFrButtonTbCornerTr,
+ SP_QsnFrButtonTbCornerBl,
+ SP_QsnFrButtonTbCornerBr,
+ SP_QsnFrButtonTbSideT,
+ SP_QsnFrButtonTbSideB,
+ SP_QsnFrButtonTbSideL,
+ SP_QsnFrButtonTbSideR,
+ SP_QsnFrButtonTbCenter,
+ SP_QsnFrButtonTbCornerTlPressed, // Button, pressed state
+ SP_QsnFrButtonTbCornerTrPressed,
+ SP_QsnFrButtonTbCornerBlPressed,
+ SP_QsnFrButtonTbCornerBrPressed,
+ SP_QsnFrButtonTbSideTPressed,
+ SP_QsnFrButtonTbSideBPressed,
+ SP_QsnFrButtonTbSideLPressed,
+ SP_QsnFrButtonTbSideRPressed,
+ SP_QsnFrButtonTbCenterPressed,
+ SP_QsnFrCaleCornerTl, // calendar grid item
+ SP_QsnFrCaleCornerTr,
+ SP_QsnFrCaleCornerBl,
+ SP_QsnFrCaleCornerBr,
+ SP_QsnFrCaleGSideT,
+ SP_QsnFrCaleGSideB,
+ SP_QsnFrCaleGSideL,
+ SP_QsnFrCaleGSideR,
+ SP_QsnFrCaleCenter,
+ SP_QsnFrCaleHeadingCornerTl, // calendar grid header
+ SP_QsnFrCaleHeadingCornerTr,
+ SP_QsnFrCaleHeadingCornerBl,
+ SP_QsnFrCaleHeadingCornerBr,
+ SP_QsnFrCaleHeadingSideT,
+ SP_QsnFrCaleHeadingSideB,
+ SP_QsnFrCaleHeadingSideL,
+ SP_QsnFrCaleHeadingSideR,
+ SP_QsnFrCaleHeadingCenter,
+ SP_QsnFrInputCornerTl, // Text input field
+ SP_QsnFrInputCornerTr,
+ SP_QsnFrInputCornerBl,
+ SP_QsnFrInputCornerBr,
+ SP_QsnFrInputSideT,
+ SP_QsnFrInputSideB,
+ SP_QsnFrInputSideL,
+ SP_QsnFrInputSideR,
+ SP_QsnFrInputCenter,
+ SP_QsnFrListCornerTl, // List background
+ SP_QsnFrListCornerTr,
+ SP_QsnFrListCornerBl,
+ SP_QsnFrListCornerBr,
+ SP_QsnFrListSideT,
+ SP_QsnFrListSideB,
+ SP_QsnFrListSideL,
+ SP_QsnFrListSideR,
+ SP_QsnFrListCenter,
+ SP_QsnFrPopupCornerTl, // Option menu background
+ SP_QsnFrPopupCornerTr,
+ SP_QsnFrPopupCornerBl,
+ SP_QsnFrPopupCornerBr,
+ SP_QsnFrPopupSideT,
+ SP_QsnFrPopupSideB,
+ SP_QsnFrPopupSideL,
+ SP_QsnFrPopupSideR,
+ SP_QsnFrPopupCenter,
+ SP_QsnFrPopupPreviewCornerTl, // tool tip background
+ SP_QsnFrPopupPreviewCornerTr,
+ SP_QsnFrPopupPreviewCornerBl,
+ SP_QsnFrPopupPreviewCornerBr,
+ SP_QsnFrPopupPreviewSideT,
+ SP_QsnFrPopupPreviewSideB,
+ SP_QsnFrPopupPreviewSideL,
+ SP_QsnFrPopupPreviewSideR,
+ SP_QsnFrPopupPreviewCenter,
+ SP_QsnFrSetOptCornerTl, // Settings list
+ SP_QsnFrSetOptCornerTr,
+ SP_QsnFrSetOptCornerBl,
+ SP_QsnFrSetOptCornerBr,
+ SP_QsnFrSetOptSideT,
+ SP_QsnFrSetOptSideB,
+ SP_QsnFrSetOptSideL,
+ SP_QsnFrSetOptSideR,
+ SP_QsnFrSetOptCenter,
+ SP_QsnFrPopupSubCornerTl, // Toolbar background
+ SP_QsnFrPopupSubCornerTr,
+ SP_QsnFrPopupSubCornerBl,
+ SP_QsnFrPopupSubCornerBr,
+ SP_QsnFrPopupSubSideT,
+ SP_QsnFrPopupSubSideB,
+ SP_QsnFrPopupSubSideL,
+ SP_QsnFrPopupSubSideR,
+ SP_QsnFrPopupSubCenter,
+ SP_QsnFrSctrlButtonCornerTl, // Toolbar button
+ SP_QsnFrSctrlButtonCornerTr,
+ SP_QsnFrSctrlButtonCornerBl,
+ SP_QsnFrSctrlButtonCornerBr,
+ SP_QsnFrSctrlButtonSideT,
+ SP_QsnFrSctrlButtonSideB,
+ SP_QsnFrSctrlButtonSideL,
+ SP_QsnFrSctrlButtonSideR,
+ SP_QsnFrSctrlButtonCenter,
+ SP_QsnFrSctrlButtonCornerTlPressed, // Toolbar button, pressed
+ SP_QsnFrSctrlButtonCornerTrPressed,
+ SP_QsnFrSctrlButtonCornerBlPressed,
+ SP_QsnFrSctrlButtonCornerBrPressed,
+ SP_QsnFrSctrlButtonSideTPressed,
+ SP_QsnFrSctrlButtonSideBPressed,
+ SP_QsnFrSctrlButtonSideLPressed,
+ SP_QsnFrSctrlButtonSideRPressed,
+ SP_QsnFrSctrlButtonCenterPressed,
+ SP_QsnFrButtonCornerTlInactive, // Inactive button
+ SP_QsnFrButtonCornerTrInactive,
+ SP_QsnFrButtonCornerBlInactive,
+ SP_QsnFrButtonCornerBrInactive,
+ SP_QsnFrButtonSideTInactive,
+ SP_QsnFrButtonSideBInactive,
+ SP_QsnFrButtonSideLInactive,
+ SP_QsnFrButtonSideRInactive,
+ SP_QsnFrButtonCenterInactive,
+ SP_QsnFrNotepadCornerTl,
+ SP_QsnFrNotepadCornerTr,
+ SP_QsnFrNotepadCornerBl,
+ SP_QsnFrNotepadCornerBr,
+ SP_QsnFrNotepadSideT,
+ SP_QsnFrNotepadSideB,
+ SP_QsnFrNotepadSideL,
+ SP_QsnFrNotepadSideR,
+ SP_QsnFrNotepadCenter
+ };
+
+ enum ColorLists {
+ CL_QsnHighlightColors,
+ CL_QsnIconColors,
+ CL_QsnLineColors,
+ CL_QsnOtherColors,
+ CL_QsnParentColors,
+ CL_QsnTextColors
+ };
+};
+
+class QFocusFrame;
+
+// Private class
+#ifdef Q_OS_SYMBIAN
+NONSHARABLE_CLASS (QS60StylePrivate)
+#else
+class QS60StylePrivate
+#endif
+: public QCommonStylePrivate
+{
+ Q_DECLARE_PUBLIC(QS60Style)
+
+public:
+ QS60StylePrivate();
+ ~QS60StylePrivate();
+
+ enum SkinElements {
+ SE_ButtonNormal,
+ SE_ButtonPressed,
+ SE_FrameLineEdit,
+ SE_ProgressBarGrooveHorizontal,
+ SE_ProgressBarIndicatorHorizontal,
+ SE_ProgressBarGrooveVertical,
+ SE_ProgressBarIndicatorVertical,
+ SE_ScrollBarGrooveHorizontal,
+ SE_ScrollBarGrooveVertical,
+ SE_ScrollBarHandleHorizontal,
+ SE_ScrollBarHandleVertical,
+ SE_SliderHandleHorizontal,
+ SE_SliderHandleVertical,
+ SE_TabBarTabEastActive,
+ SE_TabBarTabEastInactive,
+ SE_TabBarTabNorthActive,
+ SE_TabBarTabNorthInactive,
+ SE_TabBarTabSouthActive,
+ SE_TabBarTabSouthInactive,
+ SE_TabBarTabWestActive,
+ SE_TabBarTabWestInactive,
+ SE_ListHighlight,
+ SE_OptionsMenu,
+ SE_SettingsList,
+ SE_TableItem,
+ SE_TableHeaderItem,
+ SE_ToolTip, //own graphic available on 3.2+ releases,
+ SE_ToolBar,
+ SE_ToolBarButton,
+ SE_ToolBarButtonPressed,
+ SE_PanelBackground,
+ SE_ScrollBarHandlePressedHorizontal, //only for 5.0+
+ SE_ScrollBarHandlePressedVertical,
+ SE_ButtonInactive,
+ SE_Editor,
+ };
+
+ enum SkinFrameElements {
+ SF_ButtonNormal,
+ SF_ButtonPressed,
+ SF_FrameLineEdit,
+ SF_ListHighlight,
+ SF_OptionsMenu,
+ SF_SettingsList,
+ SF_TableItem,
+ SF_TableHeaderItem,
+ SF_ToolTip,
+ SF_ToolBar,
+ SF_ToolBarButton,
+ SF_ToolBarButtonPressed,
+ SF_PanelBackground,
+ SF_ButtonInactive,
+ SF_Editor,
+ };
+
+ enum SkinElementFlag {
+ SF_PointNorth = 0x0001, // North = the default
+ SF_PointEast = 0x0002,
+ SF_PointSouth = 0x0004,
+ SF_PointWest = 0x0008,
+
+ SF_StateEnabled = 0x0010, // Enabled = the default
+ SF_StateDisabled = 0x0020,
+ SF_ColorSkinned = 0x0040,
+ };
+
+ enum CacheClearReason {
+ CC_UndefinedChange = 0,
+ CC_LayoutChange,
+ CC_ThemeChange
+ };
+
+ Q_DECLARE_FLAGS(SkinElementFlags, SkinElementFlag)
+
+ // draws skin element
+ static void drawSkinElement(SkinElements element, QPainter *painter,
+ const QRect &rect, SkinElementFlags flags = KDefaultSkinElementFlags);
+ // draws a specific skin part
+ static void drawSkinPart(QS60StyleEnums::SkinParts part, QPainter *painter,
+ const QRect &rect, SkinElementFlags flags = KDefaultSkinElementFlags);
+ // sets style property
+ void setStyleProperty(const char *name, const QVariant &value);
+ // sets specific style property
+ void setStyleProperty_specific(const char *name, const QVariant &value);
+ // gets style property
+ QVariant styleProperty(const char *name) const;
+ // gets specific style property
+ QVariant styleProperty_specific(const char *name) const;
+ // gets pixel metrics value
+ static short pixelMetric(int metric);
+ // gets color. 'index' is NOT 0-based.
+ // It corresponds to the enum key 1-based numbers of TAknsQsnXYZColorsIndex, not the values.
+ static QColor s60Color(QS60StyleEnums::ColorLists list,
+ int index, const QStyleOption *option);
+ // gets state specific color
+ static QColor stateColor(const QColor &color, const QStyleOption *option);
+ // gets lighter color than base color
+ static QColor lighterColor(const QColor &baseColor);
+ //deduces if the given widget should have separately themeable background
+ static bool drawsOwnThemeBackground(const QWidget *widget);
+
+ QFont s60Font(QS60StyleEnums::FontCategories fontCategory,
+ int pointSize = -1) const;
+ // clears all style caches (fonts, colors, pixmaps)
+ void clearCaches(CacheClearReason reason = CC_UndefinedChange);
+
+ // themed main background oprations
+ void setBackgroundTexture(QApplication *application) const;
+ static void deleteBackground();
+
+ static bool isTouchSupported();
+ static bool isToolBarBackground();
+
+ // calculates average color based on button skin graphics (minus borders).
+ QColor colorFromFrameGraphics(SkinFrameElements frame) const;
+
+ //set theme palette for application
+ void setThemePalette(QApplication *application) const;
+ //set theme palette for style option
+ void setThemePalette(QStyleOption *option) const;
+ //access to theme palette
+ static QPalette* themePalette();
+
+ static const layoutHeader m_layoutHeaders[];
+ static const short data[][MAX_PIXELMETRICS];
+
+ void setCurrentLayout(int layoutIndex);
+ void setActiveLayout();
+ // Pointer
+ static short const *m_pmPointer;
+ // number of layouts supported by the style
+ static const int m_numberOfLayouts;
+
+ mutable QHash<QPair<QS60StyleEnums::FontCategories , int>, QFont> m_mappedFontsCache;
+ mutable QHash<SkinFrameElements, QColor> m_colorCache;
+
+ // Has one entry per SkinFrameElements
+ static const struct frameElementCenter {
+ SkinElements element;
+ QS60StyleEnums::SkinParts center;
+ } m_frameElementsData[];
+
+ static QPixmap frame(SkinFrameElements frame, const QSize &size,
+ SkinElementFlags flags = KDefaultSkinElementFlags);
+ static QPixmap backgroundTexture();
+
+#ifdef Q_WS_S60
+ void handleDynamicLayoutVariantSwitch();
+ void handleSkinChange();
+#endif // Q_WS_S60
+
+private:
+ static void drawPart(QS60StyleEnums::SkinParts part, QPainter *painter,
+ const QRect &rect, SkinElementFlags flags = KDefaultSkinElementFlags);
+ static void drawRow(QS60StyleEnums::SkinParts start, QS60StyleEnums::SkinParts middle,
+ QS60StyleEnums::SkinParts end, Qt::Orientation orientation, QPainter *painter,
+ const QRect &rect, SkinElementFlags flags = KDefaultSkinElementFlags);
+ static void drawFrame(SkinFrameElements frame, QPainter *painter,
+ const QRect &rect, SkinElementFlags flags = KDefaultSkinElementFlags);
+
+ static QPixmap cachedPart(QS60StyleEnums::SkinParts part, const QSize &size,
+ SkinElementFlags flags = KDefaultSkinElementFlags);
+ static QPixmap cachedFrame(SkinFrameElements frame, const QSize &size,
+ SkinElementFlags flags = KDefaultSkinElementFlags);
+
+ static void refreshUI();
+
+ // set S60 font for widget
+ void setFont(QWidget *widget) const;
+ void setThemePalette(QWidget *widget) const;
+ void setThemePalette(QPalette *palette) const;
+ void setThemePaletteHash(QPalette *palette) const;
+ static void storeThemePalette(QPalette *palette);
+ static void deleteThemePalette();
+
+ static QSize partSize(QS60StyleEnums::SkinParts part,
+ SkinElementFlags flags = KDefaultSkinElementFlags);
+ static QPixmap part(QS60StyleEnums::SkinParts part, const QSize &size,
+ SkinElementFlags flags = KDefaultSkinElementFlags);
+
+ static QFont s60Font_specific(QS60StyleEnums::FontCategories fontCategory, int pointSize);
+
+ static QSize screenSize();
+
+ // Contains background texture.
+ static QPixmap *m_background;
+ const static SkinElementFlags KDefaultSkinElementFlags;
+ // defined theme palette
+ static QPalette *m_themePalette;
+ QPalette m_originalPalette;
+
+ QPointer<QFocusFrame> m_focusFrame;
+};
+
+QT_END_NAMESPACE
+
+#endif // QS60STYLE_P_H
diff --git a/src/gui/styles/qs60style_s60.cpp b/src/gui/styles/qs60style_s60.cpp
new file mode 100644
index 0000000..c524844
--- /dev/null
+++ b/src/gui/styles/qs60style_s60.cpp
@@ -0,0 +1,1384 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the QtGui of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.1, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qs60style.h"
+#include "qs60style_p.h"
+#include "qpainter.h"
+#include "qstyleoption.h"
+#include "qstyle.h"
+#include "private/qwindowsurface_s60_p.h"
+#include "private/qt_s60_p.h"
+#include "private/qcore_symbian_p.h"
+#include "qapplication.h"
+
+#include <w32std.h>
+#include <aknsconstants.h>
+#include <aknconsts.h>
+#include <aknsitemid.h>
+#include <aknsutils.h>
+#include <aknsdrawutils.h>
+#include <aknsskininstance.h>
+#include <aknsbasicbackgroundcontrolcontext.h>
+#include <avkon.mbg>
+#include <AknFontAccess.h>
+#include <AknLayoutFont.h>
+#include <aknutils.h>
+
+#if !defined(QT_NO_STYLE_S60) || defined(QT_PLUGIN)
+
+QT_BEGIN_NAMESPACE
+
+enum TDrawType {
+ EDrawIcon,
+ EDrawBackground,
+ ENoDraw
+};
+
+enum TSupportRelease {
+ ES60_None = 0x0000, //indicates that the commonstyle should draw the graphics
+ ES60_3_1 = 0x0001,
+ ES60_3_2 = 0x0002,
+ ES60_5_0 = 0x0004,
+ ES60_5_1 = 0x0008,
+ ES60_5_2 = 0x0010,
+ // Add all new releases here
+ ES60_AllReleases = ES60_3_1 | ES60_3_2 | ES60_5_0 | ES60_5_1 | ES60_5_2
+};
+
+typedef struct {
+ const TAknsItemID &skinID;
+ TDrawType drawType;
+ int supportInfo;
+ int newMajorSkinId;
+ int newMinorSkinId;
+} partMapEntry;
+
+class QS60StyleModeSpecifics
+{
+public:
+ static QPixmap skinnedGraphics(QS60StyleEnums::SkinParts stylepart,
+ const QSize &size, QS60StylePrivate::SkinElementFlags flags);
+ static QPixmap skinnedGraphics(QS60StylePrivate::SkinFrameElements frameElement, const QSize &size, QS60StylePrivate::SkinElementFlags flags);
+ static QPixmap colorSkinnedGraphics(const QS60StyleEnums::SkinParts &stylepart,
+ const QSize &size, QS60StylePrivate::SkinElementFlags flags);
+ static QColor colorValue(const TAknsItemID &colorGroup, int colorIndex);
+ static QPixmap fromFbsBitmap(CFbsBitmap *icon, CFbsBitmap *mask, QS60StylePrivate::SkinElementFlags flags, QImage::Format format);
+ static bool disabledPartGraphic(QS60StyleEnums::SkinParts &part);
+ static bool disabledFrameGraphic(QS60StylePrivate::SkinFrameElements &frame);
+ static QPixmap generateMissingThemeGraphic(QS60StyleEnums::SkinParts &part, const QSize &size, QS60StylePrivate::SkinElementFlags flags);
+
+private:
+ static QPixmap createSkinnedGraphicsLX(QS60StyleEnums::SkinParts part,
+ const QSize &size, QS60StylePrivate::SkinElementFlags flags);
+ static QPixmap createSkinnedGraphicsLX(QS60StylePrivate::SkinFrameElements frameElement, const QSize &size, QS60StylePrivate::SkinElementFlags flags);
+ static QPixmap colorSkinnedGraphicsLX(const QS60StyleEnums::SkinParts &stylepart,
+ const QSize &size, QS60StylePrivate::SkinElementFlags flags);
+ static void frameIdAndCenterId(QS60StylePrivate::SkinFrameElements frameElement, TAknsItemID &frameId, TAknsItemID &centerId);
+ static TRect innerRectFromElement(QS60StylePrivate::SkinFrameElements frameElement, const TRect &outerRect);
+ static void checkAndUnCompressBitmapL(CFbsBitmap*& aOriginalBitmap);
+ static void checkAndUnCompressBitmap(CFbsBitmap*& aOriginalBitmap);
+ static void unCompressBitmapL(const TRect& aTrgRect, CFbsBitmap* aTrgBitmap, CFbsBitmap* aSrcBitmap);
+ static void colorGroupAndIndex(QS60StyleEnums::SkinParts skinID,
+ TAknsItemID &colorGroup, int colorIndex);
+ static void fallbackInfo(const QS60StyleEnums::SkinParts &stylepart, TDes& fallbackFileName, TInt& fallbackIndex);
+ static bool checkSupport(const int supportedRelease);
+ static TAknsItemID checkAndUpdateReleaseSpecificGraphics(int part);
+ // Array to match the skin ID, fallback graphics and Qt widget graphics.
+ static const partMapEntry m_partMap[];
+};
+
+const partMapEntry QS60StyleModeSpecifics::m_partMap[] = {
+ /* SP_QgnGrafBarWait */ {KAknsIIDQgnGrafBarWaitAnim, EDrawIcon, ES60_AllReleases, -1,-1},
+ /* SP_QgnGrafBarFrameCenter */ {KAknsIIDQgnGrafBarFrameCenter, EDrawIcon, ES60_AllReleases, -1,-1},
+ /* SP_QgnGrafBarFrameSideL */ {KAknsIIDQgnGrafBarFrameSideL, EDrawIcon, ES60_AllReleases, -1,-1},
+ /* SP_QgnGrafBarFrameSideR */ {KAknsIIDQgnGrafBarFrameSideR, EDrawIcon, ES60_AllReleases, -1,-1},
+ /* SP_QgnGrafBarProgress */ {KAknsIIDQgnGrafBarProgress, EDrawIcon, ES60_AllReleases, -1,-1},
+ /* SP_QgnGrafScrollArrowDown */ {KAknsIIDQgnGrafScrollArrowDown, EDrawIcon, ES60_AllReleases, -1,-1},
+ /* SP_QgnGrafScrollArrowLeft */ {KAknsIIDQgnGrafScrollArrowLeft, EDrawIcon, ES60_AllReleases, -1,-1},
+ /* SP_QgnGrafScrollArrowRight */ {KAknsIIDQgnGrafScrollArrowRight, EDrawIcon, ES60_AllReleases, -1,-1},
+ /* SP_QgnGrafScrollArrowUp */ {KAknsIIDQgnGrafScrollArrowUp, EDrawIcon, ES60_AllReleases, -1,-1},
+ /* SP_QgnGrafTabActiveL */ {KAknsIIDQgnGrafTabActiveL, EDrawIcon, ES60_AllReleases, -1,-1},
+ /* SP_QgnGrafTabActiveM */ {KAknsIIDQgnGrafTabActiveM, EDrawIcon, ES60_AllReleases, -1,-1},
+ /* SP_QgnGrafTabActiveR */ {KAknsIIDQgnGrafTabActiveR, EDrawIcon, ES60_AllReleases, -1,-1},
+ /* SP_QgnGrafTabPassiveL */ {KAknsIIDQgnGrafTabPassiveL, EDrawIcon, ES60_AllReleases, -1,-1},
+ /* SP_QgnGrafTabPassiveM */ {KAknsIIDQgnGrafTabPassiveM, EDrawIcon, ES60_AllReleases, -1,-1},
+ /* SP_QgnGrafTabPassiveR */ {KAknsIIDQgnGrafTabPassiveR, EDrawIcon, ES60_AllReleases, -1,-1},
+ /* SP_QgnIndiCheckboxOff */ {KAknsIIDQgnIndiCheckboxOff, EDrawIcon, ES60_AllReleases, -1,-1},
+ /* SP_QgnIndiCheckboxOn */ {KAknsIIDQgnIndiCheckboxOn, EDrawIcon, ES60_AllReleases, -1,-1},
+ // Following 5 items (SP_QgnIndiHlColSuper - SP_QgnIndiHlLineStraight) are available starting from S60 release 3.2.
+ // In 3.1 CommonStyle drawing is used for these QTreeView elements, since no similar icons in AVKON UI.
+ /* SP_QgnIndiHlColSuper */ {KAknsIIDNone, EDrawIcon, ES60_3_1, EAknsMajorGeneric, 0x17d5 /* KAknsIIDQgnIndiHlColSuper */},
+ /* SP_QgnIndiHlExpSuper */ {KAknsIIDNone, EDrawIcon, ES60_3_1, EAknsMajorGeneric, 0x17d6 /* KAknsIIDQgnIndiHlExpSuper */},
+ /* SP_QgnIndiHlLineBranch */ {KAknsIIDNone, EDrawIcon, ES60_3_1, EAknsMajorGeneric, 0x17d7 /* KAknsIIDQgnIndiHlLineBranch */},
+ /* SP_QgnIndiHlLineEnd */ {KAknsIIDNone, EDrawIcon, ES60_3_1, EAknsMajorGeneric, 0x17d8 /* KAknsIIDQgnIndiHlLineEnd */},
+ /* SP_QgnIndiHlLineStraight */ {KAknsIIDNone, EDrawIcon, ES60_3_1, EAknsMajorGeneric, 0x17d9 /* KAknsIIDQgnIndiHlLineStraight */},
+ /* SP_QgnIndiMarkedAdd */ {KAknsIIDQgnIndiMarkedAdd, EDrawIcon, ES60_AllReleases, -1,-1},
+ /* SP_QgnIndiNaviArrowLeft */ {KAknsIIDQgnGrafScrollArrowLeft, EDrawIcon, ES60_AllReleases, -1,-1},
+ /* SP_QgnIndiNaviArrowRight */ {KAknsIIDQgnGrafScrollArrowRight, EDrawIcon, ES60_AllReleases, -1,-1},
+ /* SP_QgnIndiRadiobuttOff */ {KAknsIIDQgnIndiRadiobuttOff, EDrawIcon, ES60_AllReleases, -1,-1},
+ /* SP_QgnIndiRadiobuttOn */ {KAknsIIDQgnIndiRadiobuttOn, EDrawIcon, ES60_AllReleases, -1,-1},
+ /* SP_QgnIndiSliderEdit */ {KAknsIIDQgnIndiSliderEdit, EDrawIcon, ES60_AllReleases, -1,-1},
+ /* SP_QgnIndiSubMenu */ {KAknsIIDQgnIndiSubmenu, EDrawIcon, ES60_AllReleases, -1,-1},
+ /* SP_QgnNoteErased */ {KAknsIIDQgnNoteErased, EDrawIcon, ES60_AllReleases, -1,-1},
+ /* SP_QgnNoteError */ {KAknsIIDQgnNoteError, EDrawIcon, ES60_AllReleases, -1,-1},
+ /* SP_QgnNoteInfo */ {KAknsIIDQgnNoteInfo, EDrawIcon, ES60_AllReleases, -1,-1},
+ /* SP_QgnNoteOk */ {KAknsIIDQgnNoteOk, EDrawIcon, ES60_AllReleases, -1,-1},
+ /* SP_QgnNoteQuery */ {KAknsIIDQgnNoteQuery, EDrawIcon, ES60_AllReleases, -1,-1},
+ /* SP_QgnNoteWarning */ {KAknsIIDQgnNoteWarning, EDrawIcon, ES60_AllReleases, -1,-1},
+ /* SP_QgnPropFileSmall */ {KAknsIIDQgnPropFileSmall, EDrawIcon, ES60_AllReleases, -1,-1},
+ /* SP_QgnPropFolderCurrent */ {KAknsIIDQgnPropFolderCurrent, EDrawIcon, ES60_AllReleases, -1,-1},
+ /* SP_QgnPropFolderSmall */ {KAknsIIDQgnPropFolderSmall, EDrawIcon, ES60_AllReleases, -1,-1},
+ /* SP_QgnPropFolderSmallNew */ {KAknsIIDQgnPropFolderSmallNew, EDrawIcon, ES60_AllReleases, -1,-1},
+ /* SP_QgnPropPhoneMemcLarge */ {KAknsIIDQgnPropPhoneMemcLarge, EDrawIcon, ES60_AllReleases, -1,-1},
+
+ // 3.1 & 3.2 do not have pressed state for scrollbar, so use normal scrollbar graphics instead.
+ /* SP_QsnCpScrollHandleBottomPressed*/ {KAknsIIDQsnCpScrollHandleBottom, EDrawIcon, ES60_3_1 | ES60_3_2, EAknsMajorGeneric, 0x20f8}, /*KAknsIIDQsnCpScrollHandleBottomPressed*/
+ /* SP_QsnCpScrollHandleMiddlePressed*/ {KAknsIIDQsnCpScrollHandleMiddle, EDrawIcon, ES60_3_1 | ES60_3_2, EAknsMajorGeneric, 0x20f9}, /*KAknsIIDQsnCpScrollHandleMiddlePressed*/
+ /* SP_QsnCpScrollHandleTopPressed*/ {KAknsIIDQsnCpScrollHandleTop, EDrawIcon, ES60_3_1 | ES60_3_2, EAknsMajorGeneric, 0x20fa}, /*KAknsIIDQsnCpScrollHandleTopPressed*/
+
+ /* SP_QsnBgScreen */ {KAknsIIDQsnBgScreen, EDrawBackground, ES60_AllReleases, -1,-1},
+
+ /* SP_QsnCpScrollBgBottom */ {KAknsIIDQsnCpScrollBgBottom, EDrawIcon, ES60_AllReleases, -1,-1},
+ /* SP_QsnCpScrollBgMiddle */ {KAknsIIDQsnCpScrollBgMiddle, EDrawIcon, ES60_AllReleases, -1,-1},
+ /* SP_QsnCpScrollBgTop */ {KAknsIIDQsnCpScrollBgTop, EDrawIcon, ES60_AllReleases, -1,-1},
+
+ /* SP_QsnCpScrollHandleBottom */ {KAknsIIDQsnCpScrollHandleBottom, EDrawIcon, ES60_AllReleases, -1,-1},
+ /* SP_QsnCpScrollHandleMiddle */ {KAknsIIDQsnCpScrollHandleMiddle, EDrawIcon, ES60_AllReleases, -1,-1},
+ /* SP_QsnCpScrollHandleTop */ {KAknsIIDQsnCpScrollHandleTop, EDrawIcon, ES60_AllReleases, -1,-1},
+
+ /* SP_QsnFrButtonTbCornerTl */ {KAknsIIDQsnFrButtonTbCornerTl, ENoDraw, ES60_AllReleases, -1,-1}, //todo: use "normal button" from 5.0 onwards
+ /* SP_QsnFrButtonTbCornerTr */ {KAknsIIDQsnFrButtonTbCornerTr, ENoDraw, ES60_AllReleases, -1,-1},
+ /* SP_QsnFrButtonTbCornerBl */ {KAknsIIDQsnFrButtonTbCornerBl, ENoDraw, ES60_AllReleases, -1,-1},
+ /* SP_QsnFrButtonTbCornerBr */ {KAknsIIDQsnFrButtonTbCornerBr, ENoDraw, ES60_AllReleases, -1,-1},
+ /* SP_QsnFrButtonTbSideT */ {KAknsIIDQsnFrButtonTbSideT, ENoDraw, ES60_AllReleases, -1,-1},
+ /* SP_QsnFrButtonTbSideB */ {KAknsIIDQsnFrButtonTbSideB, ENoDraw, ES60_AllReleases, -1,-1},
+ /* SP_QsnFrButtonTbSideL */ {KAknsIIDQsnFrButtonTbSideL, ENoDraw, ES60_AllReleases, -1,-1},
+ /* SP_QsnFrButtonTbSideR */ {KAknsIIDQsnFrButtonTbSideR, ENoDraw, ES60_AllReleases, -1,-1},
+ /* SP_QsnFrButtonTbCenter */ {KAknsIIDQsnFrButtonTbCenter, EDrawIcon, ES60_AllReleases, -1,-1},
+
+ /* SP_QsnFrButtonTbCornerTlPressed */{KAknsIIDQsnFrButtonTbCornerTlPressed, ENoDraw, ES60_AllReleases, -1,-1},
+ /* SP_QsnFrButtonTbCornerTrPressed */{KAknsIIDQsnFrButtonTbCornerTrPressed, ENoDraw, ES60_AllReleases, -1,-1},
+ /* SP_QsnFrButtonTbCornerBlPressed */{KAknsIIDQsnFrButtonTbCornerBlPressed, ENoDraw, ES60_AllReleases, -1,-1},
+ /* SP_QsnFrButtonTbCornerBrPressed */{KAknsIIDQsnFrButtonTbCornerBrPressed, ENoDraw, ES60_AllReleases, -1,-1},
+ /* SP_QsnFrButtonTbSideTPressed */ {KAknsIIDQsnFrButtonTbSideTPressed, ENoDraw, ES60_AllReleases, -1,-1},
+ /* SP_QsnFrButtonTbSideBPressed */ {KAknsIIDQsnFrButtonTbSideBPressed, ENoDraw, ES60_AllReleases, -1,-1},
+ /* SP_QsnFrButtonTbSideLPressed */ {KAknsIIDQsnFrButtonTbSideLPressed, ENoDraw, ES60_AllReleases, -1,-1},
+ /* SP_QsnFrButtonTbSideRPressed */ {KAknsIIDQsnFrButtonTbSideRPressed, ENoDraw, ES60_AllReleases, -1,-1},
+ /* SP_QsnFrButtonTbCenterPressed */ {KAknsIIDQsnFrButtonTbCenterPressed, EDrawIcon, ES60_AllReleases, -1,-1},
+
+ /* SP_QsnFrCaleCornerTl */ {KAknsIIDQsnFrCaleCornerTl, ENoDraw, ES60_AllReleases, -1,-1},
+ /* SP_QsnFrCaleCornerTr */ {KAknsIIDQsnFrCaleCornerTr, ENoDraw, ES60_AllReleases, -1,-1},
+ /* SP_QsnFrCaleCornerBl */ {KAknsIIDQsnFrCaleCornerBl, ENoDraw, ES60_AllReleases, -1,-1},
+ /* SP_QsnFrCaleCornerBr */ {KAknsIIDQsnFrCaleCornerBr, ENoDraw, ES60_AllReleases, -1,-1},
+ /* SP_QsnFrCaleGSideT */ {KAknsIIDQsnFrCaleSideT, ENoDraw, ES60_AllReleases, -1,-1},
+ /* SP_QsnFrCaleGSideB */ {KAknsIIDQsnFrCaleSideB, ENoDraw, ES60_AllReleases, -1,-1},
+ /* SP_QsnFrCaleGSideL */ {KAknsIIDQsnFrCaleSideL, ENoDraw, ES60_AllReleases, -1,-1},
+ /* SP_QsnFrCaleGSideR */ {KAknsIIDQsnFrCaleSideR, ENoDraw, ES60_AllReleases, -1,-1},
+ /* SP_QsnFrCaleCenter */ {KAknsIIDQsnFrCaleCenter, ENoDraw, ES60_AllReleases, -1,-1},
+
+ /* SP_QsnFrCaleHeadingCornerTl */ {KAknsIIDQsnFrCaleHeadingCornerTl, ENoDraw, ES60_AllReleases, -1,-1},
+ /* SP_QsnFrCaleHeadingCornerTr */ {KAknsIIDQsnFrCaleHeadingCornerTr, ENoDraw, ES60_AllReleases, -1,-1},
+ /* SP_QsnFrCaleHeadingCornerBl */ {KAknsIIDQsnFrCaleHeadingCornerBl, ENoDraw, ES60_AllReleases, -1,-1},
+ /* SP_QsnFrCaleHeadingCornerBr */ {KAknsIIDQsnFrCaleHeadingCornerBr, ENoDraw, ES60_AllReleases, -1,-1},
+ /* SP_QsnFrCaleHeadingSideT */ {KAknsIIDQsnFrCaleHeadingSideT, ENoDraw, ES60_AllReleases, -1,-1},
+ /* SP_QsnFrCaleHeadingSideB */ {KAknsIIDQsnFrCaleHeadingSideB, ENoDraw, ES60_AllReleases, -1,-1},
+ /* SP_QsnFrCaleHeadingSideL */ {KAknsIIDQsnFrCaleHeadingSideL, ENoDraw, ES60_AllReleases, -1,-1},
+ /* SP_QsnFrCaleHeadingSideR */ {KAknsIIDQsnFrCaleHeadingSideR, ENoDraw, ES60_AllReleases, -1,-1},
+ /* SP_QsnFrCaleHeadingCenter */ {KAknsIIDQsnFrCaleHeadingCenter, ENoDraw, ES60_AllReleases, -1,-1},
+
+ /* SP_QsnFrInputCornerTl */ {KAknsIIDQsnFrInputCornerTl, ENoDraw, ES60_AllReleases, -1,-1},
+ /* SP_QsnFrInputCornerTr */ {KAknsIIDQsnFrInputCornerTr, ENoDraw, ES60_AllReleases, -1,-1},
+ /* SP_QsnFrInputCornerBl */ {KAknsIIDQsnFrInputCornerBl, ENoDraw, ES60_AllReleases, -1,-1},
+ /* SP_QsnFrInputCornerBr */ {KAknsIIDQsnFrInputCornerBr, ENoDraw, ES60_AllReleases, -1,-1},
+ /* SP_QsnFrInputSideT */ {KAknsIIDQsnFrInputSideT, ENoDraw, ES60_AllReleases, -1,-1},
+ /* SP_QsnFrInputSideB */ {KAknsIIDQsnFrInputSideB, ENoDraw, ES60_AllReleases, -1,-1},
+ /* SP_QsnFrInputSideL */ {KAknsIIDQsnFrInputSideL, ENoDraw, ES60_AllReleases, -1,-1},
+ /* SP_QsnFrInputSideR */ {KAknsIIDQsnFrInputSideR, ENoDraw, ES60_AllReleases, -1,-1},
+ /* SP_QsnFrInputCenter */ {KAknsIIDQsnFrInputCenter, ENoDraw, ES60_AllReleases, -1,-1},
+
+ /* SP_QsnFrListCornerTl */ {KAknsIIDQsnFrListCornerTl, ENoDraw, ES60_AllReleases, -1,-1},
+ /* SP_QsnFrListCornerTr */ {KAknsIIDQsnFrListCornerTr, ENoDraw, ES60_AllReleases, -1,-1},
+ /* SP_QsnFrListCornerBl */ {KAknsIIDQsnFrListCornerBl, ENoDraw, ES60_AllReleases, -1,-1},
+ /* SP_QsnFrListCornerBr */ {KAknsIIDQsnFrListCornerBr, ENoDraw, ES60_AllReleases, -1,-1},
+ /* SP_QsnFrListSideT */ {KAknsIIDQsnFrListSideT, ENoDraw, ES60_AllReleases, -1,-1},
+ /* SP_QsnFrListSideB */ {KAknsIIDQsnFrListSideB, ENoDraw, ES60_AllReleases, -1,-1},
+ /* SP_QsnFrListSideL */ {KAknsIIDQsnFrListSideL, ENoDraw, ES60_AllReleases, -1,-1},
+ /* SP_QsnFrListSideR */ {KAknsIIDQsnFrListSideR, ENoDraw, ES60_AllReleases, -1,-1},
+ /* SP_QsnFrListCenter */ {KAknsIIDQsnFrListCenter, ENoDraw, ES60_AllReleases, -1,-1},
+
+ /* SP_QsnFrPopupCornerTl */ {KAknsIIDQsnFrPopupCornerTl, ENoDraw, ES60_AllReleases, -1,-1},
+ /* SP_QsnFrPopupCornerTr */ {KAknsIIDQsnFrPopupCornerTr, ENoDraw, ES60_AllReleases, -1,-1},
+ /* SP_QsnFrPopupCornerBl */ {KAknsIIDQsnFrPopupCornerBl, ENoDraw, ES60_AllReleases, -1,-1},
+ /* SP_QsnFrPopupCornerBr */ {KAknsIIDQsnFrPopupCornerBr, ENoDraw, ES60_AllReleases, -1,-1},
+ /* SP_QsnFrPopupSideT */ {KAknsIIDQsnFrPopupSideT, ENoDraw, ES60_AllReleases, -1,-1},
+ /* SP_QsnFrPopupSideB */ {KAknsIIDQsnFrPopupSideB, ENoDraw, ES60_AllReleases, -1,-1},
+ /* SP_QsnFrPopupSideL */ {KAknsIIDQsnFrPopupSideL, ENoDraw, ES60_AllReleases, -1,-1},
+ /* SP_QsnFrPopupSideR */ {KAknsIIDQsnFrPopupSideR, ENoDraw, ES60_AllReleases, -1,-1},
+ /* SP_QsnFrPopupCenter */ {KAknsIIDQsnFrPopupCenter, ENoDraw, ES60_AllReleases, -1,-1},
+
+ // ToolTip graphics different in 3.1 vs. 3.2+.
+ /* SP_QsnFrPopupPreviewCornerTl */ {KAknsIIDQsnFrPopupCornerTl, ENoDraw, ES60_3_1, EAknsMajorSkin, 0x19c5}, /* KAknsIIDQsnFrPopupPreviewCornerTl */
+ /* SP_QsnFrPopupPreviewCornerTr */ {KAknsIIDQsnFrPopupCornerTr, ENoDraw, ES60_3_1, EAknsMajorSkin, 0x19c6},
+ /* SP_QsnFrPopupPreviewCornerBl */ {KAknsIIDQsnFrPopupCornerBl, ENoDraw, ES60_3_1, EAknsMajorSkin, 0x19c3},
+ /* SP_QsnFrPopupPreviewCornerBr */ {KAknsIIDQsnFrPopupCornerBr, ENoDraw, ES60_3_1, EAknsMajorSkin, 0x19c4},
+ /* SP_QsnFrPopupPreviewSideT */ {KAknsIIDQsnFrPopupSideT, ENoDraw, ES60_3_1, EAknsMajorSkin, 0x19ca},
+ /* SP_QsnFrPopupPreviewSideB */ {KAknsIIDQsnFrPopupSideB, ENoDraw, ES60_3_1, EAknsMajorSkin, 0x19c7},
+ /* SP_QsnFrPopupPreviewSideL */ {KAknsIIDQsnFrPopupSideL, ENoDraw, ES60_3_1, EAknsMajorSkin, 0x19c8},
+ /* SP_QsnFrPopupPreviewSideR */ {KAknsIIDQsnFrPopupSideR, ENoDraw, ES60_3_1, EAknsMajorSkin, 0x19c9},
+ /* SP_QsnFrPopupPreviewCenter */ {KAknsIIDQsnFrPopupCenter, ENoDraw, ES60_3_1, EAknsMajorSkin, 0x19c2},
+
+ /* SP_QsnFrSetOptCornerTl */ {KAknsIIDQsnFrSetOptCornerTl, ENoDraw, ES60_AllReleases, -1,-1},
+ /* SP_QsnFrSetOptCornerTr */ {KAknsIIDQsnFrSetOptCornerTr, ENoDraw, ES60_AllReleases, -1,-1},
+ /* SP_QsnFrSetOptCornerBl */ {KAknsIIDQsnFrSetOptCornerBl, ENoDraw, ES60_AllReleases, -1,-1},
+ /* SP_QsnFrSetOptCornerBr */ {KAknsIIDQsnFrSetOptCornerBr, ENoDraw, ES60_AllReleases, -1,-1},
+ /* SP_QsnFrSetOptSideT */ {KAknsIIDQsnFrSetOptSideT, ENoDraw, ES60_AllReleases, -1,-1},
+ /* SP_QsnFrSetOptSideB */ {KAknsIIDQsnFrSetOptSideB, ENoDraw, ES60_AllReleases, -1,-1},
+ /* SP_QsnFrSetOptSideL */ {KAknsIIDQsnFrSetOptSideL, ENoDraw, ES60_AllReleases, -1,-1},
+ /* SP_QsnFrSetOptSideR */ {KAknsIIDQsnFrSetOptSideR, ENoDraw, ES60_AllReleases, -1,-1},
+ /* SP_QsnFrSetOptCenter */ {KAknsIIDQsnFrSetOptCenter, ENoDraw, ES60_AllReleases, -1,-1},
+
+ // No toolbar frame for 5.0+ releases.
+ /* SP_QsnFrPopupSubCornerTl */ {KAknsIIDQsnFrPopupSubCornerTl, ENoDraw, ES60_3_1 | ES60_3_2, -1,-1},
+ /* SP_QsnFrPopupSubCornerTr */ {KAknsIIDQsnFrPopupSubCornerTr, ENoDraw, ES60_3_1 | ES60_3_2, -1,-1},
+ /* SP_QsnFrPopupSubCornerBl */ {KAknsIIDQsnFrPopupSubCornerBl, ENoDraw, ES60_3_1 | ES60_3_2, -1,-1},
+ /* SP_QsnFrPopupSubCornerBr */ {KAknsIIDQsnFrPopupSubCornerBr, ENoDraw, ES60_3_1 | ES60_3_2, -1,-1},
+ /* SP_QsnFrPopupSubSideT */ {KAknsIIDQsnFrPopupSubSideT, ENoDraw, ES60_3_1 | ES60_3_2, -1,-1},
+ /* SP_QsnFrPopupSubSideB */ {KAknsIIDQsnFrPopupSubSideB, ENoDraw, ES60_3_1 | ES60_3_2, -1,-1},
+ /* SP_QsnFrPopupSubSideL */ {KAknsIIDQsnFrPopupSubSideL, ENoDraw, ES60_3_1 | ES60_3_2, -1,-1},
+ /* SP_QsnFrPopupSubSideR */ {KAknsIIDQsnFrPopupSubSideR, ENoDraw, ES60_3_1 | ES60_3_2, -1,-1},
+ /* SP_QsnFrPopupSubCenter */ {KAknsIIDQsnFrPopupCenterSubmenu, ENoDraw, ES60_3_1 | ES60_3_2, -1,-1},
+
+ // Toolbar graphics is different in 3.1/3.2 vs. 5.0
+ /* SP_QsnFrSctrlButtonCornerTl */ {KAknsIIDQsnFrButtonTbCornerTl, ENoDraw, ES60_3_1 | ES60_3_2, EAknsMajorSkin, 0x2301}, /* KAknsIIDQgnFrSctrlButtonCornerTl*/
+ /* SP_QsnFrSctrlButtonCornerTr */ {KAknsIIDQsnFrButtonTbCornerTr, ENoDraw, ES60_3_1 | ES60_3_2, EAknsMajorSkin, 0x2302},
+ /* SP_QsnFrSctrlButtonCornerBl */ {KAknsIIDQsnFrButtonTbCornerBl, ENoDraw, ES60_3_1 | ES60_3_2, EAknsMajorSkin, 0x2303},
+ /* SP_QsnFrSctrlButtonCornerBr */ {KAknsIIDQsnFrButtonTbCornerBr, ENoDraw, ES60_3_1 | ES60_3_2, EAknsMajorSkin, 0x2304},
+ /* SP_QsnFrSctrlButtonSideT */ {KAknsIIDQsnFrButtonTbSideT, ENoDraw, ES60_3_1 | ES60_3_2, EAknsMajorSkin, 0x2305},
+ /* SP_QsnFrSctrlButtonSideB */ {KAknsIIDQsnFrButtonTbSideB, ENoDraw, ES60_3_1 | ES60_3_2, EAknsMajorSkin, 0x2306},
+ /* SP_QsnFrSctrlButtonSideL */ {KAknsIIDQsnFrButtonTbSideL, ENoDraw, ES60_3_1 | ES60_3_2, EAknsMajorSkin, 0x2307},
+ /* SP_QsnFrSctrlButtonSideR */ {KAknsIIDQsnFrButtonTbSideR, ENoDraw, ES60_3_1 | ES60_3_2, EAknsMajorSkin, 0x2308},
+ /* SP_QsnFrSctrlButtonCenter */ {KAknsIIDQsnFrButtonTbCenter, ENoDraw, ES60_3_1 | ES60_3_2, EAknsMajorSkin, 0x2309}, /*KAknsIIDQgnFrSctrlButtonCenter*/
+
+ // No pressed state for toolbar button in 3.1/3.2.
+ /* SP_QsnFrSctrlButtonCornerTlPressed */ {KAknsIIDQsnFrButtonTbCornerTl, ENoDraw, ES60_3_1 | ES60_3_2, EAknsMajorSkin, 0x2621}, /*KAknsIIDQsnFrSctrlButtonCornerTlPressed*/
+ /* SP_QsnFrSctrlButtonCornerTrPressed */ {KAknsIIDQsnFrButtonTbCornerTr, ENoDraw, ES60_3_1 | ES60_3_2, EAknsMajorSkin, 0x2622},
+ /* SP_QsnFrSctrlButtonCornerBlPressed */ {KAknsIIDQsnFrButtonTbCornerBl, ENoDraw, ES60_3_1 | ES60_3_2, EAknsMajorSkin, 0x2623},
+ /* SP_QsnFrSctrlButtonCornerBrPressed */ {KAknsIIDQsnFrButtonTbCornerBr, ENoDraw, ES60_3_1 | ES60_3_2, EAknsMajorSkin, 0x2624},
+ /* SP_QsnFrSctrlButtonSideTPressed */ {KAknsIIDQsnFrButtonTbSideT, ENoDraw, ES60_3_1 | ES60_3_2, EAknsMajorSkin, 0x2625},
+ /* SP_QsnFrSctrlButtonSideBPressed */ {KAknsIIDQsnFrButtonTbSideB, ENoDraw, ES60_3_1 | ES60_3_2, EAknsMajorSkin, 0x2626},
+ /* SP_QsnFrSctrlButtonSideLPressed */ {KAknsIIDQsnFrButtonTbSideL, ENoDraw, ES60_3_1 | ES60_3_2, EAknsMajorSkin, 0x2627},
+ /* SP_QsnFrSctrlButtonSideRPressed */ {KAknsIIDQsnFrButtonTbSideR, ENoDraw, ES60_3_1 | ES60_3_2, EAknsMajorSkin, 0x2628},
+ /* SP_QsnFrSctrlButtonCenterPressed */ {KAknsIIDQsnFrButtonTbCenter, ENoDraw, ES60_3_1 | ES60_3_2, EAknsMajorSkin, 0x2629},
+
+ // No inactive button graphics in 3.1/3.2
+ /* SP_QsnFrButtonCornerTlInactive */ {KAknsIIDQsnFrButtonTbCornerTl, ENoDraw, ES60_3_1 | ES60_3_2, EAknsMajorSkin, 0x21b1}, /*KAknsIIDQsnFrButtonCornerTlInactive*/
+ /* SP_QsnFrButtonCornerTrInactive */ {KAknsIIDQsnFrButtonTbCornerTr, ENoDraw, ES60_3_1 | ES60_3_2, EAknsMajorSkin, 0x21b2},
+ /* SP_QsnFrButtonCornerBlInactive */ {KAknsIIDQsnFrButtonTbCornerBl, ENoDraw, ES60_3_1 | ES60_3_2, EAknsMajorSkin, 0x21b3},
+ /* SP_QsnFrButtonCornerTrInactive */ {KAknsIIDQsnFrButtonTbCornerBr, ENoDraw, ES60_3_1 | ES60_3_2, EAknsMajorSkin, 0x21b4},
+ /* SP_QsnFrButtonSideTInactive */ {KAknsIIDQsnFrButtonTbSideT, ENoDraw, ES60_3_1 | ES60_3_2, EAknsMajorSkin, 0x21b5},
+ /* SP_QsnFrButtonSideBInactive */ {KAknsIIDQsnFrButtonTbSideB, ENoDraw, ES60_3_1 | ES60_3_2, EAknsMajorSkin, 0x21b6},
+ /* SP_QsnFrButtonSideLInactive */ {KAknsIIDQsnFrButtonTbSideL, ENoDraw, ES60_3_1 | ES60_3_2, EAknsMajorSkin, 0x21b7},
+ /* SP_QsnFrButtonSideRInactive */ {KAknsIIDQsnFrButtonTbSideR, ENoDraw, ES60_3_1 | ES60_3_2, EAknsMajorSkin, 0x21b8},
+ /* SP_QsnFrButtonCenterInactive */ {KAknsIIDQsnFrButtonTbCenter, EDrawIcon, ES60_3_1 | ES60_3_2, EAknsMajorSkin, 0x21b9},
+
+ /* SP_QsnFrNotepadCornerTl */ {KAknsIIDQsnFrNotepadContCornerTl, ENoDraw, ES60_AllReleases, -1,-1},
+ /* SP_QsnFrNotepadCornerTr */ {KAknsIIDQsnFrNotepadContCornerTr, ENoDraw, ES60_AllReleases, -1,-1},
+ /* SP_QsnFrNotepadCornerBl */ {KAknsIIDQsnFrNotepadCornerBl, ENoDraw, ES60_AllReleases, -1,-1},
+ /* SP_QsnFrNotepadCornerBr */ {KAknsIIDQsnFrNotepadCornerBr, ENoDraw, ES60_AllReleases, -1,-1},
+ /* SP_QsnFrNotepadSideT */ {KAknsIIDQsnFrNotepadContSideT, ENoDraw, ES60_AllReleases, -1,-1},
+ /* SP_QsnFrNotepadSideB */ {KAknsIIDQsnFrNotepadSideB, ENoDraw, ES60_AllReleases, -1,-1},
+ /* SP_QsnFrNotepadSideL */ {KAknsIIDQsnFrNotepadSideL, ENoDraw, ES60_AllReleases, -1,-1},
+ /* SP_QsnFrNotepadSideR */ {KAknsIIDQsnFrNotepadSideR, ENoDraw, ES60_AllReleases, -1,-1},
+ /* SP_QsnFrNotepadCenter */ {KAknsIIDQsnFrNotepadCenter, EDrawIcon, ES60_AllReleases, -1,-1},
+
+};
+
+QPixmap QS60StyleModeSpecifics::skinnedGraphics(
+ QS60StyleEnums::SkinParts stylepart, const QSize &size,
+ QS60StylePrivate::SkinElementFlags flags)
+{
+ QPixmap themedImage;
+ TRAPD( error, QT_TRYCATCH_LEAVING({
+ const QPixmap skinnedImage = createSkinnedGraphicsLX(stylepart, size, flags);
+ themedImage = skinnedImage;
+ }));
+ if (error)
+ return themedImage = QPixmap();
+ return themedImage;
+}
+
+QPixmap QS60StyleModeSpecifics::skinnedGraphics(
+ QS60StylePrivate::SkinFrameElements frame, const QSize &size, QS60StylePrivate::SkinElementFlags flags)
+{
+ QPixmap themedImage;
+ TRAPD( error, QT_TRYCATCH_LEAVING({
+ const QPixmap skinnedImage = createSkinnedGraphicsLX(frame, size, flags);
+ themedImage = skinnedImage;
+ }));
+ if (error)
+ return themedImage = QPixmap();
+ return themedImage;
+}
+
+QPixmap QS60StyleModeSpecifics::colorSkinnedGraphics(
+ const QS60StyleEnums::SkinParts &stylepart,
+ const QSize &size, QS60StylePrivate::SkinElementFlags flags)
+{
+ QPixmap colorGraphics;
+ TRAPD(error, QT_TRYCATCH_LEAVING(colorGraphics = colorSkinnedGraphicsLX(stylepart, size, flags)));
+ return error ? QPixmap() : colorGraphics;
+}
+
+void QS60StyleModeSpecifics::fallbackInfo(const QS60StyleEnums::SkinParts &stylepart, TDes& fallbackFileName, TInt& fallbackIndex)
+{
+ switch(stylepart) {
+ case QS60StyleEnums::SP_QgnGrafBarWait:
+ fallbackFileName = KAvkonBitmapFile();
+ fallbackIndex = EMbmAvkonQgn_graf_bar_wait_1;
+ break;
+ case QS60StyleEnums::SP_QgnGrafBarFrameCenter:
+ fallbackFileName = KAvkonBitmapFile();
+ fallbackIndex = EMbmAvkonQgn_graf_bar_frame_center;
+ break;
+ case QS60StyleEnums::SP_QgnGrafBarFrameSideL:
+ fallbackFileName = KAvkonBitmapFile();
+ fallbackIndex = EMbmAvkonQgn_graf_bar_frame_side_l;
+ break;
+ case QS60StyleEnums::SP_QgnGrafBarFrameSideR:
+ fallbackFileName = KAvkonBitmapFile();
+ fallbackIndex = EMbmAvkonQgn_graf_bar_frame_side_r;
+ break;
+ case QS60StyleEnums::SP_QgnGrafBarProgress:
+ fallbackFileName = KAvkonBitmapFile();
+ fallbackIndex = EMbmAvkonQgn_graf_bar_progress;
+ break;
+ case QS60StyleEnums::SP_QgnGrafTabActiveL:
+ fallbackFileName = KAvkonBitmapFile();
+ fallbackIndex = EMbmAvkonQgn_graf_tab_active_l;
+ break;
+ case QS60StyleEnums::SP_QgnGrafTabActiveM:
+ fallbackFileName = KAvkonBitmapFile();
+ fallbackIndex = EMbmAvkonQgn_graf_tab_active_m;
+ break;
+ case QS60StyleEnums::SP_QgnGrafTabActiveR:
+ fallbackFileName = KAvkonBitmapFile();
+ fallbackIndex = EMbmAvkonQgn_graf_tab_active_r;
+ break;
+ case QS60StyleEnums::SP_QgnGrafTabPassiveL:
+ fallbackFileName = KAvkonBitmapFile();
+ fallbackIndex = EMbmAvkonQgn_graf_tab_passive_l;
+ break;
+ case QS60StyleEnums::SP_QgnGrafTabPassiveM:
+ fallbackFileName = KAvkonBitmapFile();
+ fallbackIndex = EMbmAvkonQgn_graf_tab_passive_m;
+ break;
+ case QS60StyleEnums::SP_QgnGrafTabPassiveR:
+ fallbackFileName = KAvkonBitmapFile();
+ fallbackIndex = EMbmAvkonQgn_graf_tab_passive_r;
+ break;
+ case QS60StyleEnums::SP_QgnIndiCheckboxOff:
+ fallbackFileName = KAvkonBitmapFile();
+ fallbackIndex = EMbmAvkonQgn_indi_checkbox_off;
+ break;
+ case QS60StyleEnums::SP_QgnIndiCheckboxOn:
+ fallbackFileName = KAvkonBitmapFile();
+ fallbackIndex = EMbmAvkonQgn_indi_checkbox_on;
+ break;
+ case QS60StyleEnums::SP_QgnIndiHlColSuper:
+ fallbackFileName = KAvkonBitmapFile();
+ fallbackIndex = 0x4456; /* EMbmAvkonQgn_indi_hl_col_super */
+ break;
+ case QS60StyleEnums::SP_QgnIndiHlExpSuper:
+ fallbackFileName = KAvkonBitmapFile();
+ fallbackIndex = 0x4458; /* EMbmAvkonQgn_indi_hl_exp_super */
+ break;
+ case QS60StyleEnums::SP_QgnIndiHlLineBranch:
+ fallbackFileName = KAvkonBitmapFile();
+ fallbackIndex = 0x445A; /* EMbmAvkonQgn_indi_hl_line_branch */
+ break;
+ case QS60StyleEnums::SP_QgnIndiHlLineEnd:
+ fallbackFileName = KAvkonBitmapFile();
+ fallbackIndex = 0x445C; /* EMbmAvkonQgn_indi_hl_line_end */
+ break;
+ case QS60StyleEnums::SP_QgnIndiHlLineStraight:
+ fallbackFileName = KAvkonBitmapFile();
+ fallbackIndex = 0x445E; /* EMbmAvkonQgn_indi_hl_line_straight */
+ break;
+ case QS60StyleEnums::SP_QgnIndiMarkedAdd:
+ fallbackFileName = KAvkonBitmapFile();
+ fallbackIndex = EMbmAvkonQgn_indi_marked_add;
+ break;
+ case QS60StyleEnums::SP_QgnIndiNaviArrowLeft:
+ fallbackFileName = KAvkonBitmapFile();
+ fallbackIndex = EMbmAvkonQgn_indi_navi_arrow_left;
+ break;
+ case QS60StyleEnums::SP_QgnIndiNaviArrowRight:
+ fallbackFileName = KAvkonBitmapFile();
+ fallbackIndex = EMbmAvkonQgn_indi_navi_arrow_right;
+ break;
+ case QS60StyleEnums::SP_QgnIndiRadiobuttOff:
+ fallbackFileName = KAvkonBitmapFile();
+ fallbackIndex = EMbmAvkonQgn_indi_radiobutt_off;
+ break;
+ case QS60StyleEnums::SP_QgnIndiRadiobuttOn:
+ fallbackFileName = KAvkonBitmapFile();
+ fallbackIndex = EMbmAvkonQgn_indi_radiobutt_on;
+ break;
+ case QS60StyleEnums::SP_QgnIndiSliderEdit:
+ fallbackFileName = KAvkonBitmapFile();
+ fallbackIndex = EMbmAvkonQgn_indi_slider_edit;
+ break;
+ case QS60StyleEnums::SP_QgnIndiSubMenu:
+ fallbackFileName = KAvkonBitmapFile();
+ fallbackIndex = EMbmAvkonQgn_indi_submenu;
+ break;
+ case QS60StyleEnums::SP_QgnNoteErased:
+ fallbackFileName = KAvkonBitmapFile();
+ fallbackIndex = EMbmAvkonQgn_note_erased;
+ break;
+ case QS60StyleEnums::SP_QgnNoteError:
+ fallbackFileName = KAvkonBitmapFile();
+ fallbackIndex = EMbmAvkonQgn_note_error;
+ break;
+ case QS60StyleEnums::SP_QgnNoteInfo:
+ fallbackFileName = KAvkonBitmapFile();
+ fallbackIndex = EMbmAvkonQgn_note_info;
+ break;
+ case QS60StyleEnums::SP_QgnNoteOk:
+ fallbackFileName = KAvkonBitmapFile();
+ fallbackIndex = EMbmAvkonQgn_note_ok;
+ break;
+ case QS60StyleEnums::SP_QgnNoteQuery:
+ fallbackFileName = KAvkonBitmapFile();
+ fallbackIndex = EMbmAvkonQgn_note_query;
+ break;
+ case QS60StyleEnums::SP_QgnNoteWarning:
+ fallbackFileName = KAvkonBitmapFile();
+ fallbackIndex = EMbmAvkonQgn_note_warning;
+ break;
+ case QS60StyleEnums::SP_QgnPropFileSmall:
+ fallbackFileName = KAvkonBitmapFile();
+ fallbackIndex = EMbmAvkonQgn_prop_file_small;
+ break;
+ case QS60StyleEnums::SP_QgnPropFolderCurrent:
+ fallbackFileName = KAvkonBitmapFile();
+ fallbackIndex = EMbmAvkonQgn_prop_folder_current;
+ break;
+ case QS60StyleEnums::SP_QgnPropFolderSmall:
+ fallbackFileName = KAvkonBitmapFile();
+ fallbackIndex = EMbmAvkonQgn_prop_folder_small;
+ break;
+ case QS60StyleEnums::SP_QgnPropFolderSmallNew:
+ fallbackFileName = KAvkonBitmapFile();
+ fallbackIndex = EMbmAvkonQgn_prop_folder_small_new;
+ break;
+ case QS60StyleEnums::SP_QgnPropPhoneMemcLarge:
+ fallbackFileName = KAvkonBitmapFile();
+ fallbackIndex = EMbmAvkonQgn_prop_phone_memc_large;
+ break;
+ default:
+ fallbackFileName = KNullDesC();
+ fallbackIndex = -1;
+ break;
+ }
+}
+
+QPixmap QS60StyleModeSpecifics::colorSkinnedGraphicsLX(
+ const QS60StyleEnums::SkinParts &stylepart,
+ const QSize &size, QS60StylePrivate::SkinElementFlags flags)
+{
+ // this function can throw both exceptions and leaves. There are no cleanup dependencies between Qt and Symbian parts.
+ const int stylepartIndex = (int)stylepart;
+ const TAknsItemID skinId = m_partMap[stylepartIndex].skinID;
+
+ TInt fallbackGraphicID = -1;
+ HBufC* iconFile = HBufC::NewLC( KMaxFileName );
+ TPtr fileNamePtr = iconFile->Des();
+ fallbackInfo(stylepart, fileNamePtr, fallbackGraphicID);
+
+ TAknsItemID colorGroup = KAknsIIDQsnIconColors;
+ int colorIndex = 0;
+ colorGroupAndIndex(stylepart, colorGroup, colorIndex);
+
+ const bool rotatedBy90or270 =
+ (flags & (QS60StylePrivate::SF_PointEast | QS60StylePrivate::SF_PointWest));
+ const TSize targetSize =
+ rotatedBy90or270?TSize(size.height(), size.width()):TSize(size.width(), size.height());
+ CFbsBitmap *icon = 0;
+ CFbsBitmap *iconMask = 0;
+ const TInt fallbackGraphicsMaskID =
+ fallbackGraphicID == KErrNotFound?KErrNotFound:fallbackGraphicID+1; //masks are auto-generated as next in mif files
+ MAknsSkinInstance* skinInstance = AknsUtils::SkinInstance();
+ AknsUtils::CreateColorIconLC(
+ skinInstance, skinId, colorGroup, colorIndex, icon, iconMask, fileNamePtr, fallbackGraphicID , fallbackGraphicsMaskID, KRgbBlack);
+ User::LeaveIfError(AknIconUtils::SetSize(icon, targetSize, EAspectRatioNotPreserved));
+ User::LeaveIfError(AknIconUtils::SetSize(iconMask, targetSize, EAspectRatioNotPreserved));
+ QPixmap result = fromFbsBitmap(icon, iconMask, flags, qt_TDisplayMode2Format(icon->DisplayMode()));
+ CleanupStack::PopAndDestroy(3); //icon, iconMask, iconFile
+ return result;
+}
+
+QColor QS60StyleModeSpecifics::colorValue(const TAknsItemID &colorGroup, int colorIndex)
+{
+ TRgb skinnedColor;
+ MAknsSkinInstance* skin = AknsUtils::SkinInstance();
+ AknsUtils::GetCachedColor(skin, skinnedColor, colorGroup, colorIndex);
+ return QColor(skinnedColor.Red(),skinnedColor.Green(),skinnedColor.Blue());
+}
+
+struct QAutoFbsBitmapHeapLock
+{
+ QAutoFbsBitmapHeapLock(CFbsBitmap* aBmp) : mBmp(aBmp) { mBmp->LockHeap(); }
+ ~QAutoFbsBitmapHeapLock() { mBmp->UnlockHeap(); }
+ CFbsBitmap* mBmp;
+};
+
+QPixmap QS60StyleModeSpecifics::fromFbsBitmap(CFbsBitmap *icon, CFbsBitmap *mask, QS60StylePrivate::SkinElementFlags flags, QImage::Format format)
+{
+ Q_ASSERT(icon);
+ const TSize iconSize = icon->SizeInPixels();
+ const int iconBytesPerLine = CFbsBitmap::ScanLineLength(iconSize.iWidth, icon->DisplayMode());
+ const int iconBytesCount = iconBytesPerLine * iconSize.iHeight;
+
+ QImage iconImage(qt_TSize2QSize(iconSize), format);
+ if (iconImage.isNull())
+ return QPixmap();
+
+ checkAndUnCompressBitmap(icon);
+ if (!icon) //checkAndUnCompressBitmap might set icon to NULL
+ return QPixmap();
+
+ icon->LockHeap();
+ const uchar *const iconBytes = (uchar*)icon->DataAddress();
+ // The icon data needs to be copied, since the color format will be
+ // automatically converted to Format_ARGB32 when setAlphaChannel is called.
+ memcpy(iconImage.bits(), iconBytes, iconBytesCount);
+ icon->UnlockHeap();
+ if (mask) {
+ checkAndUnCompressBitmap(mask);
+ if (mask) { //checkAndUnCompressBitmap might set mask to NULL
+ const TSize maskSize = icon->SizeInPixels();
+ const int maskBytesPerLine = CFbsBitmap::ScanLineLength(maskSize.iWidth, mask->DisplayMode());
+ // heap lock object required because QImage ctor might throw
+ QAutoFbsBitmapHeapLock maskHeapLock(mask);
+ const uchar *const maskBytes = (uchar *)mask->DataAddress();
+ // Since no other bitmap should be locked, we can just "borrow" the mask data for setAlphaChannel
+ const QImage maskImage(maskBytes, maskSize.iWidth, maskSize.iHeight, maskBytesPerLine, QImage::Format_Indexed8);
+ if (!maskImage.isNull())
+ iconImage.setAlphaChannel(maskImage);
+ }
+ }
+
+ QTransform imageTransform;
+ if (flags & QS60StylePrivate::SF_PointEast) {
+ imageTransform.rotate(90);
+ } else if (flags & QS60StylePrivate::SF_PointSouth) {
+ imageTransform.rotate(180);
+ iconImage = iconImage.transformed(imageTransform);
+ } else if (flags & QS60StylePrivate::SF_PointWest) {
+ imageTransform.rotate(270);
+ }
+ if (imageTransform.isRotating())
+ iconImage = iconImage.transformed(imageTransform);
+
+ return QPixmap::fromImage(iconImage);
+}
+
+bool QS60StylePrivate::isTouchSupported()
+{
+ return bool(AknLayoutUtils::PenEnabled());
+}
+
+bool QS60StylePrivate::isToolBarBackground()
+{
+ return (QSysInfo::s60Version() == QSysInfo::SV_S60_3_1 || QSysInfo::s60Version() == QSysInfo::SV_S60_3_2);
+}
+
+QPoint qt_s60_fill_background_offset(const QWidget *targetWidget)
+{
+ CCoeControl *control = targetWidget->effectiveWinId();
+ TPoint globalPos = control ? control->PositionRelativeToScreen() : TPoint(0,0);
+ return QPoint(globalPos.iX, globalPos.iY);
+}
+
+QPixmap QS60StyleModeSpecifics::createSkinnedGraphicsLX(
+ QS60StyleEnums::SkinParts part,
+ const QSize &size, QS60StylePrivate::SkinElementFlags flags)
+{
+ // this function can throw both exceptions and leaves. There are no cleanup dependencies between Qt and Symbian parts.
+ if (!size.isValid())
+ return QPixmap();
+
+ // Check release support and change part, if necessary.
+ const TAknsItemID skinId = checkAndUpdateReleaseSpecificGraphics((int)part);
+ const int stylepartIndex = (int)part;
+ const TDrawType drawType = m_partMap[stylepartIndex].drawType;
+ Q_ASSERT(drawType != ENoDraw);
+ const bool rotatedBy90or270 =
+ (flags & (QS60StylePrivate::SF_PointEast | QS60StylePrivate::SF_PointWest));
+ const TSize targetSize =
+ rotatedBy90or270 ? TSize(size.height(), size.width()) : qt_QSize2TSize(size);
+
+ MAknsSkinInstance* skinInstance = AknsUtils::SkinInstance();
+
+ QPixmap result;
+
+ switch (drawType) {
+ case EDrawIcon: {
+ TInt fallbackGraphicID = -1;
+ HBufC* iconFile = HBufC::NewLC( KMaxFileName );
+ TPtr fileNamePtr = iconFile->Des();
+ fallbackInfo(part, fileNamePtr, fallbackGraphicID);
+ // todo: could we instead use AknIconUtils::AvkonIconFileName(); to avoid allocating each time?
+
+ CFbsBitmap *icon = 0;
+ CFbsBitmap *iconMask = 0;
+ const TInt fallbackGraphicsMaskID =
+ fallbackGraphicID == KErrNotFound?KErrNotFound:fallbackGraphicID+1; //masks are auto-generated as next in mif files
+ // QS60WindowSurface::unlockBitmapHeap();
+ AknsUtils::CreateIconLC(skinInstance, skinId, icon, iconMask, fileNamePtr, fallbackGraphicID , fallbackGraphicsMaskID);
+ User::LeaveIfError(AknIconUtils::SetSize(icon, targetSize, EAspectRatioNotPreserved));
+ User::LeaveIfError(AknIconUtils::SetSize(iconMask, targetSize, EAspectRatioNotPreserved));
+ result = fromFbsBitmap(icon, iconMask, flags, qt_TDisplayMode2Format(icon->DisplayMode()));
+ CleanupStack::PopAndDestroy(3); // iconMask, icon, iconFile
+ // QS60WindowSurface::lockBitmapHeap();
+ break;
+ }
+ case EDrawBackground: {
+ // QS60WindowSurface::unlockBitmapHeap();
+ CFbsBitmap *background = new (ELeave) CFbsBitmap(); //offscreen
+ CleanupStack::PushL(background);
+ User::LeaveIfError(background->Create(targetSize, EColor16MA));
+
+ CFbsBitmapDevice* dev = CFbsBitmapDevice::NewL(background);
+ CleanupStack::PushL(dev);
+ CFbsBitGc* gc = NULL;
+ User::LeaveIfError(dev->CreateContext(gc));
+ CleanupStack::PushL(gc);
+
+ CAknsBasicBackgroundControlContext* bgContext = CAknsBasicBackgroundControlContext::NewL(
+ skinId,
+ targetSize,
+ EFalse);
+ CleanupStack::PushL(bgContext);
+
+ const TBool drawn = AknsDrawUtils::DrawBackground(
+ skinInstance,
+ bgContext,
+ NULL,
+ *gc,
+ TPoint(),
+ targetSize,
+ KAknsDrawParamDefault | KAknsDrawParamRGBOnly);
+
+ if (drawn)
+ result = fromFbsBitmap(background, NULL, flags, QImage::Format_RGB32);
+
+ CleanupStack::PopAndDestroy(4, background); //background, dev, gc, bgContext
+ // QS60WindowSurface::lockBitmapHeap();
+ break;
+ }
+ }
+
+ return result;
+}
+
+QPixmap QS60StyleModeSpecifics::createSkinnedGraphicsLX(QS60StylePrivate::SkinFrameElements frameElement,
+ const QSize &size, QS60StylePrivate::SkinElementFlags flags)
+{
+ // this function can throw both exceptions and leaves. There are no cleanup dependencies between Qt and Symbian parts.
+ if (!size.isValid())
+ return QPixmap();
+
+ const bool rotatedBy90or270 =
+ (flags & (QS60StylePrivate::SF_PointEast | QS60StylePrivate::SF_PointWest));
+ const TSize targetSize =
+ rotatedBy90or270 ? TSize(size.height(), size.width()) : qt_QSize2TSize(size);
+
+ MAknsSkinInstance* skinInstance = AknsUtils::SkinInstance();
+ QPixmap result;
+
+// QS60WindowSurface::unlockBitmapHeap();
+ static const bool canDoEColor16MAP = !(QSysInfo::s60Version() == QSysInfo::SV_S60_3_1 || QSysInfo::s60Version() == QSysInfo::SV_S60_3_2);
+ static const TDisplayMode displayMode = canDoEColor16MAP ? TDisplayMode(13) : EColor16MA; // 13 = EColor16MAP
+ static const TInt drawParam = canDoEColor16MAP ? KAknsDrawParamDefault : KAknsDrawParamNoClearUnderImage|KAknsDrawParamRGBOnly;
+
+ CFbsBitmap *frame = new (ELeave) CFbsBitmap(); //offscreen
+ CleanupStack::PushL(frame);
+ User::LeaveIfError(frame->Create(targetSize, displayMode));
+
+ CFbsBitmapDevice* bitmapDev = CFbsBitmapDevice::NewL(frame);
+ CleanupStack::PushL(bitmapDev);
+ CFbsBitGc* bitmapGc = NULL;
+ User::LeaveIfError(bitmapDev->CreateContext(bitmapGc));
+ CleanupStack::PushL(bitmapGc);
+
+ frame->LockHeap();
+ memset(frame->DataAddress(), 0, frame->SizeInPixels().iWidth * frame->SizeInPixels().iHeight * 4); // 4: argb bytes
+ frame->UnlockHeap();
+
+ const TRect outerRect(TPoint(0, 0), targetSize);
+ const TRect innerRect = innerRectFromElement(frameElement, outerRect);
+
+ TAknsItemID frameSkinID, centerSkinID;
+ frameSkinID = centerSkinID = checkAndUpdateReleaseSpecificGraphics(QS60StylePrivate::m_frameElementsData[frameElement].center);
+ frameIdAndCenterId(frameElement, frameSkinID, centerSkinID);
+ const TBool drawn = AknsDrawUtils::DrawFrame( skinInstance,
+ *bitmapGc, outerRect, innerRect,
+ frameSkinID, centerSkinID,
+ drawParam );
+
+ if (canDoEColor16MAP) {
+ if (drawn)
+ result = fromFbsBitmap(frame, NULL, flags, QImage::Format_ARGB32_Premultiplied);
+ } else {
+ TDisplayMode maskDepth = EGray2;
+ // Query the skin item for possible frame graphics mask details.
+ if (skinInstance) {
+ CAknsMaskedBitmapItemData* skinMaskedBmp = static_cast<CAknsMaskedBitmapItemData*>(
+ skinInstance->GetCachedItemData(frameSkinID,EAknsITMaskedBitmap));
+ if (skinMaskedBmp && skinMaskedBmp->Mask())
+ maskDepth = skinMaskedBmp->Mask()->DisplayMode();
+ }
+ if (maskDepth != ENone) {
+ CFbsBitmap *frameMask = new (ELeave) CFbsBitmap(); //offscreen
+ CleanupStack::PushL(frameMask);
+ User::LeaveIfError(frameMask->Create(targetSize, maskDepth));
+
+ CFbsBitmapDevice* maskBitmapDevice = CFbsBitmapDevice::NewL(frameMask);
+ CleanupStack::PushL(maskBitmapDevice);
+ CFbsBitGc* maskBitGc = NULL;
+ User::LeaveIfError(maskBitmapDevice->CreateContext(maskBitGc));
+ CleanupStack::PushL(maskBitGc);
+
+ if (drawn) {
+ //ensure that the mask is really transparent
+ maskBitGc->Activate( maskBitmapDevice );
+ maskBitGc->SetPenStyle(CGraphicsContext::ENullPen);
+ maskBitGc->SetBrushStyle(CGraphicsContext::ESolidBrush);
+ maskBitGc->SetBrushColor(KRgbWhite);
+ maskBitGc->Clear();
+ maskBitGc->SetBrushStyle(CGraphicsContext::ENullBrush);
+
+ AknsDrawUtils::DrawFrame(skinInstance,
+ *maskBitGc, outerRect, innerRect,
+ frameSkinID, centerSkinID,
+ KAknsSDMAlphaOnly |KAknsDrawParamNoClearUnderImage);
+ result = fromFbsBitmap(frame, frameMask, flags, QImage::Format_ARGB32);
+ }
+ CleanupStack::PopAndDestroy(3, frameMask);
+ }
+ }
+ CleanupStack::PopAndDestroy(3, frame); //frame, bitmapDev, bitmapGc
+ return result;
+}
+
+void QS60StyleModeSpecifics::frameIdAndCenterId(QS60StylePrivate::SkinFrameElements frameElement, TAknsItemID &frameId, TAknsItemID &centerId)
+{
+// There are some major mix-ups in skin declarations for some frames.
+// First, the frames are not declared in sequence.
+// Second, the parts use different major than the frame-master.
+
+ switch(frameElement) {
+ case QS60StylePrivate::SF_ToolTip:
+ if (QSysInfo::s60Version()!=QSysInfo::SV_S60_3_1) {
+ centerId.Set(EAknsMajorGeneric, 0x19c2);
+ frameId.Set(EAknsMajorSkin, 0x5300);
+ } else {
+ centerId.Set(KAknsIIDQsnFrPopupCenter);
+ frameId.iMinor = centerId.iMinor - 9;
+ }
+ break;
+ case QS60StylePrivate::SF_ToolBar:
+ if (QSysInfo::s60Version()==QSysInfo::SV_S60_3_1 || QSysInfo::s60Version()==QSysInfo::SV_S60_3_2) {
+ centerId.Set(KAknsIIDQsnFrPopupCenterSubmenu);
+ frameId.Set(KAknsIIDQsnFrPopupSub);
+ }
+ break;
+ case QS60StylePrivate::SF_PanelBackground:
+ // remove center piece for panel graphics, so that only border is drawn
+ centerId.Set(KAknsIIDNone);
+ frameId.Set(KAknsIIDQsnFrSetOpt);
+ break;
+ case QS60StylePrivate::SF_Editor:
+ centerId.Set(KAknsIIDQsnFrNotepadCenter);
+ frameId.Set(KAknsIIDQsnFrNotepadCont);
+ break;
+ default:
+ // center should be correct here
+ frameId.iMinor = centerId.iMinor - 9;
+ break;
+ }
+}
+
+TRect QS60StyleModeSpecifics::innerRectFromElement(QS60StylePrivate::SkinFrameElements frameElement, const TRect &outerRect)
+{
+ TInt widthShrink = QS60StylePrivate::pixelMetric(PM_Custom_FrameCornerWidth);
+ TInt heightShrink = QS60StylePrivate::pixelMetric(PM_Custom_FrameCornerHeight);
+ switch(frameElement) {
+ case QS60StylePrivate::SF_PanelBackground:
+ // panel should have slightly slimmer border to enable thin line of background graphics between closest component
+ widthShrink = widthShrink-2;
+ heightShrink = heightShrink-2;
+ break;
+ case QS60StylePrivate::SF_ToolTip:
+ widthShrink = widthShrink>>1;
+ heightShrink = heightShrink>>1;
+ break;
+ case QS60StylePrivate::SF_ListHighlight:
+ widthShrink = widthShrink-2;
+ heightShrink = heightShrink-2;
+ break;
+ default:
+ break;
+ }
+ TRect innerRect(outerRect);
+ innerRect.Shrink(widthShrink, heightShrink);
+ return innerRect;
+}
+
+bool QS60StyleModeSpecifics::checkSupport(const int supportedRelease)
+{
+ const QSysInfo::S60Version currentRelease = QSysInfo::s60Version();
+ return ( (currentRelease == QSysInfo::SV_S60_3_1 && supportedRelease & ES60_3_1) ||
+ (currentRelease == QSysInfo::SV_S60_3_2 && supportedRelease & ES60_3_2) ||
+ (currentRelease == QSysInfo::SV_S60_5_0 && supportedRelease & ES60_5_0));
+}
+
+TAknsItemID QS60StyleModeSpecifics::checkAndUpdateReleaseSpecificGraphics(int part)
+{
+ TAknsItemID newSkinId;
+ if (!checkSupport(m_partMap[(int)part].supportInfo))
+ newSkinId.Set(m_partMap[(int)part].newMajorSkinId, m_partMap[(int)part].newMinorSkinId);
+ else
+ newSkinId.Set(m_partMap[(int)part].skinID);
+ return newSkinId;
+}
+
+void QS60StyleModeSpecifics::checkAndUnCompressBitmap(CFbsBitmap*& aOriginalBitmap)
+{
+ TRAPD(error, checkAndUnCompressBitmapL(aOriginalBitmap));
+ if (error)
+ aOriginalBitmap = NULL;
+}
+
+void QS60StyleModeSpecifics::checkAndUnCompressBitmapL(CFbsBitmap*& aOriginalBitmap)
+{
+ const TSize iconSize = aOriginalBitmap->SizeInPixels();
+ const int iconBytesPerLine = CFbsBitmap::ScanLineLength(iconSize.iWidth, aOriginalBitmap->DisplayMode());
+ const int iconBytesCount = iconBytesPerLine * iconSize.iHeight;
+ if (aOriginalBitmap->IsCompressedInRAM() || aOriginalBitmap->Header().iBitmapSize < iconBytesCount) {
+ const TSize iconSize(aOriginalBitmap->SizeInPixels().iWidth,
+ aOriginalBitmap->SizeInPixels().iHeight);
+ CFbsBitmap* uncompressedBitmap = new (ELeave) CFbsBitmap();
+ CleanupStack::PushL(uncompressedBitmap);
+ User::LeaveIfError(uncompressedBitmap->Create(iconSize,
+ aOriginalBitmap->DisplayMode()));
+ unCompressBitmapL(iconSize, uncompressedBitmap, aOriginalBitmap);
+ CleanupStack::Pop(uncompressedBitmap);
+ User::LeaveIfError(aOriginalBitmap->Duplicate(
+ uncompressedBitmap->Handle()));
+ delete uncompressedBitmap;
+ }
+}
+
+QFont QS60StylePrivate::s60Font_specific(
+ QS60StyleEnums::FontCategories fontCategory, int pointSize)
+{
+ TAknFontCategory aknFontCategory = EAknFontCategoryUndefined;
+ switch (fontCategory) {
+ case QS60StyleEnums::FC_Primary:
+ aknFontCategory = EAknFontCategoryPrimary;
+ break;
+ case QS60StyleEnums::FC_Secondary:
+ aknFontCategory = EAknFontCategorySecondary;
+ break;
+ case QS60StyleEnums::FC_Title:
+ aknFontCategory = EAknFontCategoryTitle;
+ break;
+ case QS60StyleEnums::FC_PrimarySmall:
+ aknFontCategory = EAknFontCategoryPrimarySmall;
+ break;
+ case QS60StyleEnums::FC_Digital:
+ aknFontCategory = EAknFontCategoryDigital;
+ break;
+ case QS60StyleEnums::FC_Undefined:
+ default:
+ break;
+ }
+
+ // Create AVKON font according the given parameters
+ CWsScreenDevice* dev = CCoeEnv::Static()->ScreenDevice();
+ TAknFontSpecification spec(aknFontCategory, TFontSpec(), NULL);
+ if (pointSize > 0) {
+ const TInt pixelSize = dev->VerticalTwipsToPixels(pointSize * KTwipsPerPoint);
+ spec.SetTextPaneHeight(pixelSize + 4); // TODO: Is 4 a reasonable top+bottom margin?
+ }
+
+ QFont result;
+ TRAPD( error, QT_TRYCATCH_LEAVING({
+ const CAknLayoutFont* aknFont =
+ AknFontAccess::CreateLayoutFontFromSpecificationL(*dev, spec);
+
+ result = qt_TFontSpec2QFontL(aknFont->DoFontSpecInTwips());
+ if (result.pointSize() != pointSize)
+ result.setPointSize(pointSize); // Correct the font size returned by CreateLayoutFontFromSpecificationL()
+
+ delete aknFont;
+ }));
+ if (error) result = QFont();
+ return result;
+}
+
+void QS60StylePrivate::setActiveLayout()
+{
+ const QSize activeScreenSize(screenSize());
+ int activeLayoutIndex = -1;
+ const bool mirrored = !QApplication::isLeftToRight();
+ const short screenHeight = (short)activeScreenSize.height();
+ const short screenWidth = (short)activeScreenSize.width();
+ for (int i=0; i<m_numberOfLayouts; i++) {
+ if (screenHeight==m_layoutHeaders[i].height &&
+ screenWidth==m_layoutHeaders[i].width &&
+ mirrored==m_layoutHeaders[i].mirroring) {
+ activeLayoutIndex = i;
+ break;
+ }
+ }
+
+ //not found, lets try without mirroring info
+ if (activeLayoutIndex==-1){
+ for (int i=0; i<m_numberOfLayouts; i++) {
+ if (screenHeight==m_layoutHeaders[i].height &&
+ screenWidth==m_layoutHeaders[i].width) {
+ activeLayoutIndex = i;
+ break;
+ }
+ }
+ }
+
+ //not found, lets try with either of dimensions
+ if (activeLayoutIndex==-1){
+ const QSysInfo::S60Version currentRelease = QSysInfo::s60Version();
+ const bool landscape = screenHeight < screenWidth;
+
+ activeLayoutIndex = (currentRelease == QSysInfo::SV_S60_3_1 || currentRelease == QSysInfo::SV_S60_3_2) ? 0 : 4;
+ activeLayoutIndex += (!landscape) ? 2 : 0;
+ activeLayoutIndex += (!mirrored) ? 1 : 0;
+ }
+
+ m_pmPointer = data[activeLayoutIndex];
+}
+
+QS60StylePrivate::QS60StylePrivate()
+{
+ // No need to set active layout, if dynamic metrics API is available
+ setActiveLayout();
+}
+
+void QS60StylePrivate::setStyleProperty_specific(const char *name, const QVariant &value)
+{
+ if (name == QLatin1String("foo")) {
+ // BaR
+ } else {
+ setStyleProperty(name, value);
+ }
+}
+
+QVariant QS60StylePrivate::styleProperty_specific(const char *name) const
+{
+ if (name == QLatin1String("foo"))
+ return QLatin1String("Bar");
+ else
+ return styleProperty(name);
+}
+
+QColor QS60StylePrivate::s60Color(QS60StyleEnums::ColorLists list,
+ int index, const QStyleOption *option)
+{
+ static const TAknsItemID *idMap[] = {
+ &KAknsIIDQsnHighlightColors,
+ &KAknsIIDQsnIconColors,
+ &KAknsIIDQsnLineColors,
+ &KAknsIIDQsnOtherColors,
+ &KAknsIIDQsnParentColors,
+ &KAknsIIDQsnTextColors
+ };
+ Q_ASSERT((int)list <= (int)sizeof(idMap)/sizeof(idMap[0]));
+ const QColor color = QS60StyleModeSpecifics::colorValue(*idMap[(int) list], index - 1);
+ return option ? QS60StylePrivate::stateColor(color, option) : color;
+}
+
+// In some cases, the AVKON UI themegraphic is already in 'disabled state'.
+// If so, return true for these parts.
+bool QS60StyleModeSpecifics::disabledPartGraphic(QS60StyleEnums::SkinParts &part)
+{
+ bool disabledGraphic = false;
+ switch(part){
+ // inactive button graphics are available from 5.0 onwards
+ case QS60StyleEnums::SP_QsnFrButtonCornerTlInactive:
+ case QS60StyleEnums::SP_QsnFrButtonCornerTrInactive:
+ case QS60StyleEnums::SP_QsnFrButtonCornerBlInactive:
+ case QS60StyleEnums::SP_QsnFrButtonCornerBrInactive:
+ case QS60StyleEnums::SP_QsnFrButtonSideTInactive:
+ case QS60StyleEnums::SP_QsnFrButtonSideBInactive:
+ case QS60StyleEnums::SP_QsnFrButtonSideLInactive:
+ case QS60StyleEnums::SP_QsnFrButtonSideRInactive:
+ case QS60StyleEnums::SP_QsnFrButtonCenterInactive:
+ if (!(QSysInfo::s60Version()==QSysInfo::SV_S60_3_1 ||
+ QSysInfo::s60Version()==QSysInfo::SV_S60_3_2))
+ disabledGraphic = true;
+ break;
+ default:
+ break;
+ }
+ return disabledGraphic;
+}
+
+// In some cases, the AVKON UI themegraphic is already in 'disabled state'.
+// If so, return true for these frames.
+bool QS60StyleModeSpecifics::disabledFrameGraphic(QS60StylePrivate::SkinFrameElements &frame)
+{
+ bool disabledGraphic = false;
+ switch(frame){
+ // inactive button graphics are available from 5.0 onwards
+ case QS60StylePrivate::SF_ButtonInactive:
+ if (!(QSysInfo::s60Version()==QSysInfo::SV_S60_3_1 ||
+ QSysInfo::s60Version()==QSysInfo::SV_S60_3_2))
+ disabledGraphic = true;
+ break;
+ default:
+ break;
+ }
+ return disabledGraphic;
+}
+
+QPixmap QS60StyleModeSpecifics::generateMissingThemeGraphic(QS60StyleEnums::SkinParts &part,
+ const QSize &size, QS60StylePrivate::SkinElementFlags flags)
+{
+ if (!QS60StylePrivate::isTouchSupported())
+ return QPixmap();
+
+ QS60StyleEnums::SkinParts updatedPart = part;
+ switch(part){
+ // AVKON UI has a abnormal handling for scrollbar graphics. It is possible that the root
+ // skin does not contain mandatory graphics for scrollbar pressed states. Therefore, AVKON UI
+ // creates dynamically these graphics by modifying the normal state scrollbar graphics slightly.
+ // S60Style needs to work similarly. Therefore if skingraphics call provides to be a miss
+ // (i.e. result is not valid), style needs to draw normal graphics instead and apply some
+ // modifications (similar to generatedIconPixmap()) to the result.
+ case QS60StyleEnums::SP_QsnCpScrollHandleBottomPressed:
+ updatedPart = QS60StyleEnums::SP_QsnCpScrollHandleBottom;
+ break;
+ case QS60StyleEnums::SP_QsnCpScrollHandleMiddlePressed:
+ updatedPart = QS60StyleEnums::SP_QsnCpScrollHandleMiddle;
+ break;
+ case QS60StyleEnums::SP_QsnCpScrollHandleTopPressed:
+ updatedPart = QS60StyleEnums::SP_QsnCpScrollHandleTop;
+ break;
+ default:
+ break;
+ }
+ if (part==updatedPart) {
+ return QPixmap();
+ } else {
+ QPixmap result = skinnedGraphics(updatedPart, size, flags);
+ QStyleOption opt;
+ QPalette *themePalette = QS60StylePrivate::themePalette();
+ if (themePalette)
+ opt.palette = *themePalette;
+
+ // For now, always generate new icon based on "selected". In the future possibly, expand
+ // this to consist other possibilities as well.
+ result = QApplication::style()->generatedIconPixmap(QIcon::Selected, result, &opt);
+ return result;
+ }
+}
+
+QPixmap QS60StylePrivate::part(QS60StyleEnums::SkinParts part,
+ const QSize &size, SkinElementFlags flags)
+{
+ QS60WindowSurface::unlockBitmapHeap();
+ QPixmap result = (flags & SF_ColorSkinned)?
+ QS60StyleModeSpecifics::colorSkinnedGraphics(part, size, flags)
+ : QS60StyleModeSpecifics::skinnedGraphics(part, size, flags);
+ QS60WindowSurface::lockBitmapHeap();
+
+ if (flags & SF_StateDisabled && !QS60StyleModeSpecifics::disabledPartGraphic(part)) {
+ QStyleOption opt;
+ QPalette *themePalette = QS60StylePrivate::themePalette();
+ if (themePalette)
+ opt.palette = *themePalette;
+ result = QApplication::style()->generatedIconPixmap(QIcon::Disabled, result, &opt);
+ }
+
+ if (!result)
+ result = QS60StyleModeSpecifics::generateMissingThemeGraphic(part, size, flags);
+
+ return result;
+}
+
+QPixmap QS60StylePrivate::frame(SkinFrameElements frame, const QSize &size, SkinElementFlags flags)
+{
+ QS60WindowSurface::unlockBitmapHeap();
+ QPixmap result = QS60StyleModeSpecifics::skinnedGraphics(frame, size, flags);
+ QS60WindowSurface::lockBitmapHeap();
+
+ if (flags & SF_StateDisabled && !QS60StyleModeSpecifics::disabledFrameGraphic(frame)) {
+ QStyleOption opt;
+ QPalette *themePalette = QS60StylePrivate::themePalette();
+ if (themePalette)
+ opt.palette = *themePalette;
+ result = QApplication::style()->generatedIconPixmap(QIcon::Disabled, result, &opt);
+ }
+ return result;
+}
+
+QPixmap QS60StylePrivate::backgroundTexture()
+{
+ if (!m_background) {
+ QPixmap background = part(QS60StyleEnums::SP_QsnBgScreen,
+ QSize(S60->screenWidthInPixels, S60->screenHeightInPixels), SkinElementFlags());
+ m_background = new QPixmap(background);
+ }
+ return *m_background;
+}
+
+// If the public SDK returns compressed images, please let us also uncompress those!
+void QS60StyleModeSpecifics::unCompressBitmapL(const TRect& aTrgRect, CFbsBitmap* aTrgBitmap, CFbsBitmap* aSrcBitmap)
+{
+ if (!aSrcBitmap)
+ User::Leave(KErrArgument);
+ if (!aTrgBitmap)
+ User::Leave(KErrArgument);
+
+ // Note! aSrcBitmap->IsCompressedInRAM() is always ETrue, since this method is called only if that applies!
+ // Extra note! this function is also being used when bitmaps appear to be compressed (because DataSize is too small)
+ // even when they pretend they are not. Assert removed.
+// ASSERT(aSrcBitmap->IsCompressedInRAM());
+
+ TDisplayMode displayMode = aSrcBitmap->DisplayMode();
+
+ if (displayMode != aTrgBitmap->DisplayMode())
+ User::Leave(KErrArgument);
+
+ const TSize trgSize = aTrgBitmap->SizeInPixels();
+ const TSize srcSize = aSrcBitmap->SizeInPixels();
+
+ // calculate the valid drawing area
+ TRect drawRect = aTrgRect;
+ drawRect.Intersection(TRect(TPoint(0, 0), trgSize));
+
+ if (drawRect.IsEmpty())
+ return;
+
+ CFbsBitmap* realSource = new (ELeave) CFbsBitmap();
+ CleanupStack::PushL(realSource);
+ User::LeaveIfError(realSource->Create(srcSize, displayMode));
+ CFbsBitmapDevice* dev = CFbsBitmapDevice::NewL(realSource);
+ CleanupStack::PushL(dev);
+ CFbsBitGc* gc = NULL;
+ User::LeaveIfError(dev->CreateContext(gc));
+ CleanupStack::PushL(gc);
+ gc->BitBlt(TPoint(0, 0), aSrcBitmap);
+ CleanupStack::PopAndDestroy(2); // dev, gc
+
+ // Heap lock for FBServ large chunk is only needed with large bitmaps.
+ if (realSource->IsLargeBitmap() || aTrgBitmap->IsLargeBitmap()) {
+ aTrgBitmap->LockHeapLC(ETrue); // fbsheaplock
+ } else {
+ CleanupStack::PushL((TAny*) NULL);
+ }
+
+ TUint32* srcAddress = realSource->DataAddress();
+ TUint32* trgAddress = aTrgBitmap->DataAddress();
+
+ const TInt xSkip = (srcSize.iWidth << 8) / aTrgRect.Width();
+ const TInt ySkip = (srcSize.iHeight << 8) / aTrgRect.Height();
+
+ const TInt drawWidth = drawRect.Width();
+ const TInt drawHeight = drawRect.Height();
+
+ const TRect offsetRect(aTrgRect.iTl, drawRect.iTl);
+ const TInt yPosOffset = ySkip * offsetRect.Height();
+ const TInt xPosOffset = xSkip * offsetRect.Width();
+
+ if ((displayMode == EGray256) || (displayMode == EColor256)) {
+ const TInt srcScanLen8 = CFbsBitmap::ScanLineLength(srcSize.iWidth,
+ displayMode);
+ const TInt trgScanLen8 = CFbsBitmap::ScanLineLength(trgSize.iWidth,
+ displayMode);
+
+ TUint8* trgAddress8 = reinterpret_cast<TUint8*> (trgAddress);
+
+ TInt yPos = yPosOffset;
+ // skip left and top margins in the beginning
+ trgAddress8 += trgScanLen8 * drawRect.iTl.iY + drawRect.iTl.iX;
+
+ for (TInt y = 0; y < drawHeight; y++) {
+ const TUint8* srcAddress8 = reinterpret_cast<const TUint8*> (srcAddress)
+ + (srcScanLen8 * (yPos >> 8));
+
+ TInt xPos = xPosOffset;
+ for (TInt x = 0; x < drawWidth; x++) {
+ *(trgAddress8++) = srcAddress8[xPos >> 8];
+ xPos += xSkip;
+ }
+
+ yPos += ySkip;
+
+ trgAddress8 += trgScanLen8 - drawWidth;
+ }
+ } else if (displayMode == EColor4K || displayMode == EColor64K) {
+ const TInt srcScanLen16 = CFbsBitmap::ScanLineLength(srcSize.iWidth,
+ displayMode) >>1;
+ const TInt trgScanLen16 = CFbsBitmap::ScanLineLength(trgSize.iWidth,
+ displayMode) >>1;
+
+ TUint16* trgAddress16 = reinterpret_cast<TUint16*> (trgAddress);
+
+ TInt yPos = yPosOffset;
+ // skip left and top margins in the beginning
+ trgAddress16 += trgScanLen16 * drawRect.iTl.iY + drawRect.iTl.iX;
+
+ for (TInt y = 0; y < drawHeight; y++) {
+ const TUint16* srcAddress16 = reinterpret_cast<const TUint16*> (srcAddress)
+ + (srcScanLen16 * (yPos >> 8));
+
+ TInt xPos = xPosOffset;
+ for (TInt x = 0; x < drawWidth; x++) {
+ *(trgAddress16++) = srcAddress16[xPos >> 8];
+ xPos += xSkip;
+ }
+
+ yPos += ySkip;
+
+ trgAddress16 += trgScanLen16 - drawWidth;
+ }
+ } else if (displayMode == EColor16MU || displayMode == EColor16MA) {
+ const TInt srcScanLen32 = CFbsBitmap::ScanLineLength(srcSize.iWidth,
+ displayMode) >>2;
+ const TInt trgScanLen32 = CFbsBitmap::ScanLineLength(trgSize.iWidth,
+ displayMode) >>2;
+
+ TUint32* trgAddress32 = reinterpret_cast<TUint32*> (trgAddress);
+
+ TInt yPos = yPosOffset;
+ // skip left and top margins in the beginning
+ trgAddress32 += trgScanLen32 * drawRect.iTl.iY + drawRect.iTl.iX;
+
+ for (TInt y = 0; y < drawHeight; y++) {
+ const TUint32* srcAddress32 = reinterpret_cast<const TUint32*> (srcAddress)
+ + (srcScanLen32 * (yPos >> 8));
+
+ TInt xPos = xPosOffset;
+ for (TInt x = 0; x < drawWidth; x++) {
+ *(trgAddress32++) = srcAddress32[xPos >> 8];
+ xPos += xSkip;
+ }
+
+ yPos += ySkip;
+
+ trgAddress32 += trgScanLen32 - drawWidth;
+ }
+ } else { User::Leave(KErrUnknown);}
+
+ CleanupStack::PopAndDestroy(2); // fbsheaplock, realSource
+}
+
+QSize QS60StylePrivate::screenSize()
+{
+ const TSize screenSize = QS60Data::screenDevice()->SizeInPixels();
+ return QSize(screenSize.iWidth, screenSize.iHeight);
+}
+
+void QS60StyleModeSpecifics::colorGroupAndIndex(
+ QS60StyleEnums::SkinParts skinID, TAknsItemID &colorGroup, int colorIndex)
+{
+ switch(skinID) {
+ case QS60StyleEnums::SP_QgnIndiSubMenu:
+ colorGroup = KAknsIIDQsnIconColors;
+ colorIndex = EAknsCIQsnIconColorsCG1;
+ break;
+ case QS60StyleEnums::SP_QgnIndiRadiobuttOff:
+ case QS60StyleEnums::SP_QgnIndiRadiobuttOn:
+ case QS60StyleEnums::SP_QgnIndiCheckboxOff:
+ case QS60StyleEnums::SP_QgnIndiCheckboxOn:
+ colorGroup = KAknsIIDQsnIconColors;
+ colorIndex = EAknsCIQsnIconColorsCG14;
+ break;
+ default:
+ break;
+ }
+}
+
+QS60Style::QS60Style()
+ : QCommonStyle(*new QS60StylePrivate)
+{
+}
+
+#ifdef Q_WS_S60
+void QS60StylePrivate::handleDynamicLayoutVariantSwitch()
+{
+ clearCaches(QS60StylePrivate::CC_LayoutChange);
+ setActiveLayout();
+ refreshUI();
+ setBackgroundTexture(qApp);
+ foreach (QWidget *widget, QApplication::allWidgets())
+ widget->ensurePolished();
+}
+
+void QS60StylePrivate::handleSkinChange()
+{
+ clearCaches(QS60StylePrivate::CC_ThemeChange);
+ setThemePalette(qApp);
+ foreach (QWidget *topLevelWidget, QApplication::allWidgets()){
+ QEvent e(QEvent::StyleChange);
+ QApplication::sendEvent(topLevelWidget, &e);
+ setThemePalette(topLevelWidget);
+ topLevelWidget->ensurePolished();
+ }
+}
+#endif // Q_WS_S60
+
+QT_END_NAMESPACE
+
+#endif // QT_NO_STYLE_S60 || QT_PLUGIN
diff --git a/src/gui/styles/qs60style_simulated.cpp b/src/gui/styles/qs60style_simulated.cpp
new file mode 100644
index 0000000..ead7d46
--- /dev/null
+++ b/src/gui/styles/qs60style_simulated.cpp
@@ -0,0 +1,448 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the QtGui of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.1, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qs60style.h"
+#include "qs60style_p.h"
+#include "qfile.h"
+#include "qhash.h"
+#include "qapplication.h"
+#include "qpainter.h"
+#include "qpicture.h"
+#include "qstyleoption.h"
+#include "qtransform.h"
+#include "qlayout.h"
+#include "qpixmapcache.h"
+#include "qmetaobject.h"
+#include "qdebug.h"
+#include "qbuffer.h"
+#include "qdesktopwidget.h"
+
+#if !defined(QT_NO_STYLE_S60) || defined(QT_PLUGIN)
+
+QT_BEGIN_NAMESPACE
+
+static const quint32 blobVersion = 1;
+static const int pictureSize = 256;
+
+#if defined(Q_CC_GNU)
+#if __GNUC__ >= 2
+#define __FUNCTION__ __func__
+#endif
+#endif
+
+
+bool saveThemeToBlob(const QString &themeBlob,
+ const QHash<QString, QPicture> &partPictures,
+ const QHash<QPair<QString, int>, QColor> &colors)
+{
+ QFile blob(themeBlob);
+ if (!blob.open(QIODevice::WriteOnly)) {
+ qWarning() << __FUNCTION__ << ": Could not create blob: " << themeBlob;
+ return false;
+ }
+
+ QByteArray data;
+ QBuffer dataBuffer(&data);
+ dataBuffer.open(QIODevice::WriteOnly);
+ QDataStream dataOut(&dataBuffer);
+
+ const int colorsCount = colors.count();
+ dataOut << colorsCount;
+ const QList<QPair<QString, int> > colorKeys = colors.keys();
+ for (int i = 0; i < colorsCount; ++i) {
+ const QPair<QString, int> &key = colorKeys.at(i);
+ dataOut << key;
+ const QColor color = colors.value(key);
+ dataOut << color;
+ }
+
+ const int picturesCount = partPictures.count();
+ dataOut << picturesCount;
+ foreach (const QString &key, partPictures.keys()) {
+ const QPicture picture = partPictures.value(key);
+ dataOut << key;
+ dataOut << picture;
+ }
+
+ QDataStream blobOut(&blob);
+ blobOut << blobVersion;
+ blobOut << qCompress(data);
+ return blobOut.status() == QDataStream::Ok;
+}
+
+bool loadThemeFromBlob(const QString &themeBlob,
+ QHash<QString, QPicture> &partPictures,
+ QHash<QPair<QString, int>, QColor> &colors)
+{
+ QFile blob(themeBlob);
+ if (!blob.open(QIODevice::ReadOnly)) {
+ qWarning() << __FUNCTION__ << ": Could not read blob: " << themeBlob;
+ return false;
+ }
+ QDataStream blobIn(&blob);
+
+ quint32 version;
+ blobIn >> version;
+
+ if (version != blobVersion) {
+ qWarning() << __FUNCTION__ << ": Invalid blob version: " << version << " ...expected: " << blobVersion;
+ return false;
+ }
+
+ QByteArray data;
+ blobIn >> data;
+ data = qUncompress(data);
+ QBuffer dataBuffer(&data);
+ dataBuffer.open(QIODevice::ReadOnly);
+ QDataStream dataIn(&dataBuffer);
+
+ int colorsCount;
+ dataIn >> colorsCount;
+ for (int i = 0; i < colorsCount; ++i) {
+ QPair<QString, int> key;
+ dataIn >> key;
+ QColor value;
+ dataIn >> value;
+ colors.insert(key, value);
+ }
+
+ int picturesCount;
+ dataIn >> picturesCount;
+ for (int i = 0; i < picturesCount; ++i) {
+ QString key;
+ dataIn >> key;
+ QPicture value;
+ dataIn >> value;
+ value.setBoundingRect(QRect(0, 0, pictureSize, pictureSize)); // Bug? The forced bounding rect was not deserialized.
+ partPictures.insert(key, value);
+ }
+
+ if (dataIn.status() != QDataStream::Ok) {
+ qWarning() << __FUNCTION__ << ": Invalid data blob: " << themeBlob;
+ return false;
+ }
+ return true;
+}
+
+class QS60StyleModeSpecifics
+{
+public:
+ static QPixmap skinnedGraphics(QS60StyleEnums::SkinParts stylepart,
+ const QSize &size, QS60StylePrivate::SkinElementFlags flags);
+ static QHash<QString, QPicture> m_partPictures;
+ static QHash<QPair<QString , int>, QColor> m_colors;
+};
+QHash<QString, QPicture> QS60StyleModeSpecifics::m_partPictures;
+QHash<QPair<QString , int>, QColor> QS60StyleModeSpecifics::m_colors;
+
+QS60StylePrivate::QS60StylePrivate()
+{
+ setCurrentLayout(0);
+}
+
+QColor QS60StylePrivate::s60Color(QS60StyleEnums::ColorLists list,
+ int index, const QStyleOption *option)
+{
+ const QString listKey = QS60Style::colorListKeys().at(list);
+ return QS60StylePrivate::stateColor(
+ QS60StyleModeSpecifics::m_colors.value(QPair<QString, int>(listKey, index)),
+ option
+ );
+}
+
+QPixmap QS60StylePrivate::part(QS60StyleEnums::SkinParts part, const QSize &size,
+ QS60StylePrivate::SkinElementFlags flags)
+{
+ const QString partKey = QS60Style::partKeys().at(part);
+ const QPicture partPicture = QS60StyleModeSpecifics::m_partPictures.value(partKey);
+ QSize partSize(partPicture.boundingRect().size());
+ if (flags & (SF_PointEast | SF_PointWest)) {
+ const int temp = partSize.width();
+ partSize.setWidth(partSize.height());
+ partSize.setHeight(temp);
+ }
+ const qreal scaleX = size.width() / (qreal)partSize.width();
+ const qreal scaleY = size.height() / (qreal)partSize.height();
+
+ QImage partImage(size, QImage::Format_ARGB32);
+ partImage.fill(Qt::transparent);
+ QPainter resultPainter(&partImage);
+ QTransform t;
+
+ if (flags & SF_PointEast)
+ t.translate(size.width(), 0);
+ else if (flags & SF_PointSouth)
+ t.translate(size.width(), size.height());
+ else if (flags & SF_PointWest)
+ t.translate(0, size.height());
+
+ t.scale(scaleX, scaleY);
+
+ if (flags & SF_PointEast)
+ t.rotate(90);
+ else if (flags & SF_PointSouth)
+ t.rotate(180);
+ else if (flags & SF_PointWest)
+ t.rotate(270);
+
+ resultPainter.setTransform(t, true);
+ const_cast<QPicture *>(&partPicture)->play(&resultPainter);
+ resultPainter.end();
+
+ QPixmap result = QPixmap::fromImage(partImage);
+ if (flags & SF_StateDisabled) {
+ QStyleOption opt;
+ QPalette *themePalette = QS60StylePrivate::themePalette();
+ if (themePalette)
+ opt.palette = *themePalette;
+ result = QApplication::style()->generatedIconPixmap(QIcon::Disabled, result, &opt);
+ }
+
+ return result;
+}
+
+QPixmap QS60StylePrivate::frame(SkinFrameElements frame, const QSize &size,
+ SkinElementFlags flags)
+{
+ const QS60StyleEnums::SkinParts center = m_frameElementsData[frame].center;
+ const QS60StyleEnums::SkinParts topLeft = QS60StyleEnums::SkinParts(center - 8);
+ const QS60StyleEnums::SkinParts topRight = QS60StyleEnums::SkinParts(center - 7);
+ const QS60StyleEnums::SkinParts bottomLeft = QS60StyleEnums::SkinParts(center - 6);
+ const QS60StyleEnums::SkinParts bottomRight = QS60StyleEnums::SkinParts(center - 5);
+ const QS60StyleEnums::SkinParts top = QS60StyleEnums::SkinParts(center - 4);
+ const QS60StyleEnums::SkinParts bottom = QS60StyleEnums::SkinParts(center - 3);
+ const QS60StyleEnums::SkinParts left = QS60StyleEnums::SkinParts(center - 2);
+ const QS60StyleEnums::SkinParts right = QS60StyleEnums::SkinParts(center - 1);
+
+ // The size of topLeft defines all other sizes
+ const QSize cornerSize(partSize(topLeft));
+ // if frame is so small that corners would cover it completely, draw only center piece
+ const bool drawOnlyCenter =
+ 2 * cornerSize.width() + 1 >= size.width() || 2 * cornerSize.height() + 1 >= size.height();
+
+ const int cornerWidth = cornerSize.width();
+ const int cornerHeight = cornerSize.height();
+ const int rectWidth = size.width();
+ const int rectHeight = size.height();
+ const QRect rect(QPoint(), size);
+
+ const QRect topLeftRect = QRect(rect.topLeft(), cornerSize);
+ const QRect topRect = rect.adjusted(cornerWidth, 0, -cornerWidth, -(rectHeight - cornerHeight));
+ const QRect topRightRect = topLeftRect.translated(rectWidth - cornerWidth, 0);
+ const QRect rightRect = rect.adjusted(rectWidth - cornerWidth, cornerHeight, 0, -cornerHeight);
+ const QRect bottomRightRect = topRightRect.translated(0, rectHeight - cornerHeight);
+ const QRect bottomRect = topRect.translated(0, rectHeight - cornerHeight);
+ const QRect bottomLeftRect = topLeftRect.translated(0, rectHeight - cornerHeight);
+ const QRect leftRect = rightRect.translated(cornerWidth - rectWidth, 0);
+ const QRect centerRect = drawOnlyCenter ? rect : rect.adjusted(cornerWidth, cornerWidth, -cornerWidth, -cornerWidth);
+
+ QPixmap result(size);
+ result.fill(Qt::transparent);
+ QPainter painter(&result);
+
+#if 0
+ painter.save();
+ painter.setOpacity(.3);
+ painter.fillRect(topLeftRect, Qt::red);
+ painter.fillRect(topRect, Qt::green);
+ painter.fillRect(topRightRect, Qt::blue);
+ painter.fillRect(rightRect, Qt::green);
+ painter.fillRect(bottomRightRect, Qt::red);
+ painter.fillRect(bottomRect, Qt::blue);
+ painter.fillRect(bottomLeftRect, Qt::green);
+ painter.fillRect(leftRect, Qt::blue);
+ painter.fillRect(centerRect, Qt::red);
+ painter.restore();
+#else
+ drawPart(topLeft, &painter, topLeftRect, flags);
+ drawPart(top, &painter, topRect, flags);
+ drawPart(topRight, &painter, topRightRect, flags);
+ drawPart(right, &painter, rightRect, flags);
+ drawPart(bottomRight, &painter, bottomRightRect, flags);
+ drawPart(bottom, &painter, bottomRect, flags);
+ drawPart(bottomLeft, &painter, bottomLeftRect, flags);
+ drawPart(left, &painter, leftRect, flags);
+ drawPart(center, &painter, centerRect, flags);
+#endif
+
+ return result;
+}
+
+void QS60StylePrivate::setStyleProperty_specific(const char *name, const QVariant &value)
+{
+ setStyleProperty(name, value);
+}
+
+QVariant QS60StylePrivate::styleProperty_specific(const char *name) const
+{
+ return styleProperty(name);
+}
+
+QPixmap QS60StylePrivate::backgroundTexture()
+{
+ if (!m_background) {
+ const QSize size = QApplication::desktop()->screen()->size();
+ QPixmap background = part(QS60StyleEnums::SP_QsnBgScreen, size);
+ m_background = new QPixmap(background);
+ }
+ return *m_background;
+}
+
+
+bool QS60StylePrivate::isTouchSupported()
+{
+#ifdef QT_KEYPAD_NAVIGATION
+ return !QApplication::keypadNavigationEnabled();
+#else
+ return true;
+#endif
+}
+
+bool QS60StylePrivate::isToolBarBackground()
+{
+ return true;
+}
+
+QFont QS60StylePrivate::s60Font_specific(QS60StyleEnums::FontCategories fontCategory, int pointSize)
+{
+ QFont result;
+ result.setPointSize(pointSize);
+ switch (fontCategory) {
+ case QS60StyleEnums::FC_Primary:
+ result.setBold(true);
+ break;
+ case QS60StyleEnums::FC_Secondary:
+ case QS60StyleEnums::FC_Title:
+ case QS60StyleEnums::FC_PrimarySmall:
+ case QS60StyleEnums::FC_Digital:
+ case QS60StyleEnums::FC_Undefined:
+ default:
+ break;
+ }
+ return result;
+}
+
+/*!
+ Constructs a QS60Style object.
+*/
+QS60Style::QS60Style()
+ : QCommonStyle(*new QS60StylePrivate)
+{
+ const QString defaultBlob = QString::fromLatin1(":/trolltech/styles/s60style/images/defaults60theme.blob");
+ if (QFile::exists(defaultBlob))
+ loadS60ThemeFromBlob(defaultBlob);
+}
+
+Q_GLOBAL_STATIC_WITH_INITIALIZER(QStringList, enumPartKeys, {
+ const int enumIndex = QS60StyleEnums::staticMetaObject.indexOfEnumerator("SkinParts");
+ Q_ASSERT(enumIndex >= 0);
+ const QMetaEnum metaEnum = QS60StyleEnums::staticMetaObject.enumerator(enumIndex);
+ for (int i = 0; i < metaEnum.keyCount(); ++i) {
+ const QString enumKey = QString::fromLatin1(metaEnum.key(i));
+ QString partKey;
+ // Following loop does following conversions: "SP_QgnNoteInfo" to "qgn_note_info"...
+ for (int charPosition = 3; charPosition < enumKey.length(); charPosition++) {
+ if (charPosition > 3 && enumKey[charPosition].isUpper())
+ partKey.append(QChar::fromLatin1('_'));
+ partKey.append(enumKey[charPosition].toLower());
+ }
+ x->append(partKey);
+ }
+})
+
+QStringList QS60Style::partKeys()
+{
+ return *enumPartKeys();
+}
+
+Q_GLOBAL_STATIC_WITH_INITIALIZER(QStringList, enumColorListKeys, {
+ const int enumIndex = QS60StyleEnums::staticMetaObject.indexOfEnumerator("ColorLists");
+ Q_ASSERT(enumIndex >= 0);
+ const QMetaEnum metaEnum = QS60StyleEnums::staticMetaObject.enumerator(enumIndex);
+ for (int i = 0; i < metaEnum.keyCount(); i++) {
+ const QString enumKey = QString::fromLatin1(metaEnum.key(i));
+ // Following line does following conversions: CL_QsnTextColors to "text"...
+ x->append(enumKey.mid(6, enumKey.length() - 12).toLower());
+ }
+})
+
+QStringList QS60Style::colorListKeys()
+{
+ return *enumColorListKeys();
+}
+
+void QS60Style::setS60Theme(const QHash<QString, QPicture> &parts,
+ const QHash<QPair<QString , int>, QColor> &colors)
+{
+ Q_D(QS60Style);
+ QS60StyleModeSpecifics::m_partPictures = parts;
+ QS60StyleModeSpecifics::m_colors = colors;
+ d->clearCaches(QS60StylePrivate::CC_ThemeChange);
+ d->setBackgroundTexture(qApp);
+ d->setThemePalette(qApp);
+}
+
+bool QS60Style::loadS60ThemeFromBlob(const QString &blobFile)
+{
+ QHash<QString, QPicture> partPictures;
+ QHash<QPair<QString, int>, QColor> colors;
+
+ if (!loadThemeFromBlob(blobFile, partPictures, colors))
+ return false;
+ setS60Theme(partPictures, colors);
+ return true;
+}
+
+bool QS60Style::saveS60ThemeToBlob(const QString &blobFile) const
+{
+ return saveThemeToBlob(blobFile,
+ QS60StyleModeSpecifics::m_partPictures, QS60StyleModeSpecifics::m_colors);
+}
+
+QPoint qt_s60_fill_background_offset(const QWidget *targetWidget)
+{
+ Q_UNUSED(targetWidget)
+ return QPoint();
+}
+
+QT_END_NAMESPACE
+
+#endif // QT_NO_STYLE_S60 || QT_PLUGIN
diff --git a/src/gui/styles/qstyle.cpp b/src/gui/styles/qstyle.cpp
index 6520cf3..a5d524c 100644
--- a/src/gui/styles/qstyle.cpp
+++ b/src/gui/styles/qstyle.cpp
@@ -1,7 +1,6 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the QtGui module of the Qt Toolkit.
@@ -21,9 +20,10 @@
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.1, included in the file LGPL_EXCEPTION.txt in this
+** package.
**
** If you have questions regarding the use of this file, please contact
** Nokia at qt-info@nokia.com.
@@ -168,12 +168,21 @@ static int unpackControlTypes(QSizePolicy::ControlTypes controls, QSizePolicy::C
\section1 Creating a Custom Style
- If you want to design a custom look and feel for your application,
- the first step is to pick one of the styles provided with Qt to
- build your custom style from. The choice will depend on which
- existing style resembles your style the most. The most general
- class that you can use as base is QCommonStyle (and not QStyle).
- This is because Qt requires its styles to be \l{QCommonStyle}s.
+ You can create a custom look and feel for your application by
+ creating a custom style. There are two approaches to creating a
+ custom style. In the static approach, you either choose an
+ existing QStyle class, subclass it, and reimplement virtual
+ functions to provide the custom behavior, or you create an entire
+ QStyle class from scratch. In the dynamic approach, you modify the
+ behavior of your system style at runtime. The static approach is
+ described below. The dynamic approach is described in QProxyStyle.
+
+ The first step in the static approach is to pick one of the styles
+ provided by Qt from which you will build your custom style. Your
+ choice of QStyle class will depend on which style resembles your
+ desired style the most. The most general class that you can use as
+ a base is QCommonStyle (not QStyle). This is because Qt requires
+ its styles to be \l{QCommonStyle}s.
Depending on which parts of the base style you want to change,
you must reimplement the functions that are used to draw those
@@ -222,7 +231,7 @@ static int unpackControlTypes(QSizePolicy::ControlTypes controls, QSizePolicy::C
\section1 Using a Custom Style
There are several ways of using a custom style in a Qt
- application. The simplest way is call the
+ application. The simplest way is to pass the custom style to the
QApplication::setStyle() static function before creating the
QApplication object:
@@ -232,8 +241,8 @@ static int unpackControlTypes(QSizePolicy::ControlTypes controls, QSizePolicy::C
it before the constructor, you ensure that the user's preference,
set using the \c -style command-line option, is respected.
- You may want to make your style available for use in other
- applications, some of which may not be yours and are not available for
+ You may want to make your custom style available for use in other
+ applications, which may not be yours and hence not available for
you to recompile. The Qt Plugin system makes it possible to create
styles as plugins. Styles created as plugins are loaded as shared
objects at runtime by Qt itself. Please refer to the \link
@@ -325,9 +334,10 @@ static int unpackControlTypes(QSizePolicy::ControlTypes controls, QSizePolicy::C
QStyle::QStyle()
: QObject(*new QStylePrivate)
{
+ Q_D(QStyle);
+ d->proxyStyle = this;
}
-
/*!
\internal
@@ -336,6 +346,8 @@ QStyle::QStyle()
QStyle::QStyle(QStylePrivate &dd)
: QObject(dd)
{
+ Q_D(QStyle);
+ d->proxyStyle = this;
}
/*!
@@ -514,8 +526,9 @@ void QStyle::drawItemText(QPainter *painter, const QRect &rect, int alignment, c
}
if (!enabled) {
if (styleHint(SH_DitherDisabledText)) {
- painter->drawText(rect, alignment, text);
- painter->fillRect(painter->boundingRect(rect, alignment, text), QBrush(painter->background().color(), Qt::Dense5Pattern));
+ QRect br;
+ painter->drawText(rect, alignment, text, &br);
+ painter->fillRect(br, QBrush(painter->background().color(), Qt::Dense5Pattern));
return;
} else if (styleHint(SH_EtchDisabledText)) {
QPen pen = painter->pen();
@@ -551,7 +564,7 @@ void QStyle::drawItemPixmap(QPainter *painter, const QRect &rect, int alignment,
/*!
\enum QStyle::PrimitiveElement
- This enum describes that various primitive elements. A
+ This enum describes the various primitive elements. A
primitive element is a common GUI element, such as a checkbox
indicator or button bevel.
@@ -1048,6 +1061,8 @@ void QStyle::drawItemPixmap(QPainter *painter, const QRect &rect, int alignment,
\value SE_TabBarTabRightButton Area for a widget on the right side of a tab in a tab bar.
\value SE_TabBarTabText Area for the text on a tab in a tab bar.
+ \value SE_ToolBarHandle Area for the handle of a tool bar.
+
\sa subElementRect()
*/
@@ -1093,7 +1108,7 @@ void QStyle::drawItemPixmap(QPainter *painter, const QRect &rect, int alignment,
\value CC_ScrollBar A scroll bar, like QScrollBar.
\value CC_Slider A slider, like QSlider.
\value CC_ToolButton A tool button, like QToolButton.
- \value CC_TitleBar A Title bar, like those used in QWorkspace.
+ \value CC_TitleBar A Title bar, like those used in QMdiSubWindow.
\value CC_Q3ListView Used for drawing the Q3ListView class.
\value CC_GroupBox A group box, like QGroupBox.
\value CC_Dial A dial, like QDial.
@@ -1177,6 +1192,7 @@ void QStyle::drawItemPixmap(QPainter *painter, const QRect &rect, int alignment,
\value SC_All Special value that matches all sub-controls.
\omitvalue SC_Q3ListViewBranch
+ \omitvalue SC_CustomBase
\sa ComplexControl
*/
@@ -1330,7 +1346,7 @@ void QStyle::drawItemPixmap(QPainter *painter, const QRect &rect, int alignment,
\value PM_LayoutVerticalSpacing Default \l{QLayout::spacing}{vertical spacing} for a QLayout.
\value PM_MaximumDragDistance The maximum allowed distance between
- the mouse and a slider when dragging. Exceeding the specified
+ the mouse and a scrollbar when dragging. Exceeding the specified
distance will cause the slider to jump back to the original
position; a value of -1 disables this behavior.
@@ -1570,6 +1586,20 @@ void QStyle::drawItemPixmap(QPainter *painter, const QRect &rect, int alignment,
*/
/*!
+ \enum QStyle::RequestSoftwareInputPanel
+
+ This enum describes under what circumstances a software input panel will be
+ requested by input capable widgets.
+
+ \value RSIP_OnMouseClickAndAlreadyFocused Requests an input panel if the user
+ clicks on the widget, but only if it is already focused.
+ \value RSIP_OnMouseClick Requests an input panel if the user clicks on the
+ widget.
+
+ \sa QEvent::RequestSoftwareInputPanel, QInputContext
+*/
+
+/*!
\enum QStyle::StyleHint
This enum describes the available style hints. A style hint is a general look
@@ -1850,6 +1880,11 @@ void QStyle::drawItemPixmap(QPainter *painter, const QRect &rect, int alignment,
\value SH_DockWidget_ButtonsHaveFrame Determines if dockwidget buttons should have frames. Default is true.
+ \value SH_ToolButtonStyle Determines the default system style for tool buttons that uses Qt::ToolButtonFollowStyle.
+
+ \value SH_RequestSoftwareInputPanel Determines when a software input panel should
+ be requested by input widgets. Returns an enum of type QStyle::RequestSoftwareInputPanel.
+
\omitvalue SH_UnderlineAccelerator
\sa styleHint()
@@ -1862,11 +1897,9 @@ void QStyle::drawItemPixmap(QPainter *painter, const QRect &rect, int alignment,
Returns an integer representing the specified style \a hint for
the given \a widget described by the provided style \a option.
- Note that currently, the \a returnData and \a widget parameters
- are not used; they are provided for future enhancement. In
- addition, the \a option parameter is used only in case of the
- SH_ComboBox_Popup, SH_ComboBox_LayoutDirection, and
- SH_GroupBox_TextLabelColor style hints.
+ \a returnData is used when the querying widget needs more detailed data than
+ the integer that styleHint() returns. See the QStyleHintReturn class
+ description for details.
*/
/*!
@@ -1876,7 +1909,7 @@ void QStyle::drawItemPixmap(QPainter *painter, const QRect &rect, int alignment,
can follow some existing GUI style or guideline.
\value SP_TitleBarMinButton Minimize button on title bars (e.g.,
- in QWorkspace).
+ in QMdiSubWindow).
\value SP_TitleBarMenuButton Menu button on a title bar.
\value SP_TitleBarMaxButton Maximize button on title bars.
\value SP_TitleBarCloseButton Close button on title bars.
@@ -1948,22 +1981,7 @@ void QStyle::drawItemPixmap(QPainter *painter, const QRect &rect, int alignment,
\value SP_CustomBase Base value for custom standard pixmaps;
custom values must be greater than this value.
- \sa standardPixmap() standardIcon()
-*/
-
-/*###
- \enum QStyle::IconMode
-
- This enum represents the effects performed on a pixmap to achieve a
- GUI style's perferred way of representing the image in different
- states.
-
- \value IM_Disabled A disabled pixmap (drawn on disabled widgets)
- \value IM_Active An active pixmap (drawn on active tool buttons and menu items)
- \value IM_CustomBase Base value for custom PixmapTypes; custom
- values must be greater than this value
-
- \sa generatedIconPixmap()
+ \sa standardIcon()
*/
/*!
@@ -2246,7 +2264,7 @@ QPalette QStyle::standardPalette() const
slot in your subclass instead. The standardIcon() function will
dynamically detect the slot and call it.
- \sa standardIconImplementation(), standardPixmap()
+ \sa standardIconImplementation()
*/
QIcon QStyle::standardIcon(StandardPixmap standardIcon, const QStyleOption *option,
const QWidget *widget) const
@@ -2271,8 +2289,7 @@ QIcon QStyle::standardIcon(StandardPixmap standardIcon, const QStyleOption *opti
subclass; because of binary compatibility constraints, the
standardIcon() function (introduced in Qt 4.1) is not
virtual. Instead, standardIcon() will dynamically detect and call
- \e this slot. The default implementation simply calls the
- standardPixmap() function with the given parameters.
+ \e this slot.
The \a standardIcon is a standard pixmap which can follow some
existing GUI style or guideline. The \a option argument can be
@@ -2437,9 +2454,36 @@ QDebug operator<<(QDebug debug, QStyle::State state)
qSort(states);
debug << states.join(QLatin1String(" | "));
- debug << ")";
+ debug << ')';
return debug;
}
#endif
+/*!
+ \since 4.6
+
+ \fn const QStyle *QStyle::proxy() const
+
+ This function returns the current proxy for this style.
+ By default most styles will return themselves. However
+ when a proxy style is in use, it will allow the style to
+ call back into its proxy.
+*/
+const QStyle * QStyle::proxy() const
+{
+ Q_D(const QStyle);
+ return d->proxyStyle;
+}
+
+/* \internal
+
+ This function sets the base style that style calls will be
+ redirected to. Note that ownership is not transferred.
+*/
+void QStyle::setProxy(QStyle *style)
+{
+ Q_D(QStyle);
+ d->proxyStyle = style;
+}
+
QT_END_NAMESPACE
diff --git a/src/gui/styles/qstyle.h b/src/gui/styles/qstyle.h
index 9583492..8664d79 100644
--- a/src/gui/styles/qstyle.h
+++ b/src/gui/styles/qstyle.h
@@ -1,7 +1,6 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the QtGui module of the Qt Toolkit.
@@ -21,9 +20,10 @@
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.1, included in the file LGPL_EXCEPTION.txt in this
+** package.
**
** If you have questions regarding the use of this file, please contact
** Nokia at qt-info@nokia.com.
@@ -373,6 +373,8 @@ public:
SE_ShapedFrameContents,
+ SE_ToolBarHandle,
+
// do not add any values below/greater than this
SE_CustomBase = 0xf0000000
};
@@ -453,6 +455,7 @@ public:
SC_MdiNormalButton = 0x00000002,
SC_MdiCloseButton = 0x00000004,
+ SC_CustomBase = 0xf0000000,
SC_All = 0xffffffff
};
Q_DECLARE_FLAGS(SubControls, SubControl)
@@ -629,6 +632,11 @@ public:
virtual QSize sizeFromContents(ContentsType ct, const QStyleOption *opt,
const QSize &contentsSize, const QWidget *w = 0) const = 0;
+ enum RequestSoftwareInputPanel {
+ RSIP_OnMouseClickAndAlreadyFocused,
+ RSIP_OnMouseClick
+ };
+
enum StyleHint {
SH_EtchDisabledText,
SH_DitherDisabledText,
@@ -727,7 +735,8 @@ public:
SH_ItemView_DrawDelegateFrame,
SH_TabBar_CloseButtonPosition,
SH_DockWidget_ButtonsHaveFrame,
-
+ SH_ToolButtonStyle,
+ SH_RequestSoftwareInputPanel,
// Add new style hint values here
#ifdef QT3_SUPPORT
@@ -845,6 +854,8 @@ public:
QSizePolicy::ControlTypes controls2, Qt::Orientation orientation,
QStyleOption *option = 0, QWidget *widget = 0) const;
+ const QStyle * proxy() const;
+
protected Q_SLOTS:
QIcon standardIconImplementation(StandardPixmap standardIcon, const QStyleOption *opt = 0,
const QWidget *widget = 0) const;
@@ -859,6 +870,9 @@ private:
friend class QWidget;
friend class QWidgetPrivate;
friend class QApplication;
+ friend class QProxyStyle;
+ friend class QProxyStylePrivate;
+ void setProxy(QStyle *style);
};
Q_DECLARE_OPERATORS_FOR_FLAGS(QStyle::State)
diff --git a/src/gui/styles/qstyle_p.h b/src/gui/styles/qstyle_p.h
index 8af386e..0445537 100644
--- a/src/gui/styles/qstyle_p.h
+++ b/src/gui/styles/qstyle_p.h
@@ -1,7 +1,6 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the QtGui module of the Qt Toolkit.
@@ -21,9 +20,10 @@
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.1, included in the file LGPL_EXCEPTION.txt in this
+** package.
**
** If you have questions regarding the use of this file, please contact
** Nokia at qt-info@nokia.com.
@@ -43,6 +43,8 @@
#define QSTYLE_P_H
#include "private/qobject_p.h"
+#include "private/qstylehelper_p.h"
+#include <QtGui/qstyle.h>
QT_BEGIN_NAMESPACE
@@ -51,22 +53,24 @@ QT_BEGIN_NAMESPACE
// -------------
//
// This file is not part of the Qt API. It exists for the convenience
-// of qapplication_*.cpp, qwidget*.cpp and qfiledialog.cpp. This header
-// file may change from version to version without notice, or even be removed.
+// of qstyle_*.cpp. This header file may change from version to version
+// without notice, or even be removed.
//
// We mean it.
//
// Private class
+class QStyle;
+
class QStylePrivate: public QObjectPrivate
{
Q_DECLARE_PUBLIC(QStyle)
public:
inline QStylePrivate()
- : layoutSpacingIndex(-1)
- { }
+ : layoutSpacingIndex(-1), proxyStyle(0) {}
mutable int layoutSpacingIndex;
+ QStyle *proxyStyle;
};
@@ -75,9 +79,9 @@ public:
QPixmap internalPixmapCache; \
QImage imageCache; \
QPainter *p = painter; \
- QString unique = uniqueName((a), option, option->rect.size()); \
+ QString unique = QStyleHelper::uniqueName((a), option, option->rect.size()); \
int txType = painter->deviceTransform().type() | painter->worldTransform().type(); \
- bool doPixmapCache = UsePixmapCache && txType <= QTransform::TxTranslate; \
+ bool doPixmapCache = txType <= QTransform::TxTranslate; \
if (doPixmapCache && QPixmapCache::find(unique, internalPixmapCache)) { \
painter->drawPixmap(option->rect.topLeft(), internalPixmapCache); \
} else { \
@@ -89,6 +93,7 @@ public:
}
+
#define END_STYLE_PIXMAPCACHE \
if (doPixmapCache) { \
p->end(); \
diff --git a/src/gui/styles/qstyle_s60_simulated.qrc b/src/gui/styles/qstyle_s60_simulated.qrc
new file mode 100644
index 0000000..969732e
--- /dev/null
+++ b/src/gui/styles/qstyle_s60_simulated.qrc
@@ -0,0 +1,6 @@
+<!DOCTYPE RCC>
+<RCC version="1.0">
+ <qresource prefix="/trolltech/styles/s60style">
+ <file>images/defaults60theme.blob</file>
+ </qresource>
+</RCC>
diff --git a/src/gui/styles/qstylefactory.cpp b/src/gui/styles/qstylefactory.cpp
index af55975..e4a134d 100644
--- a/src/gui/styles/qstylefactory.cpp
+++ b/src/gui/styles/qstylefactory.cpp
@@ -1,7 +1,6 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the QtGui module of the Qt Toolkit.
@@ -21,9 +20,10 @@
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.1, included in the file LGPL_EXCEPTION.txt in this
+** package.
**
** If you have questions regarding the use of this file, please contact
** Nokia at qt-info@nokia.com.
@@ -69,6 +69,9 @@
#ifndef QT_NO_STYLE_WINDOWSMOBILE
#include "qwindowsmobilestyle.h"
#endif
+#ifndef QT_NO_STYLE_S60
+#include "qs60style.h"
+#endif
QT_BEGIN_NAMESPACE
@@ -154,6 +157,11 @@ QStyle *QStyleFactory::create(const QString& key)
ret = new QCDEStyle;
else
#endif
+#ifndef QT_NO_STYLE_S60
+ if (style == QLatin1String("s60"))
+ ret = new QS60Style;
+ else
+#endif
#ifndef QT_NO_STYLE_PLASTIQUE
if (style == QLatin1String("plastique"))
ret = new QPlastiqueStyle;
@@ -170,7 +178,7 @@ QStyle *QStyleFactory::create(const QString& key)
else
#endif
#ifndef QT_NO_STYLE_MAC
- if (style.left(9) == QLatin1String("macintosh")) {
+ if (style.startsWith(QLatin1String("macintosh"))) {
ret = new QMacStyle;
# ifdef Q_WS_MAC
if (style == QLatin1String("macintosh"))
@@ -233,6 +241,10 @@ QStringList QStyleFactory::keys()
if (!list.contains(QLatin1String("CDE")))
list << QLatin1String("CDE");
#endif
+#ifndef QT_NO_STYLE_S60
+ if (!list.contains(QLatin1String("S60")))
+ list << QLatin1String("S60");
+#endif
#ifndef QT_NO_STYLE_PLASTIQUE
if (!list.contains(QLatin1String("Plastique")))
list << QLatin1String("Plastique");
diff --git a/src/gui/styles/qstylefactory.h b/src/gui/styles/qstylefactory.h
index 3aa41ae..dd2f3c9 100644
--- a/src/gui/styles/qstylefactory.h
+++ b/src/gui/styles/qstylefactory.h
@@ -1,7 +1,6 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the QtGui module of the Qt Toolkit.
@@ -21,9 +20,10 @@
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.1, included in the file LGPL_EXCEPTION.txt in this
+** package.
**
** If you have questions regarding the use of this file, please contact
** Nokia at qt-info@nokia.com.
diff --git a/src/gui/styles/qstylehelper.cpp b/src/gui/styles/qstylehelper.cpp
new file mode 100644
index 0000000..9c91a52
--- /dev/null
+++ b/src/gui/styles/qstylehelper.cpp
@@ -0,0 +1,376 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the QtGui module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.1, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qstylehelper_p.h"
+
+#include <qstyleoption.h>
+#include <qpainter.h>
+#include <qpixmapcache.h>
+#include <private/qmath_p.h>
+#include <private/qstyle_p.h>
+#include <qmath.h>
+
+#if defined(Q_WS_WIN)
+#include "qt_windows.h"
+#elif defined(Q_WS_MAC)
+#include <private/qt_cocoa_helpers_mac_p.h>
+#endif
+
+QT_BEGIN_NAMESPACE
+
+namespace QStyleHelper {
+
+QString uniqueName(const QString &key, const QStyleOption *option, const QSize &size)
+{
+ const QStyleOptionComplex *complexOption = qstyleoption_cast<const QStyleOptionComplex *>(option);
+ QString tmp = QString::fromLatin1("%1-%2-%3-%4-%5-%6x%7").arg(key).arg(uint(option->state)).arg(option->direction)
+ .arg(complexOption ? uint(complexOption->activeSubControls) : uint(0))
+ .arg(option->palette.cacheKey()).arg(size.width()).arg(size.height());
+#ifndef QT_NO_SPINBOX
+ if (const QStyleOptionSpinBox *spinBox = qstyleoption_cast<const QStyleOptionSpinBox *>(option)) {
+ tmp.append(QLatin1Char('-'));
+ tmp.append(QString::number(spinBox->buttonSymbols));
+ tmp.append(QLatin1Char('-'));
+ tmp.append(QString::number(spinBox->stepEnabled));
+ tmp.append(QLatin1Char('-'));
+ tmp.append(QLatin1Char(spinBox->frame ? '1' : '0'));
+ }
+#endif // QT_NO_SPINBOX
+ return tmp;
+}
+
+qreal dpiScaled(qreal value)
+{
+ static qreal scale = -1;
+ if (scale < 0) {
+ scale = 1.0;
+#if defined(Q_WS_WIN)
+ {
+ HDC hdcScreen = GetDC(0);
+ int dpi = GetDeviceCaps(hdcScreen, LOGPIXELSX);
+ ReleaseDC(0, hdcScreen);
+ scale = dpi/96.0;
+ }
+#elif defined(Q_WS_MAC)
+ scale = qt_mac_get_scalefactor();
+#endif
+ }
+ return value * scale;
+}
+
+
+#ifndef QT_NO_DIAL
+
+int calcBigLineSize(int radius)
+{
+ int bigLineSize = radius / 6;
+ if (bigLineSize < 4)
+ bigLineSize = 4;
+ if (bigLineSize > radius / 2)
+ bigLineSize = radius / 2;
+ return bigLineSize;
+}
+
+static QPointF calcRadialPos(const QStyleOptionSlider *dial, qreal offset)
+{
+ const int width = dial->rect.width();
+ const int height = dial->rect.height();
+ const int r = qMin(width, height) / 2;
+ const int currentSliderPosition = dial->upsideDown ? dial->sliderPosition : (dial->maximum - dial->sliderPosition);
+ qreal a = 0;
+ if (dial->maximum == dial->minimum)
+ a = Q_PI / 2;
+ else if (dial->dialWrapping)
+ a = Q_PI * 3 / 2 - (currentSliderPosition - dial->minimum) * 2 * Q_PI
+ / (dial->maximum - dial->minimum);
+ else
+ a = (Q_PI * 8 - (currentSliderPosition - dial->minimum) * 10 * Q_PI
+ / (dial->maximum - dial->minimum)) / 6;
+ qreal xc = width / 2.0;
+ qreal yc = height / 2.0;
+ qreal len = r - QStyleHelper::calcBigLineSize(r) - 3;
+ qreal back = offset * len;
+ QPointF pos(QPointF(xc + back * qCos(a), yc - back * qSin(a)));
+ return pos;
+}
+
+qreal angle(const QPointF &p1, const QPointF &p2)
+{
+ static const qreal rad_factor = 180 / Q_PI;
+ qreal _angle = 0;
+
+ if (p1.x() == p2.x()) {
+ if (p1.y() < p2.y())
+ _angle = 270;
+ else
+ _angle = 90;
+ } else {
+ qreal x1, x2, y1, y2;
+
+ if (p1.x() <= p2.x()) {
+ x1 = p1.x(); y1 = p1.y();
+ x2 = p2.x(); y2 = p2.y();
+ } else {
+ x2 = p1.x(); y2 = p1.y();
+ x1 = p2.x(); y1 = p2.y();
+ }
+
+ qreal m = -(y2 - y1) / (x2 - x1);
+ _angle = atan(m) * rad_factor;
+
+ if (p1.x() < p2.x())
+ _angle = 180 - _angle;
+ else
+ _angle = -_angle;
+ }
+ return _angle;
+}
+
+QPolygonF calcLines(const QStyleOptionSlider *dial)
+{
+ QPolygonF poly;
+ int width = dial->rect.width();
+ int height = dial->rect.height();
+ qreal r = qMin(width, height) / 2;
+ int bigLineSize = calcBigLineSize(int(r));
+
+ qreal xc = width / 2 + 0.5;
+ qreal yc = height / 2 + 0.5;
+ int ns = dial->tickInterval;
+ int notches = (dial->maximum + ns - 1 - dial->minimum) / ns;
+ if (notches <= 0)
+ return poly;
+ if (dial->maximum < dial->minimum || dial->maximum - dial->minimum > 1000) {
+ int maximum = dial->minimum + 1000;
+ notches = (maximum + ns - 1 - dial->minimum) / ns;
+ }
+
+ poly.resize(2 + 2 * notches);
+ int smallLineSize = bigLineSize / 2;
+ for (int i = 0; i <= notches; ++i) {
+ qreal angle = dial->dialWrapping ? Q_PI * 3 / 2 - i * 2 * Q_PI / notches
+ : (Q_PI * 8 - i * 10 * Q_PI / notches) / 6;
+ qreal s = qSin(angle);
+ qreal c = qCos(angle);
+ if (i == 0 || (((ns * i) % (dial->pageStep ? dial->pageStep : 1)) == 0)) {
+ poly[2 * i] = QPointF(xc + (r - bigLineSize) * c,
+ yc - (r - bigLineSize) * s);
+ poly[2 * i + 1] = QPointF(xc + r * c, yc - r * s);
+ } else {
+ poly[2 * i] = QPointF(xc + (r - 1 - smallLineSize) * c,
+ yc - (r - 1 - smallLineSize) * s);
+ poly[2 * i + 1] = QPointF(xc + (r - 1) * c, yc -(r - 1) * s);
+ }
+ }
+ return poly;
+}
+
+// This will draw a nice and shiny QDial for us. We don't want
+// all the shinyness in QWindowsStyle, hence we place it here
+
+void drawDial(const QStyleOptionSlider *option, QPainter *painter)
+{
+ QPalette pal = option->palette;
+ QColor buttonColor = pal.button().color();
+ const int width = option->rect.width();
+ const int height = option->rect.height();
+ const bool enabled = option->state & QStyle::State_Enabled;
+ qreal r = qMin(width, height) / 2;
+ r -= r/50;
+ const qreal penSize = r/20.0;
+
+ painter->save();
+ painter->setRenderHint(QPainter::Antialiasing);
+
+ // Draw notches
+ if (option->subControls & QStyle::SC_DialTickmarks) {
+ painter->setPen(option->palette.dark().color().darker(120));
+ painter->drawLines(QStyleHelper::calcLines(option));
+ }
+
+ // Cache dial background
+ BEGIN_STYLE_PIXMAPCACHE(QString::fromLatin1("qdial"));
+ p->setRenderHint(QPainter::Antialiasing);
+
+ const qreal d_ = r / 6;
+ const qreal dx = option->rect.x() + d_ + (width - 2 * r) / 2 + 1;
+ const qreal dy = option->rect.y() + d_ + (height - 2 * r) / 2 + 1;
+
+ QRectF br = QRectF(dx + 0.5, dy + 0.5,
+ int(r * 2 - 2 * d_ - 2),
+ int(r * 2 - 2 * d_ - 2));
+ buttonColor.setHsv(buttonColor .hue(),
+ qMin(140, buttonColor .saturation()),
+ qMax(180, buttonColor.value()));
+ QColor shadowColor(0, 0, 0, 20);
+
+ if (enabled) {
+ // Drop shadow
+ qreal shadowSize = qMax(1.0, penSize/2.0);
+ QRectF shadowRect= br.adjusted(-2*shadowSize, -2*shadowSize,
+ 2*shadowSize, 2*shadowSize);
+ QRadialGradient shadowGradient(shadowRect.center().x(),
+ shadowRect.center().y(), shadowRect.width()/2.0,
+ shadowRect.center().x(), shadowRect.center().y());
+ shadowGradient.setColorAt(qreal(0.91), QColor(0, 0, 0, 40));
+ shadowGradient.setColorAt(qreal(1.0), Qt::transparent);
+ p->setBrush(shadowGradient);
+ p->setPen(Qt::NoPen);
+ p->translate(shadowSize, shadowSize);
+ p->drawEllipse(shadowRect);
+ p->translate(-shadowSize, -shadowSize);
+
+ // Main gradient
+ QRadialGradient gradient(br.center().x() - br.width()/3, dy,
+ br.width()*1.3, br.center().x(),
+ br.center().y() - br.height()/2);
+ gradient.setColorAt(0, buttonColor.lighter(110));
+ gradient.setColorAt(qreal(0.5), buttonColor);
+ gradient.setColorAt(qreal(0.501), buttonColor.darker(102));
+ gradient.setColorAt(1, buttonColor.darker(115));
+ p->setBrush(gradient);
+ } else {
+ p->setBrush(Qt::NoBrush);
+ }
+
+ p->setPen(QPen(buttonColor.darker(280)));
+ p->drawEllipse(br);
+ p->setBrush(Qt::NoBrush);
+ p->setPen(buttonColor.lighter(110));
+ p->drawEllipse(br.adjusted(1, 1, -1, -1));
+
+ if (option->state & QStyle::State_HasFocus) {
+ QColor highlight = pal.highlight().color();
+ highlight.setHsv(highlight.hue(),
+ qMin(160, highlight.saturation()),
+ qMax(230, highlight.value()));
+ highlight.setAlpha(127);
+ p->setPen(QPen(highlight, 2.0));
+ p->setBrush(Qt::NoBrush);
+ p->drawEllipse(br.adjusted(-1, -1, 1, 1));
+ }
+
+ END_STYLE_PIXMAPCACHE
+
+ QPointF dp = calcRadialPos(option, qreal(0.70));
+ buttonColor = buttonColor.lighter(104);
+ buttonColor.setAlphaF(qreal(0.8));
+ const qreal ds = r/qreal(7.0);
+ QRectF dialRect(dp.x() - ds, dp.y() - ds, 2*ds, 2*ds);
+ QRadialGradient dialGradient(dialRect.center().x() + dialRect.width()/2,
+ dialRect.center().y() + dialRect.width(),
+ dialRect.width()*2,
+ dialRect.center().x(), dialRect.center().y());
+ dialGradient.setColorAt(1, buttonColor.darker(140));
+ dialGradient.setColorAt(qreal(0.4), buttonColor.darker(120));
+ dialGradient.setColorAt(0, buttonColor.darker(110));
+ if (penSize > 3.0) {
+ painter->setPen(QPen(QColor(0, 0, 0, 25), penSize));
+ painter->drawLine(calcRadialPos(option, qreal(0.90)), calcRadialPos(option, qreal(0.96)));
+ }
+
+ painter->setBrush(dialGradient);
+ painter->setPen(QColor(255, 255, 255, 150));
+ painter->drawEllipse(dialRect.adjusted(-1, -1, 1, 1));
+ painter->setPen(QColor(0, 0, 0, 80));
+ painter->drawEllipse(dialRect);
+ painter->restore();
+}
+#endif //QT_NO_DIAL
+
+void drawBorderPixmap(const QPixmap &pixmap, QPainter *painter, const QRect &rect,
+ int left, int top, int right,
+ int bottom)
+{
+ QSize size = pixmap.size();
+ //painter->setRenderHint(QPainter::SmoothPixmapTransform);
+
+ //top
+ if (top > 0) {
+ painter->drawPixmap(QRect(rect.left() + left, rect.top(), rect.width() -right - left, top), pixmap,
+ QRect(left, 0, size.width() -right - left, top));
+
+ //top-left
+ if(left > 0)
+ painter->drawPixmap(QRect(rect.left(), rect.top(), left, top), pixmap,
+ QRect(0, 0, left, top));
+
+ //top-right
+ if (right > 0)
+ painter->drawPixmap(QRect(rect.left() + rect.width() - right, rect.top(), right, top), pixmap,
+ QRect(size.width() - right, 0, right, top));
+ }
+
+ //left
+ if (left > 0)
+ painter->drawPixmap(QRect(rect.left(), rect.top()+top, left, rect.height() - top - bottom), pixmap,
+ QRect(0, top, left, size.height() - bottom - top));
+
+ //center
+ painter->drawPixmap(QRect(rect.left() + left, rect.top()+top, rect.width() -right - left,
+ rect.height() - bottom - top), pixmap,
+ QRect(left, top, size.width() -right -left,
+ size.height() - bottom - top));
+ //right
+ if (right > 0)
+ painter->drawPixmap(QRect(rect.left() +rect.width() - right, rect.top()+top, right, rect.height() - top - bottom), pixmap,
+ QRect(size.width() - right, top, right, size.height() - bottom - top));
+
+ //bottom
+ if (bottom > 0) {
+ painter->drawPixmap(QRect(rect.left() +left, rect.top() + rect.height() - bottom,
+ rect.width() - right - left, bottom), pixmap,
+ QRect(left, size.height() - bottom,
+ size.width() - right - left, bottom));
+ //bottom-left
+ if (left > 0)
+ painter->drawPixmap(QRect(rect.left(), rect.top() + rect.height() - bottom, left, bottom), pixmap,
+ QRect(0, size.height() - bottom, left, bottom));
+
+ //bottom-right
+ if (right > 0)
+ painter->drawPixmap(QRect(rect.left() + rect.width() - right, rect.top() + rect.height() - bottom, right, bottom), pixmap,
+ QRect(size.width() - right, size.height() - bottom, right, bottom));
+
+ }
+}
+}
+QT_END_NAMESPACE
diff --git a/src/gui/styles/qstylehelper_p.h b/src/gui/styles/qstylehelper_p.h
new file mode 100644
index 0000000..1f73018
--- /dev/null
+++ b/src/gui/styles/qstylehelper_p.h
@@ -0,0 +1,84 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the QtGui module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.1, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtCore/qglobal.h>
+#include <QtCore/qpoint.h>
+#include <QtGui/qpolygon.h>
+
+#ifndef QSTYLEHELPER_P_H
+#define QSTYLEHELPER_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+QT_BEGIN_NAMESPACE
+
+class QPainter;
+class QPixmap;
+class QStyleOptionSlider;
+class QStyleOption;
+
+namespace QStyleHelper
+{
+ QString uniqueName(const QString &key, const QStyleOption *option, const QSize &size);
+ qreal dpiScaled(qreal value);
+#ifndef QT_NO_DIAL
+ qreal angle(const QPointF &p1, const QPointF &p2);
+ QPolygonF calcLines(const QStyleOptionSlider *dial);
+ int calcBigLineSize(int radius);
+ void drawDial(const QStyleOptionSlider *dial, QPainter *painter);
+#endif //QT_NO_DIAL
+ void drawBorderPixmap(const QPixmap &pixmap, QPainter *painter, const QRect &rect,
+ int left = 0, int top = 0, int right = 0,
+ int bottom = 0);
+}
+
+QT_END_NAMESPACE
+
+#endif // QSTYLEHELPER_P_H
diff --git a/src/gui/styles/qstyleoption.cpp b/src/gui/styles/qstyleoption.cpp
index 5783904..fc2a13c 100644
--- a/src/gui/styles/qstyleoption.cpp
+++ b/src/gui/styles/qstyleoption.cpp
@@ -1,7 +1,6 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the QtGui module of the Qt Toolkit.
@@ -21,9 +20,10 @@
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.1, included in the file LGPL_EXCEPTION.txt in this
+** package.
**
** If you have questions regarding the use of this file, please contact
** Nokia at qt-info@nokia.com.
@@ -48,6 +48,7 @@
#ifndef QT_NO_DEBUG
#include <qdebug.h>
#endif
+#include <QtCore/qmath.h>
QT_BEGIN_NAMESPACE
@@ -656,7 +657,7 @@ QStyleOptionFrameV2 &QStyleOptionFrameV2::operator=(const QStyleOptionFrame &oth
/*!
\enum QStyleOptionFrameV2::FrameFeature
- This enum describles the different types of features a frame can have.
+ This enum describes the different types of features a frame can have.
\value None Indicates a normal frame.
\value Flat Indicates a flat frame.
@@ -711,7 +712,7 @@ QStyleOptionFrameV2 &QStyleOptionFrameV2::operator=(const QStyleOptionFrame &oth
Constructs a QStyleOptionFrameV3 object.
*/
QStyleOptionFrameV3::QStyleOptionFrameV3()
- : QStyleOptionFrameV2(Version), frameShape(QFrame::NoFrame)
+ : QStyleOptionFrameV2(Version), frameShape(QFrame::NoFrame), unused(0)
{
}
@@ -725,7 +726,7 @@ QStyleOptionFrameV3::QStyleOptionFrameV3()
\internal
*/
QStyleOptionFrameV3::QStyleOptionFrameV3(int version)
- : QStyleOptionFrameV2(version), frameShape(QFrame::NoFrame)
+ : QStyleOptionFrameV2(version), frameShape(QFrame::NoFrame), unused(0)
{
}
@@ -898,7 +899,7 @@ QStyleOptionViewItemV2 &QStyleOptionViewItemV2::operator=(const QStyleOptionView
/*!
\enum QStyleOptionViewItemV2::ViewItemFeature
- This enum describles the different types of features an item can have.
+ This enum describes the different types of features an item can have.
\value None Indicates a normal item.
\value WrapText Indicates an item with wrapped text.
@@ -953,7 +954,7 @@ QStyleOptionViewItemV2 &QStyleOptionViewItemV2::operator=(const QStyleOptionView
Constructs a QStyleOptionViewItemV3 object.
*/
QStyleOptionViewItemV3::QStyleOptionViewItemV3()
- : QStyleOptionViewItemV2(Version)
+ : QStyleOptionViewItemV2(Version), widget(0)
{
}
@@ -961,7 +962,7 @@ QStyleOptionViewItemV3::QStyleOptionViewItemV3()
Constructs a copy of \a other.
*/
QStyleOptionViewItemV3::QStyleOptionViewItemV3(const QStyleOptionViewItem &other)
- : QStyleOptionViewItemV2(Version)
+ : QStyleOptionViewItemV2(Version), widget(0)
{
(void)QStyleOptionViewItemV3::operator=(other);
}
@@ -990,7 +991,7 @@ QStyleOptionViewItemV3 &QStyleOptionViewItemV3::operator = (const QStyleOptionVi
\internal
*/
QStyleOptionViewItemV3::QStyleOptionViewItemV3(int version)
- : QStyleOptionViewItemV2(version)
+ : QStyleOptionViewItemV2(version), widget(0)
{
}
@@ -3541,7 +3542,8 @@ QStyleOptionQ3DockWindow::QStyleOptionQ3DockWindow(int version)
*/
QStyleOptionDockWidget::QStyleOptionDockWidget()
- : QStyleOption(Version, SO_DockWidget), movable(false)
+ : QStyleOption(Version, SO_DockWidget), closable(false),
+ movable(false), floatable(false)
{
}
@@ -4256,8 +4258,7 @@ QStyleOptionRubberBand::QStyleOptionRubberBand(int version)
parameters for drawing a title bar.
QStyleOptionTitleBar contains all the information that QStyle
- functions need to draw the title bars of QWorkspace's MDI
- children.
+ functions need to draw the title bar of a QMdiSubWindow.
For performance reasons, the access to the member variables is
direct (i.e., using the \c . or \c -> operator). This low-level feel
@@ -4267,7 +4268,7 @@ QStyleOptionRubberBand::QStyleOptionRubberBand(int version)
For an example demonstrating how style options can be used, see
the \l {widgets/styles}{Styles} example.
- \sa QStyleOption, QStyleOptionComplex, QWorkspace
+ \sa QStyleOption, QStyleOptionComplex, QMdiSubWindow
*/
/*!
@@ -4844,7 +4845,7 @@ QStyleOptionTabBarBaseV2 &QStyleOptionTabBarBaseV2::operator = (const QStyleOpti
/*! \internal */
QStyleOptionTabBarBaseV2::QStyleOptionTabBarBaseV2(int version)
- : QStyleOptionTabBarBase(version)
+ : QStyleOptionTabBarBase(version), documentMode(false)
{
}
@@ -4936,7 +4937,7 @@ QStyleOptionSizeGrip::QStyleOptionSizeGrip(int version)
\brief The QStyleOptionGraphicsItem class is used to describe
the parameters needed to draw a QGraphicsItem.
\since 4.2
- \ingroup multimedia
+ \ingroup graphicsview-api
For performance reasons, the access to the member variables is
direct (i.e., using the \c . or \c -> operator). This low-level feel
@@ -4981,8 +4982,7 @@ QStyleOptionSizeGrip::QStyleOptionSizeGrip(int version)
*/
/*!
- Constructs a QStyleOptionGraphicsItem. The levelOfDetail parameter is
- initialized to 1.
+ Constructs a QStyleOptionGraphicsItem.
*/
QStyleOptionGraphicsItem::QStyleOptionGraphicsItem()
: QStyleOption(Version, Type), levelOfDetail(1)
@@ -4998,6 +4998,29 @@ QStyleOptionGraphicsItem::QStyleOptionGraphicsItem(int version)
}
/*!
+ \since 4.6
+
+ Returns the level of detail from the \a worldTransform.
+
+ Its value represents the maximum value of the height and
+ width of a unity rectangle, mapped using the \a worldTransform
+ of the painter used to draw the item. By default, if no
+ transformations are applied, its value is 1. If zoomed out 1:2, the level
+ of detail will be 0.5, and if zoomed in 2:1, its value is 2.
+*/
+qreal QStyleOptionGraphicsItem::levelOfDetailFromTransform(const QTransform &worldTransform)
+{
+ if (worldTransform.type() <= QTransform::TxTranslate)
+ return 1; // Translation only? The LOD is 1.
+
+ // Two unit vectors.
+ QLineF v1(0, 0, 1, 0);
+ QLineF v2(0, 0, 0, 1);
+ // LOD is the transformed area of a 1x1 rectangle.
+ return qSqrt(worldTransform.map(v1).length() * worldTransform.map(v2).length());
+}
+
+/*!
\fn QStyleOptionGraphicsItem::QStyleOptionGraphicsItem(const QStyleOptionGraphicsItem &other)
Constructs a copy of \a other.
@@ -5010,38 +5033,41 @@ QStyleOptionGraphicsItem::QStyleOptionGraphicsItem(int version)
Make use of this rectangle to speed up item drawing when only parts of the
item are exposed. If the whole item is exposed, this rectangle will be the
same as QGraphicsItem::boundingRect().
+
+ This member is only initialized for items that have the
+ QGraphicsItem::ItemUsesExtendedStyleOption flag set.
*/
/*!
\variable QStyleOptionGraphicsItem::matrix
\brief the complete transformation matrix for the item
+ \obsolete
+
+ The QMatrix provided through this member does include information about
+ any perspective transformations applied to the view or item. To get the
+ correct transformation matrix, use QPainter::transform() on the painter
+ passed into the QGraphicsItem::paint() implementation.
- This matrix is the sum of the item's scene matrix and the matrix of the
- painter used for drawing the item. It is provided for convenience,
+ This matrix is the combination of the item's scene matrix and the matrix
+ of the painter used for drawing the item. It is provided for convenience,
allowing anvanced level-of-detail metrics that can be used to speed up
item drawing.
- To find the dimentions of an item in screen coordinates (i.e., pixels),
+ To find the dimensions of an item in screen coordinates (i.e., pixels),
you can use the mapping functions of QMatrix, such as QMatrix::map().
- \sa QStyleOptionGraphicsItem::levelOfDetail
+ This member is only initialized for items that have the
+ QGraphicsItem::ItemUsesExtendedStyleOption flag set.
+
+ \sa QStyleOptionGraphicsItem::levelOfDetailFromTransform()
*/
/*!
\variable QStyleOptionGraphicsItem::levelOfDetail
- \brief a simple metric for determining an item's level of detail
-
- This simple metric provides an easy way to determine the level of detail
- for an item. Its value represents the maximum value of the height and
- width of a unity rectangle, mapped using the complete transformation
- matrix of the painter used to draw the item. By default, if no
- transformations are applied, its value is 1. If zoomed out 1:2, the level
- of detail will be 0.5, and if zoomed in 2:1, its value is 2.
-
- For more advanced level-of-detail metrics, use
- QStyleOptionGraphicsItem::matrix directly.
+ \obsolete
- \sa QStyleOptionGraphicsItem::matrix
+ Use QStyleOptionGraphicsItem::levelOfDetailFromTransform()
+ together with QPainter::worldTransform() instead.
*/
/*!
@@ -5342,10 +5368,10 @@ QDebug operator<<(QDebug debug, const QStyleOption &option)
{
debug << "QStyleOption(";
debug << QStyleOption::OptionType(option.type);
- debug << "," << (option.direction == Qt::RightToLeft ? "RightToLeft" : "LeftToRight");
- debug << "," << option.state;
- debug << "," << option.rect;
- debug << ")";
+ debug << ',' << (option.direction == Qt::RightToLeft ? "RightToLeft" : "LeftToRight");
+ debug << ',' << option.state;
+ debug << ',' << option.rect;
+ debug << ')';
return debug;
}
#endif
diff --git a/src/gui/styles/qstyleoption.h b/src/gui/styles/qstyleoption.h
index d902a05..c19f020 100644
--- a/src/gui/styles/qstyleoption.h
+++ b/src/gui/styles/qstyleoption.h
@@ -1,7 +1,6 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the QtGui module of the Qt Toolkit.
@@ -21,9 +20,10 @@
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.1, included in the file LGPL_EXCEPTION.txt in this
+** package.
**
** If you have questions regarding the use of this file, please contact
** Nokia at qt-info@nokia.com.
@@ -856,6 +856,7 @@ public:
QStyleOptionGraphicsItem();
QStyleOptionGraphicsItem(const QStyleOptionGraphicsItem &other) : QStyleOption(Version, Type) { *this = other; }
+ static qreal levelOfDetailFromTransform(const QTransform &worldTransform);
protected:
QStyleOptionGraphicsItem(int version);
};
diff --git a/src/gui/styles/qstyleplugin.cpp b/src/gui/styles/qstyleplugin.cpp
index 61dbaca..3cb264e 100644
--- a/src/gui/styles/qstyleplugin.cpp
+++ b/src/gui/styles/qstyleplugin.cpp
@@ -1,7 +1,6 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the QtGui module of the Qt Toolkit.
@@ -21,9 +20,10 @@
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.1, included in the file LGPL_EXCEPTION.txt in this
+** package.
**
** If you have questions regarding the use of this file, please contact
** Nokia at qt-info@nokia.com.
diff --git a/src/gui/styles/qstyleplugin.h b/src/gui/styles/qstyleplugin.h
index 82cac52..32fcdad 100644
--- a/src/gui/styles/qstyleplugin.h
+++ b/src/gui/styles/qstyleplugin.h
@@ -1,7 +1,6 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the QtGui module of the Qt Toolkit.
@@ -21,9 +20,10 @@
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.1, included in the file LGPL_EXCEPTION.txt in this
+** package.
**
** If you have questions regarding the use of this file, please contact
** Nokia at qt-info@nokia.com.
diff --git a/src/gui/styles/qstylesheetstyle.cpp b/src/gui/styles/qstylesheetstyle.cpp
index 135c187..b1fd415 100644
--- a/src/gui/styles/qstylesheetstyle.cpp
+++ b/src/gui/styles/qstylesheetstyle.cpp
@@ -1,7 +1,6 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the QtGui module of the Qt Toolkit.
@@ -21,9 +20,10 @@
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.1, included in the file LGPL_EXCEPTION.txt in this
+** package.
**
** If you have questions regarding the use of this file, please contact
** Nokia at qt-info@nokia.com.
@@ -81,6 +81,7 @@
#include <private/qwidget_p.h>
#include <QAbstractSpinBox>
#include <QLabel>
+#include "qdrawutil.h"
#include <limits.h>
@@ -213,6 +214,7 @@ enum PseudoElement {
PseudoElement_ViewItemText,
PseudoElement_ViewItemIndicator,
PseudoElement_ScrollAreaCorner,
+ PseudoElement_TabBarTabCloseButton,
NumPseudoElements
};
@@ -222,7 +224,7 @@ struct PseudoElementInfo {
};
static const PseudoElementInfo knownPseudoElements[NumPseudoElements] = {
- { QStyle::SC_None, "", },
+ { QStyle::SC_None, "" },
{ QStyle::SC_None, "down-arrow" },
{ QStyle::SC_None, "up-arrow" },
{ QStyle::SC_None, "left-arrow" },
@@ -299,8 +301,9 @@ static const PseudoElementInfo knownPseudoElements[NumPseudoElements] = {
{ QStyle::SC_None, "item" },
{ QStyle::SC_None, "icon" },
{ QStyle::SC_None, "text" },
- { QStyle::SC_None, "indicator" } ,
- { QStyle::SC_None, "corner" }
+ { QStyle::SC_None, "indicator" },
+ { QStyle::SC_None, "corner" },
+ { QStyle::SC_None, "close-button" },
};
@@ -312,15 +315,10 @@ struct QStyleSheetBorderImageData : public QSharedData
for (int i = 0; i < 4; i++)
cuts[i] = -1;
}
- QPixmap topEdge, bottomEdge, leftEdge, rightEdge, middle;
- QRect topEdgeRect, bottomEdgeRect, leftEdgeRect, rightEdgeRect, middleRect;
- QRect topLeftCorner, topRightCorner, bottomRightCorner, bottomLeftCorner;
int cuts[4];
QPixmap pixmap;
QImage image;
QCss::TileMode horizStretch, vertStretch;
-
- void cutBorderImage();
};
struct QStyleSheetBackgroundData : public QSharedData
@@ -871,7 +869,7 @@ static QStyle::StandardPixmap subControlIcon(int pe)
QRenderRule::QRenderRule(const QVector<Declaration> &declarations, const QWidget *widget)
: features(0), hasFont(false), pal(0), b(0), bg(0), bd(0), ou(0), geo(0), p(0), img(0), clipset(0)
{
- QPalette palette = qApp->palette(); // ###: ideally widget's palette
+ QPalette palette = QApplication::palette(); // ###: ideally widget's palette
ValueExtractor v(declarations, palette);
features = v.extractStyleFeatures();
@@ -1122,176 +1120,27 @@ void QRenderRule::fixupBorder(int nativeWidth)
for (int i = 0; i < 4; i++) // assume, cut = border
bi->cuts[i] = int(border()->borders[i]);
}
- bi->cutBorderImage();
-}
-
-void QStyleSheetBorderImageData::cutBorderImage()
-{
- const int w = pixmap.width();
- const int h = pixmap.height();
- const int &l = cuts[LeftEdge], &r = cuts[RightEdge],
- &t = cuts[TopEdge], &b = cuts[BottomEdge];
-
- topEdgeRect = QRect(l, 0, w - r - l, t);
- bottomEdgeRect = QRect(l, h - b, w - l - r, b);
- if (horizStretch != TileMode_Stretch) {
- if (topEdgeRect.isValid())
- topEdge = pixmap.copy(topEdgeRect).scaledToHeight(t);
- if (bottomEdgeRect.isValid())
- bottomEdge = pixmap.copy(bottomEdgeRect).scaledToHeight(b);
- }
-
- leftEdgeRect = QRect(0, t, l, h - b - t);
- rightEdgeRect = QRect(w - r, t, r, h - t- b);
- if (vertStretch != TileMode_Stretch) {
- if (leftEdgeRect.isValid())
- leftEdge = pixmap.copy(leftEdgeRect).scaledToWidth(l);
- if (rightEdgeRect.isValid())
- rightEdge = pixmap.copy(rightEdgeRect).scaledToWidth(r);
- }
-
- middleRect = QRect(l, t, w - r -l, h - t - b);
- if (middleRect.isValid()
- && !(horizStretch == TileMode_Stretch && vertStretch == TileMode_Stretch)) {
- middle = pixmap.copy(middleRect);
- }
-}
-
-static void qDrawCenterTiledPixmap(QPainter *p, const QRectF& r, const QPixmap& pix)
-{
- p->drawTiledPixmap(r, pix, QPoint(pix.width() - int(r.width())%pix.width(),
- pix.height() - int(r.height())%pix.height()));
}
-// Note: Round is not supported
void QRenderRule::drawBorderImage(QPainter *p, const QRect& rect)
{
- setClip(p, rect);
- const QRectF br(rect);
- const int *borders = border()->borders;
- const int &l = borders[LeftEdge], &r = borders[RightEdge],
- &t = borders[TopEdge], &b = borders[BottomEdge];
- QRectF pr = br.adjusted(l, t, -r, -b);
+ static const Qt::TileRule tileMode2TileRule[] = {
+ Qt::Stretch, Qt::Round, Qt::Stretch, Qt::Repeat, Qt::Stretch };
+
+ const QStyleSheetBorderImageData *borderImageData = border()->borderImage();
+ const int *targetBorders = border()->borders;
+ const int *sourceBorders = borderImageData->cuts;
+ QMargins sourceMargins(sourceBorders[LeftEdge], sourceBorders[TopEdge],
+ sourceBorders[RightEdge], sourceBorders[BottomEdge]);
+ QMargins targetMargins(targetBorders[LeftEdge], targetBorders[TopEdge],
+ targetBorders[RightEdge], targetBorders[BottomEdge]);
bool wasSmoothPixmapTransform = p->renderHints() & QPainter::SmoothPixmapTransform;
p->setRenderHint(QPainter::SmoothPixmapTransform);
-
- const QStyleSheetBorderImageData *bi = border()->borderImage();
- const QPixmap& pix = bi->pixmap;
- const int *c = bi->cuts;
- QRectF tlc(0, 0, c[LeftEdge], c[TopEdge]);
- if (tlc.isValid())
- p->drawPixmap(QRectF(br.topLeft(), QSizeF(l, t)), pix, tlc);
- QRectF trc(pix.width() - c[RightEdge], 0, c[RightEdge], c[TopEdge]);
- if (trc.isValid())
- p->drawPixmap(QRectF(br.left() + br.width() - r, br.y(), r, t), pix, trc);
- QRectF blc(0, pix.height() - c[BottomEdge], c[LeftEdge], c[BottomEdge]);
- if (blc.isValid())
- p->drawPixmap(QRectF(br.x(), br.y() + br.height() - b, l, b), pix, blc);
- QRectF brc(pix.width() - c[RightEdge], pix.height() - c[BottomEdge],
- c[RightEdge], c[BottomEdge]);
- if (brc.isValid())
- p->drawPixmap(QRectF(br.x() + br.width() - r, br.y() + br.height() - b, r, b),
- pix, brc);
-
- QRectF topEdgeRect(br.x() + l, br.y(), pr.width(), t);
- QRectF bottomEdgeRect(br.x() + l, br.y() + br.height() - b, pr.width(), b);
-
- switch (bi->horizStretch) {
- case TileMode_Stretch:
- if (bi->topEdgeRect.isValid())
- p->drawPixmap(topEdgeRect, pix, bi->topEdgeRect);
- if (bi->bottomEdgeRect.isValid())
- p->drawPixmap(bottomEdgeRect, pix, bi->bottomEdgeRect);
- if (bi->middleRect.isValid()) {
- if (bi->vertStretch == TileMode_Stretch)
- p->drawPixmap(pr, pix, bi->middleRect);
- else if (bi->vertStretch == TileMode_Repeat) {
- QPixmap scaled = bi->middle.scaled(int(pr.width()), bi->middle.height());
- qDrawCenterTiledPixmap(p, pr, scaled);
- }
- }
- break;
- case TileMode_Repeat:
- if (!bi->topEdge.isNull() && !topEdgeRect.isEmpty()) {
- QPixmap scaled = bi->topEdge.scaled(bi->topEdge.width(), t);
- qDrawCenterTiledPixmap(p, topEdgeRect, scaled);
- }
- if (!bi->bottomEdge.isNull() && !bottomEdgeRect.isEmpty()) {
- QPixmap scaled = bi->bottomEdge.scaled(bi->bottomEdge.width(), b);
- qDrawCenterTiledPixmap(p, bottomEdgeRect, scaled);
- }
- if (bi->middleRect.isValid()) {
- if (bi->vertStretch == TileMode_Repeat) {
- qDrawCenterTiledPixmap(p, pr, bi->middle);
- } else if (bi->vertStretch == TileMode_Stretch) {
- QPixmap scaled = bi->middle.scaled(bi->middle.width(), int(pr.height()));
- qDrawCenterTiledPixmap(p, pr, scaled);
- }
- }
- break;
- case TileMode_Round:
- if (!bi->topEdge.isNull()) {
- int rwh = (int)pr.width()/ceil(pr.width()/bi->topEdge.width());
- QPixmap scaled = bi->topEdge.scaled(rwh, bi->topEdge.height());
- int blank = int(pr.width()) % rwh;
- p->drawTiledPixmap(QRectF(br.x() + l + blank/2, br.y(), pr.width() - blank, t),
- scaled);
- }
- if (!bi->bottomEdge.isNull()) {
- int rwh = (int) pr.width()/ceil(pr.width()/bi->bottomEdge.width());
- QPixmap scaled = bi->bottomEdge.scaled(rwh, bi->bottomEdge.height());
- int blank = int(pr.width()) % rwh;
- p->drawTiledPixmap(QRectF(br.x() + l+ blank/2, br.y()+br.height()-b,
- pr.width() - blank, b), scaled);
- }
- break;
- default:
- break;
- }
-
- QRectF leftEdgeRect(br.x(), br.y() + t, l, pr.height());
- QRectF rightEdgeRect(br.x() + br.width()- r, br.y() + t, r, pr.height());
-
- switch (bi->vertStretch) {
- case TileMode_Stretch:
- if (bi->leftEdgeRect.isValid())
- p->drawPixmap(leftEdgeRect, pix, bi->leftEdgeRect);
- if (bi->rightEdgeRect.isValid())
- p->drawPixmap(rightEdgeRect, pix, bi->rightEdgeRect);
- break;
- case TileMode_Repeat:
- if (!bi->leftEdge.isNull() && !leftEdgeRect.isEmpty()) {
- QPixmap scaled = bi->leftEdge.scaled(l, bi->leftEdge.height());
- qDrawCenterTiledPixmap(p, leftEdgeRect, scaled);
- }
- if (!bi->rightEdge.isNull() && !rightEdgeRect.isEmpty()) {
- QPixmap scaled = bi->rightEdge.scaled(r, bi->rightEdge.height());
- qDrawCenterTiledPixmap(p, rightEdgeRect, scaled);
- }
- break;
- case TileMode_Round:
- if (!bi->leftEdge.isNull()) {
- int rwh = (int) pr.height()/ceil(pr.height()/bi->leftEdge.height());
- QPixmap scaled = bi->leftEdge.scaled(bi->leftEdge.width(), rwh);
- int blank = int(pr.height()) % rwh;
- p->drawTiledPixmap(QRectF(br.x(), br.y() + t + blank/2, l, pr.height() - blank),
- scaled);
- }
- if (!bi->rightEdge.isNull()) {
- int rwh = (int) pr.height()/ceil(pr.height()/bi->rightEdge.height());
- QPixmap scaled = bi->rightEdge.scaled(bi->rightEdge.width(), rwh);
- int blank = int(pr.height()) % rwh;
- p->drawTiledPixmap(QRectF(br.x() + br.width() - r, br.y()+t+blank/2, r,
- pr.height() - blank), scaled);
- }
- break;
- default:
- break;
- }
-
+ qDrawBorderPixmap(p, rect, targetMargins, borderImageData->pixmap,
+ QRect(QPoint(), borderImageData->pixmap.size()), sourceMargins,
+ QTileRules(tileMode2TileRule[borderImageData->horizStretch], tileMode2TileRule[borderImageData->vertStretch]));
p->setRenderHint(QPainter::SmoothPixmapTransform, wasSmoothPixmapTransform);
- unsetClip(p);
}
QRect QRenderRule::originRect(const QRect &rect, Origin origin) const
@@ -1451,7 +1300,6 @@ void QRenderRule::unsetClip(QPainter *p)
void QRenderRule::drawBackground(QPainter *p, const QRect& rect, const QPoint& off)
{
- setClip(p, borderRect(rect));
QBrush brush = hasBackground() ? background()->brush : QBrush();
if (brush.style() == Qt::NoBrush)
brush = defaultBackground;
@@ -1459,11 +1307,19 @@ void QRenderRule::drawBackground(QPainter *p, const QRect& rect, const QPoint& o
if (brush.style() != Qt::NoBrush) {
Origin origin = hasBackground() ? background()->clip : Origin_Border;
// ### fix for gradients
- p->fillRect(originRect(rect, origin), brush);
+ const QPainterPath &borderPath = borderClip(originRect(rect, origin));
+ if (!borderPath.isEmpty()) {
+ // Drawn intead of being used as clipping path for better visual quality
+ bool wasAntialiased = p->renderHints() & QPainter::Antialiasing;
+ p->setRenderHint(QPainter::Antialiasing);
+ p->fillPath(borderPath, brush);
+ p->setRenderHint(QPainter::Antialiasing, wasAntialiased);
+ } else {
+ p->fillRect(originRect(rect, origin), brush);
+ }
}
drawBackgroundImage(p, rect, off);
- unsetClip(p);
}
void QRenderRule::drawFrame(QPainter *p, const QRect& rect)
@@ -1525,7 +1381,7 @@ void QRenderRule::configurePalette(QPalette *p, QPalette::ColorGroup cg, const Q
/* For embedded widgets (ComboBox, SpinBox and ScrollArea) we want the embedded widget
* to be transparent when we have a transparent background or border image */
if ((hasBackground() && background()->isTransparent())
- || (hasBorder() && border()->hasBorderImage() && border()->borderImage()->middleRect.isValid()))
+ || (hasBorder() && border()->hasBorderImage() && !border()->borderImage()->pixmap.isNull()))
p->setBrush(cg, w->backgroundRole(), Qt::NoBrush);
}
@@ -1708,7 +1564,7 @@ QVector<QCss::StyleRule> QStyleSheetStyle::styleRules(const QWidget *w) const
if (widCacheIt == styleSheetCache->constEnd()) {
parser.init(wid->styleSheet());
if (!parser.parse(&ss)) {
- parser.init(QLatin1String("* {") + wid->styleSheet() + QLatin1String("}"));
+ parser.init(QLatin1String("* {") + wid->styleSheet() + QLatin1Char('}'));
if (!parser.parse(&ss))
qWarning("Could not parse stylesheet of widget %p", wid);
}
@@ -2737,7 +2593,7 @@ static void updateWidgets(const QList<const QWidget *>& widgets)
continue;
widget->style()->polish(widget);
QEvent event(QEvent::StyleChange);
- qApp->sendEvent(widget, &event);
+ QApplication::sendEvent(widget, &event);
widget->update();
widget->updateGeometry();
}
@@ -2783,9 +2639,9 @@ QStyle *QStyleSheetStyle::baseStyle() const
{
if (base)
return base;
- if (QStyleSheetStyle *me = qobject_cast<QStyleSheetStyle *>(qApp->style()))
+ if (QStyleSheetStyle *me = qobject_cast<QStyleSheetStyle *>(QApplication::style()))
return me->base;
- return qApp->style();
+ return QApplication::style();
}
void QStyleSheetStyle::widgetDestroyed(QObject *o)
@@ -2855,14 +2711,10 @@ void QStyleSheetStyle::polish(QWidget *w)
QRenderRule rule = renderRule(sa, PseudoElement_None, PseudoClass_Enabled);
if ((rule.hasBorder() && rule.border()->hasBorderImage())
|| (rule.hasBackground() && !rule.background()->pixmap.isNull())) {
- QObject::disconnect(sa->horizontalScrollBar(), SIGNAL(valueChanged(int)),
- sa, SLOT(update()));
- QObject::disconnect(sa->verticalScrollBar(), SIGNAL(valueChanged(int)),
- sa, SLOT(update()));
QObject::connect(sa->horizontalScrollBar(), SIGNAL(valueChanged(int)),
- sa, SLOT(update()));
+ sa, SLOT(update()), Qt::UniqueConnection);
QObject::connect(sa->verticalScrollBar(), SIGNAL(valueChanged(int)),
- sa, SLOT(update()));
+ sa, SLOT(update()), Qt::UniqueConnection);
}
}
#endif
@@ -2876,12 +2728,6 @@ void QStyleSheetStyle::polish(QWidget *w)
QRenderRule rule = renderRule(w, PseudoElement_None, PseudoClass_Any);
if (rule.hasDrawable() || rule.hasBox()) {
if (w->metaObject() == &QWidget::staticMetaObject
-#ifndef QT_NO_MENUBAR
- || qobject_cast<QMenuBar *>(w)
-#endif
-#ifndef QT_NO_MENU
- || qobject_cast<QMenu *>(w)
-#endif
#ifndef QT_NO_ITEMVIEWS
|| qobject_cast<QHeaderView *>(w)
#endif
@@ -2897,6 +2743,9 @@ void QStyleSheetStyle::polish(QWidget *w)
#ifndef QT_NO_MDIAREA
|| qobject_cast<QMdiSubWindow *>(w)
#endif
+#ifndef QT_NO_MENUBAR
+ || qobject_cast<QMenuBar *>(w)
+#endif
|| qobject_cast<QDialog *>(w)) {
w->setAttribute(Qt::WA_StyledBackground, true);
}
@@ -3013,7 +2862,7 @@ void QStyleSheetStyle::drawComplexControl(ComplexControl cc, const QStyleOptionC
rule.drawBackgroundImage(p, cmbOpt.rect);
rule.configurePalette(&cmbOpt.palette, QPalette::ButtonText, QPalette::Button);
bool customDropDown = (opt->subControls & QStyle::SC_ComboBoxArrow)
- && hasStyleRule(w, PseudoElement_ComboBoxDropDown);
+ && (hasStyleRule(w, PseudoElement_ComboBoxDropDown) || hasStyleRule(w, PseudoElement_ComboBoxArrow));
if (customDropDown)
cmbOpt.subControls &= ~QStyle::SC_ComboBoxArrow;
if (rule.baseStyleCanDraw()) {
@@ -3054,16 +2903,16 @@ void QStyleSheetStyle::drawComplexControl(ComplexControl cc, const QStyleOptionC
bool customUp = true, customDown = true;
QRenderRule upRule = renderRule(w, opt, PseudoElement_SpinBoxUpButton);
QRenderRule downRule = renderRule(w, opt, PseudoElement_SpinBoxDownButton);
- bool upRuleMatch = upRule.hasGeometry();
- bool downRuleMatch = downRule.hasGeometry();
+ bool upRuleMatch = upRule.hasGeometry() || upRule.hasPosition();
+ bool downRuleMatch = downRule.hasGeometry() || downRule.hasPosition();
if (rule.hasNativeBorder() && !upRuleMatch && !downRuleMatch) {
rule.drawBackgroundImage(p, spinOpt.rect);
customUp = (opt->subControls & QStyle::SC_SpinBoxUp)
- && hasStyleRule(w, PseudoElement_SpinBoxUpButton);
+ && (hasStyleRule(w, PseudoElement_SpinBoxUpButton) || hasStyleRule(w, PseudoElement_UpArrow));
if (customUp)
spinOpt.subControls &= ~QStyle::SC_SpinBoxUp;
customDown = (opt->subControls & QStyle::SC_SpinBoxDown)
- && hasStyleRule(w, PseudoElement_SpinBoxDownButton);
+ && (hasStyleRule(w, PseudoElement_SpinBoxDownButton) || hasStyleRule(w, PseudoElement_DownArrow));
if (customDown)
spinOpt.subControls &= ~QStyle::SC_SpinBoxDown;
if (rule.baseStyleCanDraw()) {
@@ -3189,6 +3038,7 @@ void QStyleSheetStyle::drawComplexControl(ComplexControl cc, const QStyleOptionC
if (const QStyleOptionToolButton *tool = qstyleoption_cast<const QStyleOptionToolButton *>(opt)) {
QStyleOptionToolButton toolOpt(*tool);
rule.configurePalette(&toolOpt.palette, QPalette::ButtonText, QPalette::Button);
+ toolOpt.font = rule.font.resolve(toolOpt.font);
toolOpt.rect = rule.borderRect(opt->rect);
bool customArrow = (tool->features & (QStyleOptionToolButton::HasMenu | QStyleOptionToolButton::MenuButtonPopup));
bool customDropDown = tool->features & QStyleOptionToolButton::MenuButtonPopup;
@@ -3348,7 +3198,7 @@ void QStyleSheetStyle::drawComplexControl(ComplexControl cc, const QStyleOptionC
if (subRule.hasDrawable()) {
QRect rect = subRule.boxRect(subControlRect(CC_MdiControls, opt, control, w), Margin);
subRule.drawRule(p, rect);
- QIcon icon = standardIcon(subControlIcon(layoutButton));
+ QIcon icon = standardIcon(subControlIcon(layoutButton), opt);
icon.paint(p, subRule.contentsRect(rect), Qt::AlignCenter);
} else {
optCopy.subControls |= control;
@@ -3618,6 +3468,7 @@ void QStyleSheetStyle::drawControl(ControlElement ce, const QStyleOption *opt, Q
case CE_MenuEmptyArea:
case CE_MenuBarEmptyArea:
if (rule.hasDrawable()) {
+ // Drawn by PE_Widget
return;
}
break;
@@ -3735,7 +3586,7 @@ void QStyleSheetStyle::drawControl(ControlElement ce, const QStyleOption *opt, Q
mi.rect = positionRect(w, subRule, subRule2, PseudoElement_MenuRightArrow, opt->rect, mi.direction);
drawPrimitive(arrow, &mi, p, w);
}
- } else if (hasStyleRule(w, PseudoElement_MenuCheckMark)) {
+ } else if (hasStyleRule(w, PseudoElement_MenuCheckMark) || hasStyleRule(w, PseudoElement_MenuRightArrow)) {
QWindowsStyle::drawControl(ce, &mi, p, w);
} else {
if (rule.hasDrawable() && !subRule.hasDrawable() && !(opt->state & QStyle::State_Selected)) {
@@ -3768,6 +3619,11 @@ void QStyleSheetStyle::drawControl(ControlElement ce, const QStyleOption *opt, Q
subRule.drawRule(p, opt->rect);
QCommonStyle::drawControl(ce, &mi, p, w);
} else {
+ if (rule.hasDrawable() && !(opt->state & QStyle::State_Selected)) {
+ // So that the menu bar background is not hidden by the items
+ mi.palette.setColor(QPalette::Window, Qt::transparent);
+ mi.palette.setColor(QPalette::Button, Qt::transparent);
+ }
baseStyle()->drawControl(ce, &mi, p, w);
}
}
@@ -3789,9 +3645,9 @@ void QStyleSheetStyle::drawControl(ControlElement ce, const QStyleOption *opt, Q
QPixmap pixmap = cb->currentIcon.pixmap(cb->iconSize, mode);
QRect iconRect(editRect);
iconRect.setWidth(cb->iconSize.width());
- iconRect = alignedRect(QApplication::layoutDirection(),
- Qt::AlignLeft | Qt::AlignVCenter,
- iconRect.size(), editRect);
+ iconRect = alignedRect(cb->direction,
+ Qt::AlignLeft | Qt::AlignVCenter,
+ iconRect.size(), editRect);
drawItemPixmap(p, iconRect, Qt::AlignCenter, pixmap);
if (cb->direction == Qt::RightToLeft)
@@ -4092,7 +3948,7 @@ void QStyleSheetStyle::drawControl(ControlElement ce, const QStyleOption *opt, Q
QFont oldFont = p->font();
if (subRule.hasFont)
p->setFont(subRule.font);
- if (subRule.hasBox()) {
+ if (subRule.hasBox() || !subRule.hasNativeBorder()) {
tabCopy.rect = ce == CE_TabBarTabShape ? subRule.borderRect(r)
: subRule.contentsRect(r);
QWindowsStyle::drawControl(ce, &tabCopy, p, w);
@@ -4164,9 +4020,8 @@ void QStyleSheetStyle::drawControl(ControlElement ce, const QStyleOption *opt, Q
rule.configurePalette(&frmOpt.palette, QPalette::Text, QPalette::Base);
frmOpt.rect = rule.borderRect(frmOpt.rect);
baseStyle()->drawControl(ce, &frmOpt, p, w);
- } else {
- rule.drawBorder(p, rule.borderRect(opt->rect));
}
+ // else, borders are already drawn in PE_Widget
}
return;
@@ -4220,12 +4075,6 @@ void QStyleSheetStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *op
QRect rect = opt->rect;
switch (pe) {
- case PE_PanelStatusBar:
- if (rule.hasDrawable()) {
- rule.drawRule(p, opt->rect);
- return;
- }
- break;
case PE_FrameStatusBar: {
QRenderRule subRule = renderRule(w->parentWidget(), opt, PseudoElement_Item);
@@ -4337,7 +4186,7 @@ void QStyleSheetStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *op
return;
case PE_Widget:
- if (!rule.hasBackground()) {
+ if (!rule.hasDrawable()) {
QWidget *container = containerWidget(w);
if (autoFillDisabledWidgets->contains(container)
&& (container == w || !renderRule(container, opt).hasBackground())) {
@@ -4347,26 +4196,30 @@ void QStyleSheetStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *op
}
break;
}
-
#ifndef QT_NO_SCROLLAREA
if (const QAbstractScrollArea *sa = qobject_cast<const QAbstractScrollArea *>(w)) {
const QAbstractScrollAreaPrivate *sap = sa->d_func();
rule.drawBackground(p, opt->rect, sap->contentsOffset());
- } else
+ if (rule.hasBorder())
+ rule.drawBorder(p, rule.borderRect(opt->rect));
+ break;
+ }
#endif
- {
- rule.drawBackground(p, opt->rect);
+ //fall tghought
+ case PE_PanelMenu:
+ case PE_PanelStatusBar:
+ if(rule.hasDrawable()) {
+ rule.drawRule(p, opt->rect);
+ return;
}
+ break;
- return;
-
- case PE_FrameMenu:
case PE_PanelMenuBar:
- if (!rule.hasNativeBorder()) {
- rule.drawBorder(p, rule.borderRect(opt->rect));
- return;
- }
- break;
+ if (rule.hasDrawable()) {
+ // Drawn by PE_Widget
+ return;
+ }
+ break;
case PE_IndicatorToolBarSeparator:
case PE_IndicatorToolBarHandle: {
@@ -4510,6 +4363,22 @@ void QStyleSheetStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *op
pseudoElement = PseudoElement_ScrollAreaCorner;
break;
+ case PE_IndicatorSpinDown:
+ case PE_IndicatorSpinMinus:
+ pseudoElement = PseudoElement_SpinBoxDownArrow;
+ break;
+
+ case PE_IndicatorSpinUp:
+ case PE_IndicatorSpinPlus:
+ pseudoElement = PseudoElement_SpinBoxUpArrow;
+ break;
+#ifndef QT_NO_TABBAR
+ case PE_IndicatorTabClose:
+ if (w)
+ w = w->parentWidget(); //match on the QTabBar instead of the CloseButton
+ pseudoElement = PseudoElement_TabBarTabCloseButton;
+#endif
+
default:
break;
}
@@ -4973,13 +4842,10 @@ QSize QStyleSheetStyle::sizeFromContents(ContentsType ct, const QStyleOption *op
if ((pe == PseudoElement_MenuSeparator) && subRule.hasContentsSize()) {
return QSize(sz.width(), subRule.size().height());
} else if ((pe == PseudoElement_Item) && (subRule.hasBox() || subRule.hasBorder())) {
- int width = csz.width(), height = qMax(csz.height(), mi->fontMetrics.height());
- if (!mi->icon.isNull()) {
- int iconExtent = pixelMetric(PM_SmallIconSize);
- height = qMax(height, mi->icon.actualSize(QSize(iconExtent, iconExtent)).height());
- }
- width += mi->tabWidth;
- return subRule.boxSize(csz.expandedTo(subRule.minimumContentsSize()));
+ int width = csz.width();
+ if (mi->text.contains(QLatin1Char('\t')))
+ width += 12; //as in QCommonStyle
+ return subRule.boxSize(subRule.adjustSize(QSize(width, csz.height())));
}
}
break;
@@ -5246,6 +5112,18 @@ int QStyleSheetStyle::styleHint(StyleHint sh, const QStyleOption *opt, const QWi
#endif // QT_NO_TABWIDGET
s = QLatin1String("alignment");
break;
+#ifndef QT_NO_TABBAR
+ case SH_TabBar_CloseButtonPosition:
+ rule = renderRule(w, opt, PseudoElement_TabBarTabCloseButton);
+ if (rule.hasPosition()) {
+ Qt::Alignment align = rule.position()->position;
+ if (align & Qt::AlignLeft || align & Qt::AlignTop)
+ return QTabBar::LeftSide;
+ if (align & Qt::AlignRight || align & Qt::AlignBottom)
+ return QTabBar::RightSide;
+ }
+ break;
+#endif
case SH_TabBar_ElideMode: s = QLatin1String("tabbar-elide-mode"); break;
case SH_TabBar_PreferNoArrows: s = QLatin1String("tabbar-prefer-no-arrows"); break;
case SH_ComboBox_PopupFrameStyle:
@@ -5331,8 +5209,8 @@ QRect QStyleSheetStyle::subControlRect(ComplexControl cc, const QStyleOptionComp
QRenderRule upRule = renderRule(w, opt, PseudoElement_SpinBoxUpButton);
QRenderRule downRule = renderRule(w, opt, PseudoElement_SpinBoxDownButton);
bool ruleMatch = rule.hasBox() || !rule.hasNativeBorder();
- bool upRuleMatch = upRule.hasGeometry();
- bool downRuleMatch = downRule.hasGeometry();
+ bool upRuleMatch = upRule.hasGeometry() || upRule.hasPosition();
+ bool downRuleMatch = downRule.hasGeometry() || upRule.hasPosition();
if (ruleMatch || upRuleMatch || downRuleMatch) {
switch (sc) {
case SC_SpinBoxFrame:
@@ -5824,6 +5702,15 @@ QRect QStyleSheetStyle::subElementRect(SubElement se, const QStyleOption *opt, c
}
break;
}
+ case SE_TabBarTabText:
+ case SE_TabBarTabLeftButton:
+ case SE_TabBarTabRightButton: {
+ QRenderRule subRule = renderRule(w, opt, PseudoElement_TabBarTab);
+ if (subRule.hasBox() || !subRule.hasNativeBorder()) {
+ return ParentStyle::subElementRect(se, opt, w);
+ }
+ break;
+ }
#endif // QT_NO_TABBAR
case SE_DockWidgetCloseButton:
@@ -5890,13 +5777,11 @@ void QStyleSheetStyle::clearWidgetFont(QWidget* w) const
w->setProperty("_q_styleSheetWidgetFont", QVariant(QVariant::Invalid));
}
-// Returns the palette that should be used when the particular widget is focused.
-// This needs to be called by some widgets that do drawing themselves instead
-// of through the style.
-// ### This should be removed ideally by Qt 4.5, and at least by Qt 5, and fixed
-// for good by letting the style draw everything.
+// Polish palette that should be used for a particular widget, with particular states
+// (eg. :focus, :hover, ...)
+// this is called by widgets that paint themself in their paint event
// Returns true if there is a new palette in pal.
-bool QStyleSheetStyle::focusPalette(const QWidget* w, const QStyleOption* opt, QPalette* pal)
+bool QStyleSheetStyle::styleSheetPalette(const QWidget* w, const QStyleOption* opt, QPalette* pal)
{
if (!w || !opt || !pal)
return false;
diff --git a/src/gui/styles/qstylesheetstyle_default.cpp b/src/gui/styles/qstylesheetstyle_default.cpp
index 9f0cf2b..3d2dee4 100644
--- a/src/gui/styles/qstylesheetstyle_default.cpp
+++ b/src/gui/styles/qstylesheetstyle_default.cpp
@@ -1,7 +1,6 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the QtGui module of the Qt Toolkit.
@@ -21,9 +20,10 @@
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.1, included in the file LGPL_EXCEPTION.txt in this
+** package.
**
** If you have questions regarding the use of this file, please contact
** Nokia at qt-info@nokia.com.
@@ -154,11 +154,12 @@ StyleSheet QStyleSheetStyle::getDefaultStyleSheet() const
Value value;
Pseudo pseudo;
AttributeSelector attr;
-
+
// pixmap based style doesn't support any features
bool styleIsPixmapBased = baseStyle()->inherits("QMacStyle")
|| baseStyle()->inherits("QWindowsXPStyle")
- || baseStyle()->inherits("QGtkStyle");
+ || baseStyle()->inherits("QGtkStyle")
+ || baseStyle()->inherits("QS60Style");
/*QLineEdit {
@@ -212,7 +213,7 @@ StyleSheet QStyleSheetStyle::getDefaultStyleSheet() const
ADD_BASIC_SELECTOR;
ADD_SELECTOR;
-
+
SET_PROPERTY(QLatin1String("padding-top"), PaddingTop);
ADD_VALUE(Value::Identifier, QString::fromLatin1("2px"));
ADD_DECLARATION;
diff --git a/src/gui/styles/qstylesheetstyle_p.h b/src/gui/styles/qstylesheetstyle_p.h
index ab638c0..824c107 100644
--- a/src/gui/styles/qstylesheetstyle_p.h
+++ b/src/gui/styles/qstylesheetstyle_p.h
@@ -1,7 +1,6 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the QtGui module of the Qt Toolkit.
@@ -21,9 +20,10 @@
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.1, included in the file LGPL_EXCEPTION.txt in this
+** package.
**
** If you have questions regarding the use of this file, please contact
** Nokia at qt-info@nokia.com.
@@ -131,7 +131,7 @@ public:
void saveWidgetFont(QWidget* w, const QFont& font) const;
void clearWidgetFont(QWidget* w) const;
- bool focusPalette(const QWidget* w, const QStyleOption* opt, QPalette* pal);
+ bool styleSheetPalette(const QWidget* w, const QStyleOption* opt, QPalette* pal);
protected Q_SLOTS:
QIcon standardIconImplementation(StandardPixmap standardIcon, const QStyleOption *opt = 0,
diff --git a/src/gui/styles/qwindowscestyle.cpp b/src/gui/styles/qwindowscestyle.cpp
index 1142c0f..46630bf 100644
--- a/src/gui/styles/qwindowscestyle.cpp
+++ b/src/gui/styles/qwindowscestyle.cpp
@@ -1,7 +1,6 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the QtGui module of the Qt Toolkit.
@@ -21,9 +20,10 @@
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.1, included in the file LGPL_EXCEPTION.txt in this
+** package.
**
** If you have questions regarding the use of this file, please contact
** Nokia at qt-info@nokia.com.
@@ -56,7 +56,6 @@
QT_BEGIN_NAMESPACE
static const int windowsItemFrame = 2; // menu item frame width
-static const int windowsSepHeight = 9; // separator item height
static const int windowsItemHMargin = 3; // menu item hor text margin
static const int windowsItemVMargin = 2; // menu item ver text margin
static const int windowsArrowHMargin = 6; // arrow horizontal margin
@@ -2295,6 +2294,9 @@ int QWindowsCEStyle::styleHint(StyleHint hint, const QStyleOption *opt, const QW
break;
case SH_EtchDisabledText:
ret = false;
+ case SH_RequestSoftwareInputPanel:
+ ret = RSIP_OnMouseClick;
+ break;
default:
ret = QWindowsStyle::styleHint(hint, opt, widget, returnData);
break;
diff --git a/src/gui/styles/qwindowscestyle.h b/src/gui/styles/qwindowscestyle.h
index dabb320..29d344d 100644
--- a/src/gui/styles/qwindowscestyle.h
+++ b/src/gui/styles/qwindowscestyle.h
@@ -1,7 +1,6 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the QtGui module of the Qt Toolkit.
@@ -21,9 +20,10 @@
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.1, included in the file LGPL_EXCEPTION.txt in this
+** package.
**
** If you have questions regarding the use of this file, please contact
** Nokia at qt-info@nokia.com.
diff --git a/src/gui/styles/qwindowscestyle_p.h b/src/gui/styles/qwindowscestyle_p.h
index 07fdc7e..552e288 100644
--- a/src/gui/styles/qwindowscestyle_p.h
+++ b/src/gui/styles/qwindowscestyle_p.h
@@ -1,7 +1,6 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the QtGui module of the Qt Toolkit.
@@ -21,9 +20,10 @@
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.1, included in the file LGPL_EXCEPTION.txt in this
+** package.
**
** If you have questions regarding the use of this file, please contact
** Nokia at qt-info@nokia.com.
diff --git a/src/gui/styles/qwindowsmobilestyle.cpp b/src/gui/styles/qwindowsmobilestyle.cpp
index 32e39b2..00e27ab 100644
--- a/src/gui/styles/qwindowsmobilestyle.cpp
+++ b/src/gui/styles/qwindowsmobilestyle.cpp
@@ -1,7 +1,6 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the QtGui module of the Qt Toolkit.
@@ -21,9 +20,10 @@
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.1, included in the file LGPL_EXCEPTION.txt in this
+** package.
**
** If you have questions regarding the use of this file, please contact
** Nokia at qt-info@nokia.com.
@@ -72,21 +72,17 @@
#include "qdebug.h"
#include "qtabwidget.h"
-#ifdef Q_OS_WINCE
+#ifdef Q_WS_WINCE
#include "qt_windows.h"
#include "qguifunctions_wince.h"
-extern bool qt_wince_is_high_dpi(); //defined in qguifunctions_wince.cpp
-extern bool qt_wince_is_smartphone(); //defined in qguifunctions_wince.cpp
-#endif // Q_OS_WINCE
+extern bool qt_wince_is_high_dpi(); //defined in qguifunctions_wince.cpp
+extern bool qt_wince_is_smartphone(); //defined in qguifunctions_wince.cpp
+extern bool qt_wince_is_windows_mobile_65(); //defined in qguifunctions_wince.cpp
+#endif // Q_WS_WINCE
QT_BEGIN_NAMESPACE
static const int windowsItemFrame = 1; // menu item frame width
-static const int windowsItemHMargin = 2; // menu item hor text margin
-static const int windowsItemVMargin = 2; // menu item ver text margin
-static const int windowsArrowHMargin = 6; // arrow horizontal margin
-static const int windowsRightBorder = 15; // right border on windows
-static const int windowsCheckMarkWidth = 14; // checkmarks width on windows
static const int windowsMobileitemViewCheckBoxSize = 13;
static const int windowsMobileFrameGroupBoxOffset = 9;
@@ -669,10 +665,3841 @@ static const char * const min_small_xpm[] = {
" ++++++++++++ ",
" "};
+#ifdef Q_WS_WINCE_WM
+
+static char * sbhandleup_xpm[] = {
+"26 41 45 1",
+" c None",
+". c #000000",
+"+ c #E7E7E7",
+"@ c #D6D7D6",
+"# c #949294",
+"$ c #737573",
+"% c #636563",
+"& c #636163",
+"* c #5A5D5A",
+"= c #5A595A",
+"- c #525552",
+"; c #525152",
+"> c #4A4D4A",
+", c #7B797B",
+"' c #CECFCE",
+") c #CED3CE",
+"! c #6B6D6B",
+"~ c #6B696B",
+"{ c #737173",
+"] c #7B7D7B",
+"^ c #848684",
+"/ c #848284",
+"( c #8C8A8C",
+"_ c #8C8E8C",
+": c #B5B2B5",
+"< c #FFFFFF",
+"[ c #949694",
+"} c #B5B6B5",
+"| c #9C9A9C",
+"1 c #ADAEAD",
+"2 c #9C9E9C",
+"3 c #BDBABD",
+"4 c #BDBEBD",
+"5 c #F7F3F7",
+"6 c #C6C3C6",
+"7 c #C6C7C6",
+"8 c #A5A2A5",
+"9 c #CECBCE",
+"0 c #FFFBFF",
+"a c #ADAAAD",
+"b c #A5A6A5",
+"c c #D6D3D6",
+"d c #B5BAB5",
+"e c #DEDFDE",
+"f c #DEDBDE",
+"..........................",
+"+@#$%%&&&**===---;;;;>=,'+",
+"+@#$%%&&&**===---;;;;>=$'+",
+")$!!~~%%&&&**===---;;;;>;'",
+"#{$]],,$${{{!!~~%%%&&&*-;]",
+"#{$]],,$${{{!!~~%%%&&&*-;]",
+",$^//]],,$${{{!!~~%%%&&*;*",
+",,(^^//]],$${!!!!!~~%%%&-*",
+",,(^^//]],$${!!!!!~~%%%&-*",
+"]]_((^^//]$!%%~!{{!!~~%%-*",
+"//#__((^^]{:<<:~!{{{!!~~=*",
+"//#__((^^]{:<<:~!{{{!!~~=&",
+"//###__(/$:<<<<:~{${{!!~*&",
+"^^[[##_^]:<<<<<<}!{$${{!*%",
+"^^[[##_^]:<<<<<<}!{$${{!*%",
+"((|[[#_/:<<<<<<<<}!$$${{&~",
+"((||[#^1<<<<1:<<<<}!$$$$&~",
+"((||[#^1<<<<1:<<<<}!$$$$&~",
+"__2|#(1<<<<}],}<<<<}{$,$%~",
+"##2|_1<<<<}^((]3<<<<}{$,~!",
+"##2|_1<<<<}^((]3<<<<}{$,~!",
+"##2#1<<<<3^###(/4<<<<}{,~{",
+"##2#1<<<<3^###(/4<<<<}{,~!",
+"[[2_5<<<4(#|[[#_/6<<<<,,!{",
+"[|2_5<<4_[||||[[_/7<<<,]{$",
+"[|2_5<<4_[||||[[_/7<<<,]{$",
+"||8_5<6#|2222|||[_/9<<,]{$",
+"228#06[28888222||[_/'<,/$,",
+"228#06[28888222||[_/'<,/$,",
+"22a|6[8bbbb88822||[(/c](,]",
+"881b8baaabbbb88222|[(^(_,]",
+"881b8baaabbbb88222|[(^(_,]",
+"88111111aaabbb88822|[###]/",
+"bb:::11111aaabbb8822||[[/^",
+"bb:::11111aaabbb8822||[[//",
+"bb:::::1111aaabbb8822||[/(",
+"3a1::::::1111aaabb8822|_^8",
+"da1::::::1111aaabb8822|_^8",
+"e1aaabbbb888822||[[##__((@",
+"+e4:aaabbbb88822||[[[#[b@+",
+"+e4:aaabbbb88822||[[[#[bf+"};
+
+static char * sbhandledown_xpm[] = {
+"26 40 46 1",
+" c None",
+". c #E7E7E7",
+"+ c #DEDFDE",
+"@ c #BDBEBD",
+"# c #B5B2B5",
+"$ c #ADAAAD",
+"% c #A5A6A5",
+"& c #A5A2A5",
+"* c #9C9E9C",
+"= c #9C9A9C",
+"- c #949694",
+"; c #949294",
+"> c #D6D7D6",
+", c #DEDBDE",
+"' c #D6DBD6",
+") c #ADAEAD",
+"! c #8C8E8C",
+"~ c #8C8A8C",
+"{ c #BDBABD",
+"] c #848684",
+"^ c #B5BAB5",
+"/ c #848284",
+"( c #848A84",
+"_ c #7B7D7B",
+": c #7B797B",
+"< c #C6C3C6",
+"[ c #D6D3D6",
+"} c #FFFBFF",
+"| c #CECFCE",
+"1 c #FFFFFF",
+"2 c #737573",
+"3 c #F7F3F7",
+"4 c #CECBCE",
+"5 c #737173",
+"6 c #C6C7C6",
+"7 c #6B6D6B",
+"8 c #B5B6B5",
+"9 c #6B696B",
+"0 c #636563",
+"a c #636163",
+"b c #5A5D5A",
+"c c #5A595A",
+"d c #525552",
+"e c #525152",
+"f c #4A4D4A",
+"g c #C6CBC6",
+".+@#$$$%%%%&&&**==---;-%>.",
+".+@#$$$%%%%&&&**==---;-%,.",
+"')$$$%%%%&&&&**==--;;!!~~>",
+"{$)######))))$$$%%&&**=!]&",
+"^$)######))))$$$%%&&**=!]&",
+"%%#####))))$$$%%%&&**==-/(",
+"%%###)))))$$$%%%&&**==--/]",
+"%%###)))))$$$%%%&&**==--//",
+"&&))))))$$$%%%&&&**=-;;;_/",
+"&&)%&%$$$%%%%&&***=-~]~!:_",
+"&&)%&%$$$%%%%&&***=-~]~!:_",
+"**$=<-&%%%%&&&**==-~/[_~:_",
+"**&;}<-*&&&&***==-!/|1:/2:",
+"**&;}<-*&&&&***==-!/|1:/2:",
+"==&!31<;=****===-!/411:_5:",
+"-=*!311@!-====--!/6111:_52",
+"-=*!311@!-====--!/6111:_52",
+"--*!3111@~;=--;!/<1111::75",
+";;*;)1111{];;;~/@111185:95",
+";;*;)1111{];;;~/@111185:97",
+";;*=!)11118]~~_{1111852:97",
+";;*=!)11118]~~_{1111852:97",
+"!!*=;~)11118_:81111852:207",
+"~~==-;])1111)#1111872222a9",
+"~~==-;])1111)#1111872222a9",
+"~~=--;!/#111111118722255a0",
+"]]--;;!]_#11111187522557b0",
+"]]--;;!]_#11111187522557b0",
+"//;;;!!~/2#1111#95255779ba",
+"//;!!~~]]_5#11#975557799cb",
+"//;!!~~]]_5#11#975557799ca",
+"__!~~]]//_27009755779900db",
+"::~]]//__:2257777799000adb",
+"::~]]//__:2257777799000adb",
+":2]//__::225557799000aabeb",
+";52__::225557799000aaabde_",
+";52__::225557799000aaabde_",
+"[2779900aaabbcccdddeeeefeg",
+".>;200aaabbcccdddeeeefc:|.",
+".>;200aaabbcccdddeeeefc2|."};
+
+static char * sbgripdown_xpm[] = {
+"26 34 39 1",
+" c None",
+". c #949294",
+"+ c #9C9E9C",
+"@ c #9C9A9C",
+"# c #949694",
+"$ c #8C8E8C",
+"% c #8C8A8C",
+"& c #848684",
+"* c #848284",
+"= c #7B7D7B",
+"- c #7B797B",
+"; c #6B696B",
+"> c #636563",
+", c #737573",
+"' c #636163",
+") c #737173",
+"! c #5A5D5A",
+"~ c #6B6D6B",
+"{ c #5A595A",
+"] c #B5B6B5",
+"^ c #BDBEBD",
+"/ c #ADAEAD",
+"( c #BDBABD",
+"_ c #525552",
+": c #313031",
+"< c #525152",
+"[ c #ADAAAD",
+"} c #BDBAB5",
+"| c #4A4D4A",
+"1 c #4A494A",
+"2 c #C6C3C6",
+"3 c #C6CBC6",
+"4 c #E7E7E7",
+"5 c #DEDFDE",
+"6 c #E7E3E7",
+"7 c #DEE3DE",
+"8 c #CECBCE",
+"9 c #8C928C",
+"0 c #CECFCE",
+"..+++@@@###...$$%&&**==-;>",
+"$.++@@@@##...$$%%&**==-->>",
+"$$+@@@@###..$$%%&&*==--,>>",
+"$$@@@@###..$$%%&&**==-,,>'",
+"%%@@@###..$$$%&&**==--,,''",
+"%%@@###..$$$%&&**==--,,)''",
+"%%@###...$$%%&&*==--,,))'!",
+"&&###...$$%%&&**==--,)))!!",
+"&&##...$$%%&&**==--,,))~!!",
+"&&#...$$%%&&**==--,,))~~!{",
+"**...$$%%&&**==--,,))~~;!{",
+"**..$$%%&&**===--,)))~~;{{",
+"**.$$%%&]^&===//,,))~~;;{{",
+"==$$%%&&]^*==-((,))~~;;>{_",
+"==$%%&&***::--,,::~~;;;>__",
+"==%%&&&**=::-,,)::~~;;>>__",
+"--%&&&**==--,,)))~~;;>>>__",
+"--&&&**==--,,)))~~;;>>>'_<",
+",-&&**==]^-,))[[~;;>>>''<<",
+",,&**==-]^-)))}};;>>>'''<<",
+",,**==--,,::)~~;::>>'''!<<",
+"))*==--,,)::~~;;::>'''!!<|",
+"))==--,,)))~~;;;>>'''!!!||",
+"))=--,,)))~~;;;>>'''!!!{||",
+"~~--,,)))~~;;;>>'''!!!{{||",
+"~~-,,)))~~;;>>>'''!!!{{{|1",
+";;,,)))~~;;>>>'''!!!{{{_1<",
+"~;,)))~~;;>>>'''!!!{{{__1'",
+"%>~))~~;;>>>'''!!!{{{__|1$",
+"2>>~~~;;>>>''!!!{{{{__<113",
+"4%'';;;>>>''!!!{{{{__<11%4",
+"45-!!'>>>''!!!{{{{_<|11)64",
+"447+!{{___<<<||||1111|+444",
+"444489~__<<<||||111>$04444"};
+
+static char * sbgripup_xpm[] = {
+"26 34 38 1",
+" c None",
+". c #E7E7E7",
+"+ c #D6DBD6",
+"@ c #C6C7C6",
+"# c #B5B6B5",
+"$ c #ADAEAD",
+"% c #ADAAAD",
+"& c #A5A6A5",
+"* c #A5A2A5",
+"= c #BDBEBD",
+"- c #DEDFDE",
+"; c #C6CBC6",
+"> c #9C9E9C",
+", c #E7E3E7",
+"' c #BDBABD",
+") c #B5B2B5",
+"! c #9C9A9C",
+"~ c #DEE3DE",
+"{ c #949694",
+"] c #D6D7D6",
+"^ c #949294",
+"/ c #DEDBDE",
+"( c #8C8E8C",
+"_ c #8C8A8C",
+": c #848684",
+"< c #D6D3CE",
+"[ c #CECBCE",
+"} c #D6D3D6",
+"| c #848284",
+"1 c #313031",
+"2 c #7B7D7B",
+"3 c #CECFCE",
+"4 c #CECBC6",
+"5 c #7B797B",
+"6 c #737573",
+"7 c #737173",
+"8 c #6B6D6B",
+"9 c #6B696B",
+"....+@#$$%%%%&&&***$=-....",
+"...;$$$$$%%%&&&&**>>>>@...",
+".,'$$)#'#####)))$$$%*!!$~.",
+".=$)#'''####))))$$$%%*!{'.",
+"]$$''''#####)))$$$%%%&*{^/",
+"=$#'''#####)))$$$$%%&&&!^#",
+"$$'''#####))))$$$%%%&&*>(!",
+"$$''#####))))$$$%%%&&&*>(^",
+"$$######))))$$$$%%&&&**>(_",
+"%$#####))))$$$$%%%&&***>__",
+"%$####))))$$$$%%%&&&**>>__",
+"%%###)))))$$$%%%&&&**>>>_:",
+"%%##))))<])$$%[[&&***>>!::",
+"%%#)))))<]$$%%}<&&**>>!!:|",
+"&%)))))$$$11%%&&11*>>>!!:|",
+"&&))))$$$$11%&&&11*>>!!{||",
+"&&)))$$$$$%%%&&&**>>!!!{|2",
+"&&))$$$$$%%%&&&**>>>!!{{|2",
+"*&)$$$$$3]%&&&4@*>>!!{{{22",
+"**$$$$$%3]%&&&<<>>!!!{{^25",
+"**$$$$%%%%11&**>11!!{{^^25",
+"**$$$%%%%&11***>11!!{{^^55",
+"**$$%%%%&&&***>>!!!{{^^(55",
+">>$%%%%&&&***>>>!!{{^^((56",
+">>%%%%&&&&***>>!!!{{^^((66",
+">>%%%&&&&***>>!!!{{^^((_67",
+"!>%%&&&&***>>>!!{{{^^(__67",
+"!!%&&&&***>>>!!!{{^^((_:77",
+"!!&&&&***>>>!!!{{^^((__:77",
+"!!&&&****>>!!!{{^^^(__::78",
+"{!&&****>>>!!{{{^^((_::|88",
+"{{&****>>>!!!{{^^((__:||88",
+"{{****>>>!!!{{^^^(__::|289",
+"{{***>>>!!!{{{^^((_::||289"};
+
+static char * sbgripmiddle_xpm[] = {
+"26 2 12 1",
+" c None",
+". c #949294",
+"+ c #A5A2A5",
+"@ c #9C9E9C",
+"# c #9C9A9C",
+"$ c #949694",
+"% c #8C8E8C",
+"& c #8C8A8C",
+"* c #848684",
+"= c #848284",
+"- c #7B7D7B",
+"; c #6B696B",
+"..++@@@###$$$..%%&&*==--;;",
+"..++@@@###$$$..%%&&*==--;;"};
+
+
+static char * listviewhighmiddle_xpm[] = {
+"8 46 197 2",
+" c None",
+". c #66759E",
+"+ c #6C789D",
+"@ c #6A789E",
+"# c #6B789E",
+"$ c #6A779D",
+"% c #6C789C",
+"& c #6F7D9B",
+"* c #6F7D9A",
+"= c #9DB6EE",
+"- c #9DB6ED",
+"; c #9CB6ED",
+"> c #A1B6EF",
+", c #A2B6F0",
+"' c #93AAE9",
+") c #95ABEA",
+"! c #94ABEA",
+"~ c #94A9E8",
+"{ c #8BA8EA",
+"] c #8BA7EA",
+"^ c #8AA7EA",
+"/ c #8EAAE8",
+"( c #8FAAE8",
+"_ c #88A2E7",
+": c #8CA3E8",
+"< c #8BA3E7",
+"[ c #8BA3E8",
+"} c #8BA2E7",
+"| c #8CA2E7",
+"1 c #8DA2E7",
+"2 c #87A1E8",
+"3 c #87A1E9",
+"4 c #86A0E8",
+"5 c #86A1E7",
+"6 c #87A2E7",
+"7 c #859EE9",
+"8 c #849DE9",
+"9 c #869EE9",
+"0 c #869FE9",
+"a c #7C9BEA",
+"b c #7C9CEA",
+"c c #7B9CEA",
+"d c #7C9BE9",
+"e c #7E9CE9",
+"f c #7B9AEA",
+"g c #7C99E9",
+"h c #7C9AEA",
+"i c #7B9AE8",
+"j c #7A9AEA",
+"k c #7996E1",
+"l c #7C96E4",
+"m c #7B96E3",
+"n c #7B95E3",
+"o c #7E95E5",
+"p c #7E95E6",
+"q c #7292E1",
+"r c #7490DF",
+"s c #7591E0",
+"t c #7590DF",
+"u c #7392E1",
+"v c #6D8CDE",
+"w c #6F8EDD",
+"x c #6E8DDD",
+"y c #6E8DDE",
+"z c #6F8EDE",
+"A c #6E8EDE",
+"B c #718EDD",
+"C c #728EDD",
+"D c #6B89E0",
+"E c #6C89DF",
+"F c #6D89E0",
+"G c #6D89DF",
+"H c #6C88DF",
+"I c #6D88DF",
+"J c #6D86DD",
+"K c #6086E0",
+"L c #6686E0",
+"M c #6586E0",
+"N c #6486E0",
+"O c #6485E0",
+"P c #6786DF",
+"Q c #5F85E0",
+"R c #6583DE",
+"S c #6683DE",
+"T c #6682DD",
+"U c #6086DF",
+"V c #5F86E0",
+"W c #567ED7",
+"X c #567ED8",
+"Y c #557DD7",
+"Z c #5A7FD8",
+"` c #6281DA",
+" . c #5379D9",
+".. c #5278D9",
+"+. c #547BD8",
+"@. c #4C73D7",
+"#. c #4B72D2",
+"$. c #4C73D4",
+"%. c #4C73D3",
+"&. c #4B72D4",
+"*. c #4F75D3",
+"=. c #5074D2",
+"-. c #4971D0",
+";. c #4871D0",
+">. c #335ECF",
+",. c #325ECB",
+"'. c #335ECD",
+"). c #335ECE",
+"!. c #325DCD",
+"~. c #2E59C9",
+"{. c #3059C9",
+"]. c #2F59C9",
+"^. c #2F59C8",
+"/. c #2B59CA",
+"(. c #3355C6",
+"_. c #3354C5",
+":. c #3156C7",
+"<. c #3056C7",
+"[. c #3355C7",
+"}. c #3355C5",
+"|. c #254EBF",
+"1. c #1F51C1",
+"2. c #234FC0",
+"3. c #234FBF",
+"4. c #2350C0",
+"5. c #1E50BE",
+"6. c #1D50C0",
+"7. c #264DBE",
+"8. c #264CBD",
+"9. c #254DBE",
+"0. c #244EBF",
+"a. c #254DBF",
+"b. c #234CBF",
+"c. c #244CC0",
+"d. c #244BC0",
+"e. c #234BC0",
+"f. c #234BBF",
+"g. c #234CBE",
+"h. c #2049B7",
+"i. c #2A49B5",
+"j. c #2749B5",
+"k. c #2749B6",
+"l. c #2D49B4",
+"m. c #2649B6",
+"n. c #2946B5",
+"o. c #2A48B6",
+"p. c #2947B5",
+"q. c #2946B6",
+"r. c #2848B6",
+"s. c #2549B5",
+"t. c #2648B6",
+"u. c #2744B5",
+"v. c #2744B4",
+"w. c #2744AF",
+"x. c #2543B4",
+"y. c #2543B2",
+"z. c #2442B2",
+"A. c #2442B3",
+"B. c #2442B5",
+"C. c #2543B3",
+"D. c #1F40B1",
+"E. c #1E40B1",
+"F. c #243EAE",
+"G. c #273BAC",
+"H. c #263DAC",
+"I. c #253CAB",
+"J. c #273CAB",
+"K. c #273CAC",
+"L. c #263BAA",
+"M. c #253CAE",
+"N. c #263BA6",
+"O. c #253BA5",
+"P. c #253AA5",
+"Q. c #253BA6",
+"R. c #253CA7",
+"S. c #263AA6",
+"T. c #243CA6",
+"U. c #253CA5",
+"V. c #273BA8",
+"W. c #2F4DA4",
+"X. c #2F4DA3",
+"Y. c #1B2F85",
+"Z. c #B5B5B6",
+"`. c #B5B5B5",
+" + c #B5B6B6",
+".+ c #B5B4B6",
+"++ c #C2C3C5",
+"@+ c #C0C3C3",
+"#+ c #C1C3C4",
+"$+ c #E3E3E3",
+"%+ c #E3E3E4",
+"&+ c #E4E3E4",
+"*+ c #E2E3E4",
+"=+ c #ECEEEB",
+"-+ c #EBEDEA",
+";+ c #EEF0ED",
+">+ c #EFF0EE",
+". + @ @ # # $ % ",
+"& & * & & & & & ",
+"= = - = = ; > , ",
+"' ) ! ! ! ) ' ~ ",
+"{ ] { { { ^ / ( ",
+"_ : < [ : } | 1 ",
+"2 2 2 3 2 4 5 6 ",
+"7 7 7 7 7 8 9 0 ",
+"a b a a a c d e ",
+"f g h h h h i j ",
+"k l m m m n o p ",
+"q q q q q q q q ",
+"r r s s s t q u ",
+"v w x y z A B C ",
+"D E F F G F H I ",
+"J K L M N O P Q ",
+"R R S S S T U V ",
+"W W X X X Y Z ` ",
+" . . . . ...+.W ",
+" . . . . ..... .",
+"@.#.$.$.%.&.*.=.",
+"-.-.;.-.-.-.-.-.",
+">.,.'.).).!.!.>.",
+"~.{.].^.].^././.",
+"(.(.(.(.(._.:.<.",
+"(.(.[.[.[.[.(.}.",
+"|.1.2.3.3.4.5.6.",
+"7.7.7.7.7.8.9.0.",
+"a.b.c.d.c.e.f.g.",
+"h.i.j.k.j.k.l.m.",
+"n.o.p.q.r.p.s.t.",
+"u.u.v.u.u.u.u.u.",
+"w.x.y.z.A.y.B.C.",
+"D.D.E.D.D.D.D.D.",
+"D.D.E.D.D.D.D.D.",
+"F.G.H.I.J.K.L.M.",
+"N.N.O.N.N.P.Q.R.",
+"N.N.S.N.N.N.N.N.",
+"T.N.T.T.T.U.N.V.",
+"W.W.X.W.W.W.W.W.",
+"W.W.W.W.W.W.W.W.",
+"Y.Y.Y.Y.Y.Y.Y.Y.",
+"Z.`. + +.+Z.`.`.",
+"++@+#+#+#+#+@+@+",
+"$+%+&+&+*+%+%+%+",
+"=+-+;+-+-+>+-+-+"};
+
+
+
+static char * listviewhighcornerleft_xpm[] = {
+"100 46 1475 2",
+" c None",
+". c #FBFBFC",
+"+ c #E8EAE7",
+"@ c #758DC3",
+"# c #42599E",
+"$ c #28418A",
+"% c #19418F",
+"& c #3F5695",
+"* c #415896",
+"= c #435A98",
+"- c #445C99",
+"; c #465E9B",
+"> c #48609B",
+", c #49629C",
+"' c #4A639D",
+") c #49639D",
+"! c #4A629D",
+"~ c #4B639D",
+"{ c #4B649D",
+"] c #4C659D",
+"^ c #4D669D",
+"/ c #4E689D",
+"( c #506A9D",
+"_ c #516A9D",
+": c #536B9C",
+"< c #546C9C",
+"[ c #566D9B",
+"} c #576D9B",
+"| c #586E9C",
+"1 c #5B6F9D",
+"2 c #61739D",
+"3 c #63749E",
+"4 c #64749E",
+"5 c #68769E",
+"6 c #6A779E",
+"7 c #6B789E",
+"8 c #66759E",
+"9 c #6C789D",
+"0 c #EEF0ED",
+"a c #D0D3DC",
+"b c #3E51A3",
+"c c #28428B",
+"d c #29428C",
+"e c #425996",
+"f c #455C99",
+"g c #485F9C",
+"h c #49619E",
+"i c #4A63A0",
+"j c #4B64A1",
+"k c #4B65A1",
+"l c #4C66A2",
+"m c #4D67A2",
+"n c #4F69A1",
+"o c #516AA1",
+"p c #536CA0",
+"q c #556DA1",
+"r c #576EA0",
+"s c #586F9F",
+"t c #586E9F",
+"u c #596F9E",
+"v c #5A6F9E",
+"w c #5C709E",
+"x c #5E719E",
+"y c #5F729F",
+"z c #62739F",
+"A c #63739E",
+"B c #64749D",
+"C c #65749E",
+"D c #69769D",
+"E c #6C799E",
+"F c #6D799F",
+"G c #707D9F",
+"H c #717F9E",
+"I c #6E7AA1",
+"J c #6C789E",
+"K c #6F7C9C",
+"L c #6F7D9B",
+"M c #2A4AA0",
+"N c #4971D0",
+"O c #4C72D8",
+"P c #5472C0",
+"Q c #5573BF",
+"R c #5774BF",
+"S c #5875BF",
+"T c #5976C1",
+"U c #5A76C1",
+"V c #5C78C2",
+"W c #5E7AC2",
+"X c #607CC3",
+"Y c #627EC3",
+"Z c #637FC4",
+"` c #6581C5",
+" . c #6682C6",
+".. c #6783C7",
+"+. c #6984C8",
+"@. c #6B85C9",
+"#. c #6D87CA",
+"$. c #6F89CB",
+"%. c #718CCD",
+"&. c #748ECF",
+"*. c #7690D0",
+"=. c #7992D2",
+"-. c #7A93D3",
+";. c #7C95D5",
+">. c #7F98D7",
+",. c #8099D8",
+"'. c #859CDB",
+"). c #8AA0DD",
+"!. c #8DA3DF",
+"~. c #8FA5E0",
+"{. c #90A5E0",
+"]. c #91A6E1",
+"^. c #91A5E1",
+"/. c #90A4E0",
+"(. c #8EA3DE",
+"_. c #92A6E2",
+":. c #8FA4DF",
+"<. c #90A5DE",
+"[. c #90A5DC",
+"}. c #90A6DB",
+"|. c #91A6E0",
+"1. c #93A7E2",
+"2. c #95AAE6",
+"3. c #99AEEA",
+"4. c #9AB2EA",
+"5. c #99B1E9",
+"6. c #99B1E7",
+"7. c #98AFE6",
+"8. c #93A8E2",
+"9. c #97ACE7",
+"0. c #9AB3EB",
+"a. c #9DB5ED",
+"b. c #9DB6EE",
+"c. c #375095",
+"d. c #4056AD",
+"e. c #506DCD",
+"f. c #4360CC",
+"g. c #345ED6",
+"h. c #335ECF",
+"i. c #355ED6",
+"j. c #355FD6",
+"k. c #365FD6",
+"l. c #355FD0",
+"m. c #3760D5",
+"n. c #3A63D4",
+"o. c #3C63D1",
+"p. c #3B63CD",
+"q. c #3B63C9",
+"r. c #3B62C9",
+"s. c #3D63C8",
+"t. c #4065C5",
+"u. c #4567C5",
+"v. c #496BC5",
+"w. c #4F70C7",
+"x. c #5273C8",
+"y. c #5475CA",
+"z. c #5777CB",
+"A. c #5879CD",
+"B. c #5A7BCE",
+"C. c #5D7DCF",
+"D. c #5F7ECF",
+"E. c #617FD0",
+"F. c #6381D1",
+"G. c #6583D2",
+"H. c #6785D2",
+"I. c #6886D3",
+"J. c #6A88D4",
+"K. c #6C89D5",
+"L. c #6E8BD6",
+"M. c #708CD7",
+"N. c #718DD8",
+"O. c #738EDA",
+"P. c #748FDB",
+"Q. c #7691DC",
+"R. c #7893DD",
+"S. c #7994DD",
+"T. c #7A96DE",
+"U. c #7B97DF",
+"V. c #7C98E0",
+"W. c #7E9AE2",
+"X. c #7F9BE3",
+"Y. c #829DE4",
+"Z. c #849FE5",
+"`. c #87A0E6",
+" + c #88A1E7",
+".+ c #89A2E6",
+"++ c #8CA3E7",
+"@+ c #8EA5E9",
+"#+ c #8EA6E9",
+"$+ c #8FA7E9",
+"%+ c #8FA8E8",
+"&+ c #8FA9E8",
+"*+ c #91A9E8",
+"=+ c #90A7E8",
+"-+ c #8FA8EA",
+";+ c #90AAEA",
+">+ c #93ABEA",
+",+ c #95ABEA",
+"'+ c #93ABE9",
+")+ c #94ABEA",
+"!+ c #90A9EA",
+"~+ c #93AAE9",
+"{+ c #273E7E",
+"]+ c #345ED5",
+"^+ c #3D60CE",
+"/+ c #3D60CF",
+"(+ c #345ECF",
+"_+ c #335ED0",
+":+ c #355FD3",
+"<+ c #3A60CE",
+"[+ c #3A5FCB",
+"}+ c #385FC9",
+"|+ c #3B60C8",
+"1+ c #3C63CB",
+"2+ c #3E64CB",
+"3+ c #4166CA",
+"4+ c #4568C9",
+"5+ c #4A6CC7",
+"6+ c #4F71C8",
+"7+ c #5172CA",
+"8+ c #5475CE",
+"9+ c #5678D3",
+"0+ c #597CD6",
+"a+ c #5C7ED7",
+"b+ c #5E7FD8",
+"c+ c #6181D9",
+"d+ c #6383DA",
+"e+ c #6585DA",
+"f+ c #6786DB",
+"g+ c #6988DC",
+"h+ c #6B8ADD",
+"i+ c #6D8BDE",
+"j+ c #6F8DDE",
+"k+ c #718EDF",
+"l+ c #728FE0",
+"m+ c #7390E1",
+"n+ c #7390E2",
+"o+ c #7491E3",
+"p+ c #7592E4",
+"q+ c #7693E4",
+"r+ c #7794E5",
+"s+ c #7894E5",
+"t+ c #7995E6",
+"u+ c #7B96E6",
+"v+ c #7C97E7",
+"w+ c #7D9AE8",
+"x+ c #7F9CE9",
+"y+ c #829DE9",
+"z+ c #849EE9",
+"A+ c #859EE9",
+"B+ c #87A0E7",
+"C+ c #8AA2E7",
+"D+ c #8BA3E8",
+"E+ c #89A2E7",
+"F+ c #8CA6EA",
+"G+ c #8BA6EA",
+"H+ c #8BA7EA",
+"I+ c #8CA3E8",
+"J+ c #8BA8EA",
+"K+ c #8CA7EA",
+"L+ c #8CA8EA",
+"M+ c #4659C7",
+"N+ c #355ECF",
+"O+ c #3660CF",
+"P+ c #3860CE",
+"Q+ c #3961CD",
+"R+ c #3B61CB",
+"S+ c #3B61CA",
+"T+ c #3D62CA",
+"U+ c #3D63CA",
+"V+ c #4165CB",
+"W+ c #456ACB",
+"X+ c #4B6FCD",
+"Y+ c #5174CE",
+"Z+ c #5275D1",
+"`+ c #5477D4",
+" @ c #5678D9",
+".@ c #587ADB",
+"+@ c #597BDB",
+"@@ c #5B7DDC",
+"#@ c #5E7FDC",
+"$@ c #6081DD",
+"%@ c #6283DE",
+"&@ c #6484DF",
+"*@ c #6787E0",
+"=@ c #6989E1",
+"-@ c #6B8BE1",
+";@ c #6D8DE2",
+">@ c #6F8EE3",
+",@ c #718FE4",
+"'@ c #7290E4",
+")@ c #7491E5",
+"!@ c #7692E6",
+"~@ c #7793E5",
+"{@ c #7894E6",
+"]@ c #7895E7",
+"^@ c #7996E8",
+"/@ c #7A97E8",
+"(@ c #7B98E9",
+"_@ c #7D99E8",
+":@ c #7F9AE8",
+"<@ c #7F9BE9",
+"[@ c #7F9CEA",
+"}@ c #859EE8",
+"|@ c #859FE8",
+"1@ c #85A0E9",
+"2@ c #869FE9",
+"3@ c #86A1E7",
+"4@ c #86A0E9",
+"5@ c #87A1E7",
+"6@ c #88A2E7",
+"7@ c #87A1E9",
+"8@ c #5A6FCA",
+"9@ c #365FCF",
+"0@ c #345ED0",
+"a@ c #385FCC",
+"b@ c #385FCE",
+"c@ c #3A61CC",
+"d@ c #3B62CD",
+"e@ c #3E64CD",
+"f@ c #4167CF",
+"g@ c #4469CF",
+"h@ c #486CD1",
+"i@ c #4D71D2",
+"j@ c #5175D4",
+"k@ c #5376D6",
+"l@ c #5578DA",
+"m@ c #5679DC",
+"n@ c #587BDD",
+"o@ c #5A7DDE",
+"p@ c #5D80DE",
+"q@ c #5F82DF",
+"r@ c #6284DF",
+"s@ c #6585E0",
+"t@ c #6787E1",
+"u@ c #6988E2",
+"v@ c #6B8AE2",
+"w@ c #6D8CE3",
+"x@ c #6E8DE3",
+"y@ c #708EE4",
+"z@ c #718FE3",
+"A@ c #7391E4",
+"B@ c #7592E5",
+"C@ c #7895E5",
+"D@ c #7996E6",
+"E@ c #7A97E6",
+"F@ c #7B98E7",
+"G@ c #7A98E8",
+"H@ c #7B99E9",
+"I@ c #7E9AE9",
+"J@ c #7D9AE9",
+"K@ c #7E9AEA",
+"L@ c #809CE9",
+"M@ c #819DE8",
+"N@ c #7F9BEA",
+"O@ c #819DE9",
+"P@ c #819CE9",
+"Q@ c #839EE9",
+"R@ c #839EE8",
+"S@ c #839DEA",
+"T@ c #859FE9",
+"U@ c #87A0E8",
+"V@ c #86A0E8",
+"W@ c #87A1E8",
+"X@ c #3760CF",
+"Y@ c #3A61CE",
+"Z@ c #3A62CD",
+"`@ c #3F66CE",
+" # c #4368D0",
+".# c #466CD2",
+"+# c #496DD5",
+"@# c #4E72D6",
+"## c #5175D8",
+"$# c #5276DA",
+"%# c #5578DC",
+"&# c #577ADC",
+"*# c #597CDD",
+"=# c #5B7DDD",
+"-# c #5D7FDE",
+";# c #5E81DE",
+"># c #6183DF",
+",# c #6386DF",
+"'# c #6687E0",
+")# c #6888E0",
+"!# c #6A89E1",
+"~# c #6C8AE1",
+"{# c #6E8CE2",
+"]# c #6F8DE2",
+"^# c #7390E4",
+"/# c #7390E3",
+"(# c #7491E4",
+"_# c #7693E5",
+":# c #7895E6",
+"<# c #7896E6",
+"[# c #7997E7",
+"}# c #7B97E7",
+"|# c #7B98E8",
+"1# c #7C98E8",
+"2# c #7E9BE9",
+"3# c #809CEA",
+"4# c #819CEA",
+"5# c #839DE9",
+"6# c #365FD0",
+"7# c #3660D0",
+"8# c #3961CF",
+"9# c #3B63CF",
+"0# c #3D64D0",
+"a# c #4067D0",
+"b# c #4469D2",
+"c# c #466BD3",
+"d# c #496ED5",
+"e# c #4C71D6",
+"f# c #4E72D8",
+"g# c #5074D9",
+"h# c #5376DB",
+"i# c #5578DB",
+"j# c #587ADC",
+"k# c #5B7CDC",
+"l# c #5D7EDD",
+"m# c #5F80DD",
+"n# c #6081DE",
+"o# c #6383DE",
+"p# c #6686DF",
+"q# c #6887E0",
+"r# c #6988E0",
+"s# c #6B89E1",
+"t# c #6C8AE0",
+"u# c #6E8CE1",
+"v# c #708EE2",
+"w# c #718FE2",
+"x# c #7290E3",
+"y# c #7391E2",
+"z# c #7492E1",
+"A# c #7592E2",
+"B# c #7691E3",
+"C# c #7591E3",
+"D# c #7692E3",
+"E# c #7693E3",
+"F# c #7793E4",
+"G# c #7893E4",
+"H# c #7994E5",
+"I# c #7D97E8",
+"J# c #7E98E8",
+"K# c #7D98E8",
+"L# c #7D99E9",
+"M# c #7D9BEA",
+"N# c #7D9CEA",
+"O# c #7E99E8",
+"P# c #7D9AEA",
+"Q# c #7C9BEA",
+"R# c #7C9CEA",
+"S# c #355FCF",
+"T# c #3860D0",
+"U# c #3A62D0",
+"V# c #3C64D1",
+"W# c #4167D1",
+"X# c #4369D3",
+"Y# c #466BD4",
+"Z# c #486DD5",
+"`# c #4A6ED7",
+" $ c #4C70D8",
+".$ c #5478D9",
+"+$ c #577BDA",
+"@$ c #597DDB",
+"#$ c #5B7EDB",
+"$$ c #5D7FDC",
+"%$ c #6182DE",
+"&$ c #6284DE",
+"*$ c #6485DF",
+"=$ c #6586DF",
+"-$ c #6787DF",
+";$ c #6888DF",
+">$ c #6A8ADF",
+",$ c #6C8BE0",
+"'$ c #6D8CE0",
+")$ c #6E8DE1",
+"!$ c #6F8DE1",
+"~$ c #708EE1",
+"{$ c #718FE0",
+"]$ c #728FE1",
+"^$ c #7390E0",
+"/$ c #738FE0",
+"($ c #7490E1",
+"_$ c #7590E1",
+":$ c #7591E1",
+"<$ c #7592E1",
+"[$ c #7692E2",
+"}$ c #7794E2",
+"|$ c #7894E3",
+"1$ c #7996E3",
+"2$ c #7A96E5",
+"3$ c #7B98E6",
+"4$ c #7B9AE8",
+"5$ c #7C99E8",
+"6$ c #7C96E5",
+"7$ c #7D97E7",
+"8$ c #7C99E9",
+"9$ c #7B9AE9",
+"0$ c #7B9AEA",
+"a$ c #5B6DCF",
+"b$ c #305EC8",
+"c$ c #335ECE",
+"d$ c #305ECA",
+"e$ c #345FCF",
+"f$ c #3761D0",
+"g$ c #3A62D1",
+"h$ c #3C64D2",
+"i$ c #4066D3",
+"j$ c #466BD5",
+"k$ c #486ED6",
+"l$ c #4A6ED6",
+"m$ c #4D71D8",
+"n$ c #4F72D9",
+"o$ c #5073D9",
+"p$ c #4F72D8",
+"q$ c #5074D8",
+"r$ c #5276D9",
+"s$ c #587ADA",
+"t$ c #5B7CDB",
+"u$ c #5D7EDC",
+"v$ c #5F7FDD",
+"w$ c #6081DC",
+"x$ c #6182DD",
+"y$ c #6283DD",
+"z$ c #6484DE",
+"A$ c #6585DD",
+"B$ c #6787DE",
+"C$ c #6988DF",
+"D$ c #6A89DE",
+"E$ c #6C8ADF",
+"F$ c #6D8BDF",
+"G$ c #6E8CE0",
+"H$ c #6F8DE0",
+"I$ c #718EE0",
+"J$ c #728FDF",
+"K$ c #728FDE",
+"L$ c #7290E0",
+"M$ c #7190E0",
+"N$ c #7291E0",
+"O$ c #7191E0",
+"P$ c #7392E1",
+"Q$ c #7493E1",
+"R$ c #7594E1",
+"S$ c #7594E2",
+"T$ c #7694E2",
+"U$ c #7695E2",
+"V$ c #7A96E4",
+"W$ c #7895E2",
+"X$ c #7A96E2",
+"Y$ c #7A96E3",
+"Z$ c #7B96E3",
+"`$ c #7996E1",
+" % c #7C96E4",
+".% c #305EC9",
+"+% c #315ECC",
+"@% c #325ECE",
+"#% c #3760D0",
+"$% c #3962D1",
+"%% c #3E66D3",
+"&% c #4268D4",
+"*% c #446BD5",
+"=% c #476CD6",
+"-% c #496ED7",
+";% c #4B6FD7",
+">% c #4C70D7",
+",% c #4E71D7",
+"'% c #5074D7",
+")% c #5276D8",
+"!% c #5376D8",
+"~% c #5779DA",
+"{% c #597ADA",
+"]% c #5A7BDB",
+"^% c #5B7CDA",
+"/% c #5D7EDB",
+"(% c #5E7FDB",
+"_% c #6182DB",
+":% c #6384DC",
+"<% c #6586DD",
+"[% c #6686DC",
+"}% c #6887DD",
+"|% c #6988DD",
+"1% c #6A8ADE",
+"2% c #6B8BDE",
+"3% c #6C8CDE",
+"4% c #6E8DDF",
+"5% c #6E8CDF",
+"6% c #6D8DDF",
+"7% c #6C8BDF",
+"8% c #6F8DDF",
+"9% c #718FDF",
+"0% c #7290DF",
+"a% c #7391E0",
+"b% c #7491E0",
+"c% c #7292E1",
+"d% c #3959C5",
+"e% c #345BC5",
+"f% c #315EC8",
+"g% c #355BC5",
+"h% c #325EC8",
+"i% c #315ECB",
+"j% c #345DCC",
+"k% c #335ECD",
+"l% c #345ECD",
+"m% c #355FCE",
+"n% c #3862D0",
+"o% c #3E66D2",
+"p% c #456BD5",
+"q% c #476CD5",
+"r% c #4B6ED7",
+"s% c #4B6FD6",
+"t% c #4B6FD5",
+"u% c #4D71D6",
+"v% c #5073D7",
+"w% c #5174D7",
+"x% c #5275D8",
+"y% c #5577D8",
+"z% c #5678D8",
+"A% c #5779D9",
+"B% c #587AD8",
+"C% c #597CD9",
+"D% c #5B7DD9",
+"E% c #5D7FDA",
+"F% c #5F80DB",
+"G% c #6182DC",
+"H% c #6484DC",
+"I% c #6585DC",
+"J% c #6787DD",
+"K% c #6988DE",
+"L% c #6B8ADE",
+"M% c #6B8ADF",
+"N% c #6989DE",
+"O% c #6B89DE",
+"P% c #6E8BDF",
+"Q% c #708CDE",
+"R% c #708DDF",
+"S% c #708FDF",
+"T% c #728EDF",
+"U% c #6F8EDD",
+"V% c #728EDD",
+"W% c #7390DF",
+"X% c #7490DF",
+"Y% c #335DC8",
+"Z% c #3759C5",
+"`% c #3859C5",
+" & c #335EC8",
+".& c #325DCA",
+"+& c #345CCB",
+"@& c #335DCC",
+"#& c #345DCD",
+"$& c #355FCD",
+"%& c #3861D0",
+"&& c #3B64D1",
+"*& c #3E65D2",
+"=& c #4168D3",
+"-& c #456AD5",
+";& c #4B6ED5",
+">& c #4C6FD4",
+",& c #4D70D5",
+"'& c #4F72D6",
+")& c #5173D6",
+"!& c #5375D7",
+"~& c #5476D8",
+"{& c #5577D7",
+"]& c #5477D8",
+"^& c #5677D8",
+"/& c #5879D9",
+"(& c #597AD9",
+"_& c #5C7DDA",
+":& c #6080DC",
+"<& c #6080DB",
+"[& c #6181DC",
+"}& c #6282DC",
+"|& c #6383DD",
+"1& c #6484DD",
+"2& c #6686DE",
+"3& c #6685DE",
+"4& c #6786DE",
+"5& c #6687DE",
+"6& c #6887DE",
+"7& c #6987DE",
+"8& c #6788DF",
+"9& c #6785DF",
+"0& c #6B89DF",
+"a& c #6C89DF",
+"b& c #6F8DDD",
+"c& c #6D8CDE",
+"d& c #445BBB",
+"e& c #3759BE",
+"f& c #375AC6",
+"g& c #355CC8",
+"h& c #345CCA",
+"i& c #355ECC",
+"j& c #365FCD",
+"k& c #3761CE",
+"l& c #3A63D0",
+"m& c #3D65D1",
+"n& c #466AD4",
+"o& c #476BD4",
+"p& c #486CD3",
+"q& c #4A6ED4",
+"r& c #4B6ED4",
+"s& c #4E71D6",
+"t& c #4F71D5",
+"u& c #5072D6",
+"v& c #5274D7",
+"w& c #5273D7",
+"x& c #5274D6",
+"y& c #5476D7",
+"z& c #5779D8",
+"A& c #587AD9",
+"B& c #5A7CDA",
+"C& c #5C7DDB",
+"D& c #5D7EDA",
+"E& c #6081DA",
+"F& c #6181DB",
+"G& c #6283DC",
+"H& c #6483DD",
+"I& c #6483DE",
+"J& c #6585DE",
+"K& c #6786DF",
+"L& c #6886DE",
+"M& c #6887DF",
+"N& c #6987DF",
+"O& c #6A88DF",
+"P& c #6786E0",
+"Q& c #6A86DE",
+"R& c #6B89E0",
+"S& c #365BC8",
+"T& c #365CC8",
+"U& c #375DCA",
+"V& c #375FCB",
+"W& c #3860CD",
+"X& c #3C63D0",
+"Y& c #4167D2",
+"Z& c #4268D2",
+"`& c #4368D2",
+" * c #4367D2",
+".* c #4568D2",
+"+* c #466AD2",
+"@* c #496CD3",
+"#* c #4A6DD3",
+"$* c #4A6DD4",
+"%* c #4D70D4",
+"&* c #4F72D5",
+"** c #4C70D4",
+"=* c #4E72D5",
+"-* c #5173D5",
+";* c #5375D6",
+">* c #597BDA",
+",* c #5B7DDA",
+"'* c #5C7EDB",
+")* c #5D7FDB",
+"!* c #5E80DB",
+"~* c #5E81DA",
+"{* c #5F81DB",
+"]* c #5F82DB",
+"^* c #6384DD",
+"/* c #6384DE",
+"(* c #6585DF",
+"_* c #6486E0",
+":* c #6583DD",
+"<* c #6386E0",
+"[* c #6686E0",
+"}* c #6B86DD",
+"|* c #6D86DD",
+"1* c #6086E0",
+"2* c #5573CD",
+"3* c #3959C3",
+"4* c #3959C4",
+"5* c #3759C0",
+"6* c #375BC7",
+"7* c #365CC7",
+"8* c #395FCC",
+"9* c #3B62CE",
+"0* c #3E64D0",
+"a* c #4066D1",
+"b* c #4166D1",
+"c* c #4064CF",
+"d* c #4065CF",
+"e* c #4266D0",
+"f* c #4468D1",
+"g* c #4569D1",
+"h* c #476BD2",
+"i* c #466AD1",
+"j* c #476AD2",
+"k* c #456AD1",
+"l* c #496DD2",
+"m* c #4A6FD3",
+"n* c #496ED2",
+"o* c #4B70D4",
+"p* c #4D71D4",
+"q* c #4E72D4",
+"r* c #5073D4",
+"s* c #5174D5",
+"t* c #5175D5",
+"u* c #5276D6",
+"v* c #5377D6",
+"w* c #5478D7",
+"x* c #5579D7",
+"y* c #567AD8",
+"z* c #577BD9",
+"A* c #597CD8",
+"B* c #5A7DD9",
+"C* c #5A7ED9",
+"D* c #5B7FDA",
+"E* c #5C80DA",
+"F* c #5D80DA",
+"G* c #5E81DB",
+"H* c #5D80DB",
+"I* c #6082DC",
+"J* c #6183DD",
+"K* c #6183DE",
+"L* c #6082DB",
+"M* c #6282DE",
+"N* c #6682DE",
+"O* c #6583DE",
+"P* c #3759BF",
+"Q* c #375AC2",
+"R* c #375AC1",
+"S* c #375AC4",
+"T* c #395DCA",
+"U* c #3A5ECA",
+"V* c #3C60CC",
+"W* c #3D61CD",
+"X* c #3D61CC",
+"Y* c #3C61CD",
+"Z* c #3E62CD",
+"`* c #3F64CE",
+" = c #4266CF",
+".= c #4468D0",
+"+= c #4267CF",
+"@= c #4166CE",
+"#= c #4065CE",
+"$= c #4166CD",
+"%= c #4267CE",
+"&= c #456AD0",
+"*= c #4368CE",
+"== c #4468CF",
+"-= c #4569D0",
+";= c #486BD1",
+">= c #4B6FD3",
+",= c #4C70D3",
+"'= c #4F73D4",
+")= c #5275D5",
+"!= c #5477D6",
+"~= c #577BD7",
+"{= c #587CD8",
+"]= c #577CD8",
+"^= c #597DD9",
+"/= c #5A7DDA",
+"(= c #597DDA",
+"_= c #587CDA",
+":= c #5A7EDA",
+"<= c #567BD8",
+"[= c #557AD9",
+"}= c #567BD9",
+"|= c #577CD9",
+"1= c #587DD9",
+"2= c #587ED9",
+"3= c #577ED8",
+"4= c #587DD8",
+"5= c #587ED8",
+"6= c #567ED7",
+"7= c #526ABD",
+"8= c #3759C1",
+"9= c #385BC7",
+"0= c #395CC8",
+"a= c #3B5DC9",
+"b= c #3B5ECA",
+"c= c #3A5FCA",
+"d= c #3B60CC",
+"e= c #3C61CC",
+"f= c #3D62CD",
+"g= c #3E63CD",
+"h= c #3C61CB",
+"i= c #3C61CA",
+"j= c #3D62CB",
+"k= c #3F64CC",
+"l= c #4065CD",
+"m= c #4669D0",
+"n= c #476AD0",
+"o= c #496BD1",
+"p= c #4A6DD2",
+"q= c #4B6ED2",
+"r= c #4D71D3",
+"s= c #4E73D4",
+"t= c #4F74D4",
+"u= c #5075D5",
+"v= c #5276D5",
+"w= c #5377D7",
+"x= c #5278D7",
+"y= c #5277D6",
+"z= c #5378D7",
+"A= c #5379D8",
+"B= c #5379D9",
+"C= c #5278D8",
+"D= c #5178D7",
+"E= c #3355C0",
+"F= c #3556C1",
+"G= c #395AC6",
+"H= c #385AC7",
+"I= c #395BC7",
+"J= c #395EC9",
+"K= c #395FCA",
+"L= c #3B60CA",
+"M= c #3B60CB",
+"N= c #375DC7",
+"O= c #385EC8",
+"P= c #395FC9",
+"Q= c #3A60CA",
+"R= c #3D63CC",
+"S= c #4367CF",
+"T= c #476BD1",
+"U= c #4A6ED2",
+"V= c #4B6FD2",
+"W= c #4C6FD2",
+"X= c #4D70D1",
+"Y= c #4E71D2",
+"Z= c #4E72D2",
+"`= c #4E74D4",
+" - c #4E75D5",
+".- c #4E75D4",
+"+- c #4F75D3",
+"@- c #5075D2",
+"#- c #5075D3",
+"$- c #5177D7",
+"%- c #5178D8",
+"&- c #4F75D5",
+"*- c #5076D5",
+"=- c #4F76D6",
+"-- c #5279D9",
+";- c #3C52B1",
+">- c #3656C3",
+",- c #3757C5",
+"'- c #3758C6",
+")- c #3759C6",
+"!- c #375BC6",
+"~- c #385CC7",
+"{- c #385DC8",
+"]- c #365CC6",
+"^- c #355BC6",
+"/- c #355CC6",
+"(- c #365DC7",
+"_- c #375EC8",
+":- c #375CC6",
+"<- c #385EC6",
+"[- c #3A5FC7",
+"}- c #3C60C8",
+"|- c #3D61C9",
+"1- c #3E62CA",
+"2- c #4063CC",
+"3- c #4165CE",
+"4- c #4268D0",
+"5- c #4269D1",
+"6- c #436AD2",
+"7- c #446AD2",
+"8- c #456BD2",
+"9- c #496CD1",
+"0- c #4C6CD0",
+"a- c #4D6CCF",
+"b- c #4E6DD0",
+"c- c #4F6ECF",
+"d- c #4E6FCF",
+"e- c #4C70CF",
+"f- c #4A71D0",
+"g- c #4F6FCF",
+"h- c #4B71D0",
+"i- c #4A72D1",
+"j- c #4B73D4",
+"k- c #4F70D0",
+"l- c #4C73D3",
+"m- c #4C73D6",
+"n- c #4B72D2",
+"o- c #4B71D1",
+"p- c #4C73D7",
+"q- c #3354C0",
+"r- c #3152BE",
+"s- c #3052BE",
+"t- c #3051BF",
+"u- c #2E4FBF",
+"v- c #2E4FBE",
+"w- c #2E50BF",
+"x- c #2F50BF",
+"y- c #3156C4",
+"z- c #2F56C5",
+"A- c #2E57C5",
+"B- c #2F57C5",
+"C- c #3057C6",
+"D- c #3258C6",
+"E- c #3459C7",
+"F- c #365AC7",
+"G- c #385BC8",
+"H- c #3B5DCA",
+"I- c #3B5DCB",
+"J- c #3C5ECC",
+"K- c #3C60CD",
+"L- c #3C62CE",
+"M- c #3D65D0",
+"N- c #3D66D1",
+"O- c #4166D2",
+"P- c #4667D2",
+"Q- c #4A67D1",
+"R- c #4C68D0",
+"S- c #4C69CF",
+"T- c #4D6BCE",
+"U- c #4E6DCD",
+"V- c #4E6ECE",
+"W- c #4E6DCE",
+"X- c #4970D0",
+"Y- c #4770D0",
+"Z- c #4B6BCE",
+"`- c #4A6CCE",
+" ; c #496DCF",
+".; c #476FD0",
+"+; c #4870D0",
+"@; c #486DCF",
+"#; c #242F79",
+"$; c #2F41AC",
+"%; c #2040B8",
+"&; c #2041B8",
+"*; c #2243B3",
+"=; c #2243B8",
+"-; c #2343B8",
+";; c #2444B8",
+">; c #2445B8",
+",; c #2445B6",
+"'; c #2445B7",
+"); c #2444B9",
+"!; c #2949BE",
+"~; c #2649BF",
+"{; c #234BBF",
+"]; c #224CBF",
+"^; c #224AC0",
+"/; c #244CC0",
+"(; c #254DC0",
+"_; c #254DC1",
+":; c #264DC2",
+"<; c #274EC3",
+"[; c #274CC3",
+"}; c #274DC4",
+"|; c #254DC5",
+"1; c #214EC5",
+"2; c #204FC6",
+"3; c #1F50C8",
+"4; c #2151C9",
+"5; c #2B53C8",
+"6; c #3154C7",
+"7; c #3255C6",
+"8; c #2F57C7",
+"9; c #2C58C9",
+"0; c #2D59CA",
+"a; c #2D58C9",
+"b; c #2E5BCC",
+"c; c #325ECC",
+"d; c #325ECB",
+"e; c #1F40B1",
+"f; c #1F40B2",
+"g; c #1F40B3",
+"h; c #2A44BD",
+"i; c #2845BE",
+"j; c #2745BE",
+"k; c #2646BF",
+"l; c #2546BE",
+"m; c #2347BF",
+"n; c #2147BF",
+"o; c #2048C0",
+"p; c #1D48C0",
+"q; c #1C48C0",
+"r; c #1B47C0",
+"s; c #1C48BF",
+"t; c #1E49BE",
+"u; c #214ABD",
+"v; c #244CBD",
+"w; c #264DBE",
+"x; c #254EC0",
+"y; c #214FC2",
+"z; c #1B51C5",
+"A; c #1C51C7",
+"B; c #2250C8",
+"C; c #2A52C8",
+"D; c #3254C6",
+"E; c #3355C5",
+"F; c #3154C8",
+"G; c #3355C6",
+"H; c #2F57C8",
+"I; c #2E58C9",
+"J; c #2E59C9",
+"K; c #3059C9",
+"L; c #2040B6",
+"M; c #2743BB",
+"N; c #2844BC",
+"O; c #2743BD",
+"P; c #2844BE",
+"Q; c #2844BD",
+"R; c #2346BE",
+"S; c #2047BF",
+"T; c #1E48C0",
+"U; c #1D47C0",
+"V; c #1D49BF",
+"W; c #1F49BF",
+"X; c #204ABE",
+"Y; c #254DBF",
+"Z; c #234EC0",
+"`; c #2050C1",
+" > c #1C51C3",
+".> c #1F51C6",
+"+> c #2651C8",
+"@> c #2D53C7",
+"#> c #3155C6",
+"$> c #3155C7",
+"%> c #3355C7",
+"&> c #3254C7",
+"*> c #1E40B1",
+"=> c #2141B8",
+"-> c #2442B9",
+";> c #2744BB",
+">> c #2945BB",
+",> c #2A45BB",
+"'> c #2944BA",
+")> c #2745BB",
+"!> c #2545BC",
+"~> c #2246BD",
+"{> c #2047BE",
+"]> c #1F47BD",
+"^> c #1D48BE",
+"/> c #1E49C0",
+"(> c #1F4AC0",
+"_> c #214BBF",
+":> c #244CBE",
+"<> c #254DBE",
+"[> c #244DBE",
+"}> c #224FBF",
+"|> c #2051C1",
+"1> c #2151C3",
+"2> c #2252C5",
+"3> c #2151C1",
+"4> c #2851C6",
+"5> c #2A50C6",
+"6> c #2E54C6",
+"7> c #1F51C2",
+"8> c #1D52C5",
+"9> c #2651C9",
+"0> c #2950C7",
+"a> c #2D40A5",
+"b> c #2040B0",
+"c> c #1F40B0",
+"d> c #223CAE",
+"e> c #233CAE",
+"f> c #253BAC",
+"g> c #253BAD",
+"h> c #233CB0",
+"i> c #213EB2",
+"j> c #1F3FB4",
+"k> c #1E40B6",
+"l> c #1F3FB7",
+"m> c #1E3EB8",
+"n> c #1F3FB8",
+"o> c #2040B7",
+"p> c #2141B6",
+"q> c #2140B7",
+"r> c #2241B6",
+"s> c #2342B5",
+"t> c #2442B6",
+"u> c #2543B5",
+"v> c #2643B4",
+"w> c #2544B6",
+"x> c #2346B8",
+"y> c #2247B9",
+"z> c #2048BC",
+"A> c #1F48BF",
+"B> c #2049C0",
+"C> c #214AC0",
+"D> c #224BBF",
+"E> c #234CBE",
+"F> c #244DBF",
+"G> c #234CBF",
+"H> c #264DC0",
+"I> c #274EBF",
+"J> c #264DBF",
+"K> c #254EBF",
+"L> c #2050C0",
+"M> c #1F51C1",
+"N> c #1E42A4",
+"O> c #263BA6",
+"P> c #253BA7",
+"Q> c #253CA7",
+"R> c #1E41A5",
+"S> c #1F40AF",
+"T> c #273AAC",
+"U> c #1E40B0",
+"V> c #1F40B5",
+"W> c #1F40B6",
+"X> c #1F40B8",
+"Y> c #1E40B8",
+"Z> c #1F3EB8",
+"`> c #203FB7",
+" , c #2240B6",
+"., c #2341B7",
+"+, c #2345B9",
+"@, c #2147BB",
+"#, c #2148BA",
+"$, c #2049BB",
+"%, c #2049BD",
+"&, c #2049BF",
+"*, c #224BBE",
+"=, c #244DBD",
+"-, c #244CBF",
+";, c #182969",
+">, c #273BAD",
+",, c #2739AB",
+"', c #263AAC",
+"), c #243CAE",
+"!, c #233DAE",
+"~, c #213EAF",
+"{, c #1F3FB0",
+"], c #2040B4",
+"^, c #1F3FB6",
+"/, c #1E3EB7",
+"(, c #2240B7",
+"_, c #2341B6",
+":, c #2543B4",
+"<, c #2644B3",
+"[, c #2544B5",
+"}, c #2545B5",
+"|, c #2547B6",
+"1, c #2548B7",
+"2, c #2349BA",
+"3, c #1F49BE",
+"4, c #2149BD",
+"5, c #2049BE",
+"6, c #214BBE",
+"7, c #2249BE",
+"8, c #234CBD",
+"9, c #2149BE",
+"0, c #1E49BF",
+"a, c #253BA9",
+"b, c #253BAB",
+"c, c #263AAB",
+"d, c #213DAF",
+"e, c #203EAF",
+"f, c #1D40AF",
+"g, c #1D40B0",
+"h, c #1E40B4",
+"i, c #2241B7",
+"j, c #2643B6",
+"k, c #2744B5",
+"l, c #2643B5",
+"m, c #2346B6",
+"n, c #2147B7",
+"o, c #2644B6",
+"p, c #2247B7",
+"q, c #2248B8",
+"r, c #2647B7",
+"s, c #2549B7",
+"t, c #2645B7",
+"u, c #2148B8",
+"v, c #2847B6",
+"w, c #2549B6",
+"x, c #2849B6",
+"y, c #2049B7",
+"z, c #2A49B5",
+"A, c #243BA4",
+"B, c #253BA5",
+"C, c #253BA6",
+"D, c #263AA7",
+"E, c #263AA8",
+"F, c #2739AA",
+"G, c #243CAD",
+"H, c #223DAE",
+"I, c #1F3EAF",
+"J, c #1E3FB0",
+"K, c #1D40B1",
+"L, c #1E3FB1",
+"M, c #1F3FB3",
+"N, c #1F3FB5",
+"O, c #2140B6",
+"P, c #2140B8",
+"Q, c #2744B4",
+"R, c #2746B6",
+"S, c #2947B6",
+"T, c #2946B5",
+"U, c #2A48B6",
+"V, c #3551A8",
+"W, c #1F399C",
+"X, c #143D9F",
+"Y, c #263BA5",
+"Z, c #273BA8",
+"`, c #273BAA",
+" ' c #263AAD",
+".' c #233CAD",
+"+' c #213DAE",
+"@' c #203FB2",
+"#' c #2342B6",
+"$' c #2443B6",
+"%' c #2543B6",
+"&' c #2644B5",
+"*' c #133D9E",
+"=' c #263BA7",
+"-' c #263BA9",
+";' c #273BA9",
+">' c #263AAA",
+",' c #2539AB",
+"'' c #2639AB",
+")' c #253AAC",
+"!' c #243BAD",
+"~' c #223DAF",
+"{' c #203FB0",
+"]' c #2040B1",
+"^' c #2140B3",
+"/' c #2543B1",
+"(' c #2744AF",
+"_' c #1A3CA0",
+":' c #1D3BA2",
+"<' c #233BA4",
+"[' c #263AA5",
+"}' c #253AA5",
+"|' c #263AA6",
+"1' c #263BA4",
+"2' c #243BA5",
+"3' c #263BA8",
+"4' c #223EAF",
+"5' c #3B4CA5",
+"6' c #1D379A",
+"7' c #1E389C",
+"8' c #1E399F",
+"9' c #1F3BA2",
+"0' c #1F3BA3",
+"a' c #213BA4",
+"b' c #233AA3",
+"c' c #243AA3",
+"d' c #2539A4",
+"e' c #253AA6",
+"f' c #243BA7",
+"g' c #253CAA",
+"h' c #253CAC",
+"i' c #253CAD",
+"j' c #253CAE",
+"k' c #243DAE",
+"l' c #213FAF",
+"m' c #223FAF",
+"n' c #2040AF",
+"o' c #253D93",
+"p' c #1D3894",
+"q' c #1F379A",
+"r' c #1E389B",
+"s' c #1D399C",
+"t' c #1C3A9D",
+"u' c #1B3A9D",
+"v' c #183B9E",
+"w' c #163C9E",
+"x' c #153C9E",
+"y' c #163B9D",
+"z' c #173B9D",
+"A' c #193A9D",
+"B' c #1C3A9E",
+"C' c #1F3AA1",
+"D' c #223AA4",
+"E' c #253BA8",
+"F' c #273BA7",
+"G' c #263CAB",
+"H' c #263CAC",
+"I' c #243EAE",
+"J' c #273BAC",
+"K' c #2A3795",
+"L' c #1F389B",
+"M' c #1D389B",
+"N' c #1C399C",
+"O' c #1B399C",
+"P' c #1A3A9D",
+"Q' c #1D399B",
+"R' c #1B399B",
+"S' c #1A3A9C",
+"T' c #1B3A9F",
+"U' c #1D3AA0",
+"V' c #203BA2",
+"W' c #203BA3",
+"X' c #2639A6",
+"Y' c #1B3692",
+"Z' c #1C3794",
+"`' c #1D3796",
+" ) c #1E3898",
+".) c #1E389A",
+"+) c #1F399B",
+"@) c #1A399C",
+"#) c #193A9E",
+"$) c #1A3BA0",
+"%) c #1C3BA2",
+"&) c #1D3CA3",
+"*) c #203CA4",
+"=) c #223BA5",
+"-) c #3C4699",
+";) c #2B4595",
+">) c #1C3793",
+",) c #1D3895",
+"') c #1E3897",
+")) c #1F3998",
+"!) c #1F3999",
+"~) c #1F399A",
+"{) c #1E399C",
+"]) c #1C3B9E",
+"^) c #1D3BA0",
+"/) c #1E3CA2",
+"() c #223CA5",
+"_) c #243CA6",
+":) c #596FA9",
+"<) c #3B4894",
+"[) c #314993",
+"}) c #29499F",
+"|) c #28489E",
+"1) c #2B4BA1",
+"2) c #2C4BA1",
+"3) c #2D4CA2",
+"4) c #2E4CA3",
+"5) c #2F4CA4",
+"6) c #2E4CA4",
+"7) c #2F4DA3",
+"8) c #2F4DA4",
+"9) c #D3D5D2",
+"0) c #3B4794",
+"a) c #314791",
+"b) c #304892",
+"c) c #304893",
+"d) c #2F4995",
+"e) c #2F4997",
+"f) c #2D4A9A",
+"g) c #2A4A9D",
+"h) c #294A9F",
+"i) c #284AA0",
+"j) c #294AA0",
+"k) c #2B4AA1",
+"l) c #2D4CA3",
+"m) c #C9CAC9",
+"n) c #455D9B",
+"o) c #242F78",
+"p) c #1B2F85",
+"q) c #C6C3C8",
+"r) c #B5B2B6",
+"s) c #B5B7B4",
+"t) c #B5B7B3",
+"u) c #B5B2B5",
+"v) c #B5B3B4",
+"w) c #B5B5B4",
+"x) c #B5B6B3",
+"y) c #B5B4B4",
+"z) c #B5B3B5",
+"A) c #B5B4B5",
+"B) c #B5B5B5",
+"C) c #B5B5B3",
+"D) c #B5B5B6",
+"E) c #BAC3BE",
+"F) c #B9C3BD",
+"G) c #C1C3C4",
+"H) c #BFC3C2",
+"I) c #B9C3BE",
+"J) c #BBC3BF",
+"K) c #BDC3C1",
+"L) c #C0C3C3",
+"M) c #BEC3C1",
+"N) c #C2C3C5",
+"O) c #E6E3E8",
+"P) c #E0E2DF",
+"Q) c #E1E1E1",
+"R) c #E2E1E3",
+"S) c #E4E1E6",
+"T) c #E4E2E7",
+"U) c #E4E2E6",
+"V) c #E3E3E4",
+"W) c #E2E3E3",
+"X) c #E1E3E2",
+"Y) c #E3E3E3",
+"Z) c #E3E3E2",
+"`) c #EBEDEA",
+" ! c #EAECE9",
+".! c #E9EBE8",
+"+! c #ECEEEB",
+". . + @ # $ $ $ $ $ $ $ % $ $ $ $ $ % $ $ $ $ $ $ % $ $ $ $ $ % $ $ $ $ $ $ $ $ $ % $ $ & * = - ; > , , ' ) ! ! ~ { ] ^ / ( _ : < [ } | | 1 2 3 3 4 4 4 4 4 4 4 5 6 4 4 4 5 6 7 8 9 4 5 6 7 8 9 6 7 8 9 ",
+"0 a b % $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ c d d d d $ $ $ $ $ c d e f g h i i i i j k l m n o p q r s t u v w x y z 4 A B C D 9 9 E 9 E F G H I F J K L L L L J K L L L L L L L L ",
+"@ % M N O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O P Q R S T U V W X Y Z ` ...+.@.#.$.%.&.*.=.-.;.>.,.'.).!.~.{.].^./.(._.:.<.[.}.|.1.2.3.4.5.6.7.8.9.0.a.b.b.b.b.b.b.",
+"c.$ d.O e.f.g.g.g.h.g.g.g.g.g.h.h.g.g.g.g.g.h.h.g.g.i.j.k.l.m.n.o.p.q.r.s.t.u.v.w.x.y.z.A.B.C.D.E.F.G.H.I.J.K.L.M.N.O.P.Q.R.S.T.U.V.W.X.Y.Z.`. +.+++@+#+$+@+$+%+&+*+=+$+-+;+>+,+'+)+!+;+>+,+~+,+>+,+~+,+",
+"$ {+N N f.f.f.f.h.h.h.g.f.f.h.h.h.h.g.f.f.h.h.h.h.]+^+/+(+h._+:+<+[+}+|+1+2+3+4+5+6+7+8+9+0+a+b+c+d+e+f+g+h+i+j+k+l+m+n+o+p+q+r+s+t+u+v+w+x+y+z+A+B+.+C+D+E+D+F+G+H+C+I+F+G+J+K+L+H+F+G+J+K+L+H+J+H+J+H+",
+"{+{+N N M+M+h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.N+N+h.h.(+O+P+P+Q+R+S+T+U+V+W+X+Y+Z+`+ @.@+@@@#@$@%@&@*@=@-@;@>@,@'@)@!@~@{@]@^@/@(@_@:@<@[@[@y+}@|@1@A+1@2@3@ +2@4@2@5@C+D+6@D+7@5@C+D+6@I+C+D+6@I+",
+"{+{+8@N M+M+h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.9@9@0@N+a@b@c@d@e@f@g@h@i@j@k@l@m@n@o@p@q@r@s@t@u@v@w@x@y@z@A@B@q+r+C@D@E@F@G@H@_@I@J@K@<@L@M@N@O@P@Q@R@S@T@A+A+U@V@W@W@A+2@U@V@W@W@U@V@W@W@",
+"{+{+8@N f.M+h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.(+(+(+9@9@X@Y@Z@e@`@ #.#+#@###$#%#&#*#=#-#;#>#,#'#)#!#~#{#]#z@^#/#(#p+_#r+:#s+t+<#[#}#|#|#1#_@|#_@_@2#L@3#4#y+y+5#z+z+z+5#z+z+z+z+A+A+A+A+A+",
+"{+{+8@8@f.f.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.(+6#7#8#9#0#a#b#c#d#e#f#g#h#i#j#k#l#m#n#o#&@p#q#r#s#t#u#v#w#x#x#y#y#z#A#B#C#D#E#E#F#G#H#F#H#H#u+v+I#J#K#L#J@J@M#N#O#P#M#M#M#N#M#Q#Q#R#",
+"$ {+8@e.f.f.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.S#l.7#T#U#V#W#X#Y#Z#`# $f#g###.$+$@$#$$$$@%$&$*$=$-$;$>$,$'$)$!$~$~${$]$^$/$($($_$_$:$<$_$<$[$}$|$|$1$2$2$3$}#4$5$6$7$8$8$9$8$8$8$0$8$",
+"$ {+a$e.f.f.h.h.h.h.h.h.h.h.h.b$h.c$c$c$c$c$d$c$c$c$c$c$c$c$c$c$c$e$e$7#f$g$h$i$X#j$k$l$m$n$o$p$q$r$l@s$t$u$v$w$x$y$z$A$B$C$D$E$F$G$G$H$I$J$J$K$K$J$L$L$L$L$L$M$N$O$P$Q$R$S$T$U$1$V$T$W$X$Y$1$V$Y$Z$`$ %",
+"$ $ a$a$f.f.b$b$b$b$b$b$b$b$b$b$b$b$b$b$b$b$b$b$.%b$b$b$.%d$+%+%@%h.e$l.#%$%h$%%&%*%=%-%;%>%,%'%)%!% @ @~%{%]%^%/%(%w$_%:%<%[%}%|%D$1%2%3%4%5%4%4%6%5%5%4%4%4%5%7%5%8%9%L$0%a%a%a%P$b%P$P$z#z#z#P$c%c%c%",
+"$ $ 8@e.f.f.d%b$b$b$b$b$d%b$b$b$b$b$b$e%f%b$b$b$b$b$g%h%b$.%i%i%j%k%l%m%X@n%h$o%&%p%q%`#r%s%t%u%v%w%x%y% @z%A%B%C%D%E%F%G%:%H%I%[%J%}%K%|%D$K%D$D$L%M%M%M%M%M%D$N%O%i+P%j+Q%R%S%T%0%U%V%W%W%W%W%X%X%X%X%",
+"$ $ 8@8@f.f.d%d%b$b$b$b$d%d%b$b$b$h%Y%Z%Z%h%f%f%h%Y%`%`% &h%h%.&+&@&#&$&X@%&&&*&=&-&j$Z#+#;&>&,&'&)&)&!&~&{&]&^&/&(&^%_&(%:&<&[&}&|&1&A$A$2&3&4&4&5&B$6&7&B$7&8&9&6&7&0&a&a&i+i+i+b&a&a&j+U%c&U%j+U%c&U%",
+"$ $ 8@8@d&e&d%d%d%d%d%d%d%d%d%d%d%`%d%d%d%d%`%`%`%d%d%d%d%`%`%f&g&h&j%i&j&k&l&m&=&X#Y#n&o&p&q&r&>&s&t&t&u&v&w&x&y&{&z&A&B&C&D&(%(%F%F%E&F&}&}&|&G&|&H&1&I%I&A$1&}&z$z$J&K&L&M&N&O&0&P&Q&0&a&R&a&a&a&R&a&",
+"{+$ 8@8@e&e&d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%`%f&S&T&U&V&W&Y@X&Y&Z&`& *.*+*@*#*@*r&$*#*r&%*&***=*-*;*y&z%A%z&A&A&>*B&,*,*'*)*!*!*~*{*F&}&{*}&{*]*G%G%y$^*/*J&(*2&_*:*<*=$[*}*<*=$<*|*1*",
+"{+{+8@2*e&e&d%d%d%d%d%d%d%d%d%e&3*4*4*4*4*4*5*4*4*4*4*4*4*4*4*4*`%f&6*6*7*8*9*0*a*b*c*d*e*f*g*h*i*j*+*k*h*l*m*n*m*o*p*q*r*s*t*u*v*w*x*y*y*z*A*B*C*D*E*F*G*E*G*F*H*G*F*~*]*{*I*x$J*K*L*G%K*M*o#o#I&N*O*O*",
+"{+{+8@2*e&e&e&e&e&e&e&e&e&e&e&e&e&e&e&P*e&e&e&e&e&e&P*P*e&e&e&P*P*5*Q*R*S*T*U*V*W*X*Y*Z*`*d* =.=+=@=#=$=%=g@&=*===-=i*;=l*>=,=q*'=s*)=k@!=x*~={=]=^=/=(=_=:=(=<=<=]=[=}=|=]=]=1=2=3=|=4=5=2=2=2=3=6=6=6=",
+"{+{+7=e.e&e&e&e&e&e&e&e&e&e&e&e&e&e&e&e&e&e&e&e&e&e&e&e&e&e&e&e&e&e&P*P*8=9=0=a=b=U*c=d=e=f=e@#=g=h=i=i=j=k=k=l=%===m=n=o=p=q=,=r=s=t=u=v=v*w=x=x=y=z=z=A=z=A=B=C=B=D=C=B=x=B=B=B=B=B=B=B=B=B=B=B=B=B=B=",
+"{+{+7=7=e&e&e&e&E=E=e&e&e&e&E=E=E=e&e&e&e&E=E=E=e&e&e&e&E=E=e&e&e&e&E=E=E=F=d%G=G=H=I=J=K=L=M=R+}+N=O=P=Q=j=i=h=R=e@@=S=-=T=h@l*U=V=W=X=Y=Z=`= - - -.-+-@- -#-$-%-$-&-*-$-=-%-----C=$-%---------B=B=B=B=",
+"{+{+7=7=;-;-E=E=E=E=E=E=E=E=E=E=E=E=E=E=E=E=E=E=E=E=E=E=E=E=E=E=E=E=E=E=E=E=>-,-'-)-!-6*~-{-{-]-^-/-/-(-_-:-N=<-[-}-|-1-2-3- =4-5-6-7-8-9-0-0-a-b-c-d-e-f-g-h-h-i-j-k-h-h-i-j-l-m-n-o-i-j-l-m-n-j-l-p-n-",
+"{+{+7=7=;-;-E=E=E=E=E=E=E=E=q-r-s-t-t-u-u-v-v-v-u-w-x-u-u-u-u-u-u-u-u-v-v-u-u-u-u-u-v-v-u-u-u-u-v-v-u-y-z-A-B-C-D-E-E-F-G-H-I-J-K-L-M-N-O-P-Q-R-S-T-U-U-V-W-V-e-X-Y-Z-`- ;.;Y-N N +;@;.;Y-N N N N N N N ",
+"#;#;d&d&$;$;%;%;%;%;%;%;%;%;&;*;=;-;-;-;;;>;,;>;>;>;;;>;>;>;>;>;>;>;>;>;';);>;>;>;>;>;';>;>;>;>;>;';);!;~;{;];^;/;(;_;_;:;<;[;};};|;1;2;3;4;5;6;7;8;9;9;0;a;0;0;b;h.a;0;0;b;h.c;h.d;0;b;h.c;h.d;h.c;h.d;",
+"#;#;;-;-$;$;e;e;e;e;e;e;e;e;e;e;e;f;f;f;f;e;e;e;f;f;f;f;f;f;f;f;f;f;f;f;g;%;f;f;f;f;f;g;f;f;f;f;f;g;%;h;i;j;k;l;m;n;o;p;q;r;r;s;t;u;v;w;x;y;z;A;B;C;6;D;E;F;G;G;H;I;F;G;G;H;I;J;J;K;G;H;I;J;J;K;I;J;J;K;",
+"#;#;;-;-$;$;e;e;e;e;e;e;e;e;e;e;e;e;e;e;e;e;e;e;e;e;e;e;e;e;e;e;e;e;e;e;e;L;e;e;e;e;e;e;e;e;e;e;e;e;L;M;N;O;P;Q;i;i;k;R;S;T;U;q;q;V;W;X;{;Y;Z;`; >.>+>@>#>+>$>6;#>#>+>%>&>G;G;G;G;G;&>G;G;G;G;G;G;G;G;G;",
+"#;#;d.;-$;$;e;e;e;e;e;e;e;e;e;e;e;e;e;e;e;e;e;e;e;e;e;e;e;e;e;e;e;e;e;e;e;*>e;e;e;e;e;e;e;e;e;e;e;e;*>=>->;>>>,>'>'>)>!>~>{>]>^>^>V;V;/>(>_>:><>[>}>|>1>2>3>2>4>5>6>7>8>9>0>G;G;G;G;9>0>G;G;G;G;G;G;G;G;",
+"#;#;d.d.a>a>e;e;e;e;e;e;e;e;e;e;b>b>c>c>c>c>c>b>e;e;e;e;e;e;e;e;e;e;e;e;e;e;d>e>f>g>h>i>j>k>l>l>m>m>n>n>o>o>p>q>r>r>s>t>u>v>v>u>w>';x>y>z>t;A>B>C>D>E>E>F>G>F>H>H>I>F>Y;J>w;K>L>K>M>J>w;K>L>K>M>K>L>K>M>",
+"#;#;d.d.a>a>N>e;N>O>O>O>N>e;N>O>O>P>Q>R>S>R>Q>O>O>O>N>e;N>O>O>O>N>e;N>N>O>T>e;e;e;U>U>U>U>f;V>W>o>o>o>o>X>X>Y>Y>n>n>Z>Z>`> ,.,t>t>u>u>w>+,@,#,$,%,A>&,*,=,B>[>-,w;<>C>[>-,w;w;w;w;w;-,w;w;w;w;w;w;w;w;w;",
+"#;;,;-;-a>a>N>N>N>O>O>O>N>N>N>O>O>O>O>N>N>N>O>O>O>O>N>N>N>O>O>O>N>N>N>N>O>>,,,,,,,',g>),!,~,{,{,*>U>e;f;],o>%;o>^,^,/,/,l>q>(,_,t>u>:,<,v>[,},|,1,2,%,%,3,4,5,6,7,8,9,5,6,0,G>G>Y;G>6,0,G>G>Y;G>G>G>Y;G>",
+";,;,;-;-O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>P>a,b,',',c,c,f>),e>d,e,{,{,U>U>f,f,U>U>g,g,*>g;h,^,^,`>`>q>i,t>j,k,k,l,w>m,n,o,p,q,r,s,t,p,u,v,w,x,y,z,u,v,w,x,y,z,w,x,y,z,",
+";,;,b b O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>A,A,A,B,C,D,E,F,c,',g>G,!,H,~,e,{,I,J,J,K,K,U>f,f,J,L,M,N,L;O,i,P,.,l,Q,k,k,k,k,k,k,R,v,k,k,k,R,v,S,T,U,k,R,v,S,T,U,v,S,T,U,",
+";,;,b V,W,W,X,X,O>X,X,X,X,X,O>X,X,X,X,X,X,O>X,X,X,X,X,X,O>X,X,X,X,X,O>X,X,O>O>O>O>B,B,B,B,Y,O>O>Z,`,T>T> '',g>.'+'e,{,{,e,+'+'e,e,{,J,K,e;@'N,O,#'$'%'%'j,%'j,&'k,k,%'j,&'k,k,k,k,k,&'k,k,k,k,k,k,k,k,k,",
+";,;,b V,W,W,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,*'O>O>O>O>O>O>O>O>B,B,A,A,B,C,='-'`,;'>'>',''')'!'!'e>e>~'~'~,~,{'{,*>*>e;]']']']']']'^'/']']']'^'/':,(':,]'^'/':,(':,/':,(':,",
+";,;,V,V,W,W,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,_':'<'['}'|'|'O>O>O>O>O>O>O>Y,Y,1'1'B,B,2'2'C,3'-'>'c,)')'!'),4'{'e;]'e;*>*>e;e;e;e;e;e;e;e;e;e;e;e;e;e;e;e;e;e;e;e;e;e;e;e;",
+";,;,5'5'W,W,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,W,6'6'6'7'8'9'0'a'b'c'd'd'}'}'O>O>O>O>O>O>O>O>Y,1'1'['['e'e'f'g'h'i'j'k'G,),!,l'j'm'n'b>b>),m'b>e;e;e;e;e;b>e;e;e;e;e;e;e;e;e;",
+";,;,b b o'o'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'W,q'q'q'r's't'u'v'w'x'y'z'A'B'C'D'2'2'B,B,O>O>O>O>O>O>O>O>O>O>O>Y,Y,C,C,='='='E'F'3'3'3'G'Z,='F'F'G'H'I'J'F'F'G'H'I'J'G'H'I'J'",
+";,;,b b K'K'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'W,W,W,W,W,L'L'q'r'M'N'O'P'u'N's'Q'R'S'A'T'U'C'V'9'0'W'D'}'X'|'O>O>B,B,O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>",
+";,;,b b K'K'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'Y'Y'Y'Z'`' ).)+)+)+)W,W,W,W,L'L'q'q'r'r's'M'N'P'@)A'#)$)%)&)*)=)B,|'|'O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>",
+"{+;,$ -);)K'p'p'o'p'p'p'p'p'o'p'p'p'p'p'p'o'p'p'p'p'p'p'o'p'p'p'p'p'o'o'p'p'p'p'p'p'p'p'p'p'>)>)Y'Y'>)Z',)')))!)~)+)W,W,W,W,W,W,W,W,W,W,W,L'L'{)s't'])^)/)])/)/)O>()])/)/)O>()O>_)O>/)O>()O>_)O>()O>_)O>",
+":);,;,;)<)<)<)<)<)<)<)<)<)<)<)<)<)<)<)<)<)<)<)<)<)<)<)<)<)<)<)<)<)<)<)<)<)[)M M M M M M M M M M M M M M M M M M })})|)|)})M M 1)2)3)4)5)6)6)6)7)7)8)8)8)8)8)8)8)8)8)8)8)8)8)8)8)8)8)8)8)8)8)8)8)8)8)8)8)",
+"9)#;;,;,$ -)<)<)<)<)<)<)<)<)<)<)<)<)<)<)<)<)<)<)<)<)<)<)<)<)<)<)<)<)<)<)<)0)a)a)a)b)c)d)e)f)g)h)i)i)j)j)M M M M M M M M M M M })})})})M k)k)M M k)l)8)8)8)8)8)8)8)8)8)8)8)8)8)8)8)8)8)8)8)8)8)8)8)8)8)8)",
+"+ 9)m)n)$ #;#;#;#;#;#;#;#;#;#;#;#;#;#;#;#;#;#;#;#;#;#;#;#;#;#;#;#;#;#;#;#;o)p)p)p)p)p)p)p)p)p)p)p)p)p)p)p)p)p)p)p)p)p)p)p)p)p)p)p)p)p)p)p)p)p)p)p)p)p)p)p)p)p)p)p)p)p)p)p)p)p)p)p)p)p)p)p)p)p)p)p)p)p)p)",
+"+ + 9)a m)q)r)s)r)s)r)s)r)s)r)r)s)r)s)r)s)r)r)s)r)s)r)s)r)s)r)s)r)s)r)s)r)t)u)v)w)x)x)w)y)z)A)A)B)B)B)B)w)w)C)C)w)w)B)B)B)B)B)w)w)w)w)B)B)B)B)B)B)B)B)B)B)B)B)B)B)B)B)B)B)B)B)B)D)B)B)B)B)B)D)B)B)B)D)B)",
+". + + 9)9)9)q)E)q)E)q)E)q)E)q)q)E)q)E)q)E)q)q)E)q)E)q)E)q)E)q)E)q)E)q)E)q)F)G)H)E)I)J)K)H)L)L)L)L)L)L)L)H)H)M)M)H)H)L)L)G)L)L)H)H)H)H)L)L)L)L)L)L)L)L)L)L)L)L)L)L)L)L)L)L)L)L)L)N)L)L)L)L)L)N)L)L)L)N)L)",
+". . 0 . + O)P)O)P)O)P)O)P)O)P)P)O)P)O)P)O)P)P)O)P)O)P)O)P)O)P)O)P)O)P)O)P)O)Q)R)S)T)U)V)W)X)W)W)V)V)V)V)V)V)V)V)Y)Y)Z)Z)Y)Z)Z)Y)Y)V)V)V)V)V)V)V)V)V)V)V)V)V)V)V)V)V)V)V)V)V)V)V)Y)V)V)V)V)V)Y)V)V)V)Y)V)",
+". . . 0 0 0 . 0 0 0 + 0 + 0 + 0 + 0 + 0 + 0 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 0 `) !+ + + .! !`)`)`)`)`)`)`)`)`)`)`)`)`)`)`)`)`)`)`)`)`)`)`)`)`)`)`)`)`)`)`)`)`)`)`)`)`)`)`)`)`)`)`)+!`)`)`)`)`)+!`)`)`)+!`)"};
+
+
+static char * listviewhighcornerright_xpm[] = {
+"100 46 780 2",
+" c None",
+". c #6A779D",
+"+ c #6C789C",
+"@ c #6C789D",
+"# c #6B789D",
+"$ c #6A779E",
+"% c #66759E",
+"& c #64749E",
+"* c #63749E",
+"= c #61739D",
+"- c #576D9B",
+"; c #556C9C",
+"> c #4D679D",
+", c #4A649D",
+"' c #49629D",
+") c #465E9C",
+"! c #40579C",
+"~ c #3B5394",
+"{ c #2C4E97",
+"] c #314993",
+"^ c #2B4595",
+"/ c #1B4296",
+"( c #253D93",
+"_ c #19418F",
+": c #0F3C96",
+"< c #42599E",
+"[ c #758DC3",
+"} c #E8EAE7",
+"| c #EEF0ED",
+"1 c #FBFBFC",
+"2 c #6F7D9B",
+"3 c #6F7D9A",
+"4 c #6E7B9C",
+"5 c #67759E",
+"6 c #63739E",
+"7 c #62739D",
+"8 c #596F9C",
+"9 c #4A639D",
+"0 c #47609C",
+"a c #445B9F",
+"b c #3E5697",
+"c c #2E509A",
+"d c #2D509A",
+"e c #2D4F99",
+"f c #2D4F98",
+"g c #28418A",
+"h c #3E51A3",
+"i c #D0D3DC",
+"j c #A1B6EF",
+"k c #A2B6F0",
+"l c #A1B6F0",
+"m c #A3B6F0",
+"n c #A0B6EF",
+"o c #9DB6EE",
+"p c #9CB5EF",
+"q c #9CB2F0",
+"r c #9FB5EE",
+"s c #9CB4EB",
+"t c #9AB3EC",
+"u c #9AB0EC",
+"v c #9DB3EB",
+"w c #9BB4EC",
+"x c #9BB4EE",
+"y c #9BB1EF",
+"z c #9BB0F0",
+"A c #90ACF0",
+"B c #93ABEE",
+"C c #91A8EB",
+"D c #8BA3E8",
+"E c #88A1E7",
+"F c #809DE9",
+"G c #7A99E8",
+"H c #7491E5",
+"I c #698AE4",
+"J c #6184E3",
+"K c #507EDC",
+"L c #4E7CDB",
+"M c #4F7DDC",
+"N c #5479DA",
+"O c #567BDC",
+"P c #577CDD",
+"Q c #5074DA",
+"R c #5174DB",
+"S c #5175DC",
+"T c #5276DD",
+"U c #4D71DE",
+"V c #4C72D8",
+"W c #3A6CE0",
+"X c #2B49A6",
+"Y c #E0E2DF",
+"Z c #93AAE9",
+"` c #94A9E8",
+" . c #94AAE9",
+".. c #93A9E9",
+"+. c #92AAE9",
+"@. c #8DA9E8",
+"#. c #8CA7E9",
+"$. c #92ABE9",
+"%. c #8EAAE9",
+"&. c #8EA9E9",
+"*. c #8FAAE9",
+"=. c #8CA8E9",
+"-. c #8CA2E7",
+";. c #86A1E6",
+">. c #839EE9",
+",. c #7F9CE9",
+"'. c #7A97E8",
+"). c #7693E7",
+"!. c #6E8EE8",
+"~. c #678AE9",
+"{. c #5D84E3",
+"]. c #577CDF",
+"^. c #4E77DF",
+"/. c #4A70DB",
+"(. c #4870DB",
+"_. c #4870DC",
+":. c #4770E3",
+"<. c #496FDC",
+"[. c #486EDB",
+"}. c #466FE4",
+"|. c #466EE3",
+"1. c #4167D9",
+"2. c #4066D8",
+"3. c #3F66D8",
+"4. c #3D64D7",
+"5. c #3960DA",
+"6. c #476DD9",
+"7. c #446EE5",
+"8. c #305EC8",
+"9. c #8EAAE8",
+"0. c #8FAAE8",
+"a. c #91AAE9",
+"b. c #8FA9E8",
+"c. c #8BA8E8",
+"d. c #8AA7E9",
+"e. c #8BA5EA",
+"f. c #8AA7E8",
+"g. c #87A2E6",
+"h. c #859FE8",
+"i. c #7F9DE8",
+"j. c #7C9AE8",
+"k. c #7B95E7",
+"l. c #7090E8",
+"m. c #6B8BE9",
+"n. c #6386E6",
+"o. c #5881E1",
+"p. c #5479DE",
+"q. c #4D74DE",
+"r. c #476EDB",
+"s. c #446EE1",
+"t. c #446EE0",
+"u. c #446EDF",
+"v. c #446DE0",
+"w. c #426ADF",
+"x. c #3C64DA",
+"y. c #4360CC",
+"z. c #D3D5D2",
+"A. c #E6E3E8",
+"B. c #8DA2E7",
+"C. c #8CA6EA",
+"D. c #8DA3E9",
+"E. c #88A2E7",
+"F. c #87A1E7",
+"G. c #8AA1E7",
+"H. c #849EE9",
+"I. c #7D9AE9",
+"J. c #7B98E8",
+"K. c #7796E5",
+"L. c #7191E7",
+"M. c #688CE9",
+"N. c #6687E5",
+"O. c #5C83E1",
+"P. c #557BDE",
+"Q. c #4F76DE",
+"R. c #4C72DE",
+"S. c #456EDF",
+"T. c #426AD9",
+"U. c #4269D9",
+"V. c #4269D8",
+"W. c #3D64D9",
+"X. c #3A61DA",
+"Y. c #345ED6",
+"Z. c #335ECF",
+"`. c #C6C3C8",
+" + c #86A1E7",
+".+ c #87A2E7",
+"++ c #87A0E7",
+"@+ c #859EE8",
+"#+ c #849DE9",
+"$+ c #7E9BE9",
+"%+ c #7A99E9",
+"&+ c #7A95E5",
+"*+ c #7593E7",
+"=+ c #6F8EE9",
+"-+ c #668AE5",
+";+ c #6386E0",
+">+ c #5B82DF",
+",+ c #5379DE",
+"'+ c #5075DE",
+")+ c #4B6FDC",
+"!+ c #446AD7",
+"~+ c #4269D6",
+"{+ c #4269D5",
+"]+ c #3E65D7",
+"^+ c #C9CAC9",
+"/+ c #869EE9",
+"(+ c #859FE9",
+"_+ c #849FE9",
+":+ c #829DE8",
+"<+ c #819DE8",
+"[+ c #7B9AE9",
+"}+ c #7A96E6",
+"|+ c #7290E8",
+"1+ c #698CE6",
+"2+ c #6689E0",
+"3+ c #5D84E0",
+"4+ c #587FDF",
+"5+ c #5377DD",
+"6+ c #4B74DE",
+"7+ c #496BD8",
+"8+ c #7C9BE9",
+"9+ c #7E9CE9",
+"0+ c #7D9AEA",
+"a+ c #7D9BEA",
+"b+ c #7D98E8",
+"c+ c #7C98E8",
+"d+ c #7796E4",
+"e+ c #7592E6",
+"f+ c #7390E1",
+"g+ c #698DE0",
+"h+ c #6588DE",
+"i+ c #5E84E0",
+"j+ c #5880DF",
+"k+ c #5479DC",
+"l+ c #4F75DE",
+"m+ c #4A6FDB",
+"n+ c #436AD7",
+"o+ c #3F65D7",
+"p+ c #BAC3BE",
+"q+ c #7B9AE8",
+"r+ c #7B9AEA",
+"s+ c #7A9AEA",
+"t+ c #7B99E9",
+"u+ c #7D97E7",
+"v+ c #7D95E6",
+"w+ c #7D95E5",
+"x+ c #7C95E6",
+"y+ c #7493E3",
+"z+ c #7290DF",
+"A+ c #6C8DDE",
+"B+ c #6B89E1",
+"C+ c #6486DF",
+"D+ c #5D81DF",
+"E+ c #567DDE",
+"F+ c #4F73DE",
+"G+ c #496EDA",
+"H+ c #355ED6",
+"I+ c #345ED5",
+"J+ c #7E95E5",
+"K+ c #7C97E8",
+"L+ c #7C97E7",
+"M+ c #7B94E6",
+"N+ c #7A95E4",
+"O+ c #7695E5",
+"P+ c #7694E4",
+"Q+ c #7994E6",
+"R+ c #7995E4",
+"S+ c #7594E4",
+"T+ c #7391E2",
+"U+ c #6E8EDE",
+"V+ c #6B8ADE",
+"W+ c #6688DF",
+"X+ c #5F84E0",
+"Y+ c #5980E0",
+"Z+ c #4D72DD",
+"`+ c #456BD7",
+" @ c #4168D6",
+".@ c #3C64D7",
+"+@ c #335ED0",
+"@@ c #4659C7",
+"#@ c #7292E1",
+"$@ c #7392E1",
+"%@ c #7492E1",
+"&@ c #718FDF",
+"*@ c #6F8EDE",
+"=@ c #6D8BDE",
+"-@ c #6B88DF",
+";@ c #597FDF",
+">@ c #557ADD",
+",@ c #5176DC",
+"'@ c #4D74DD",
+")@ c #496DDA",
+"!@ c #3860D8",
+"~@ c #7391E0",
+"{@ c #7290DE",
+"]@ c #6D8EDD",
+"^@ c #6D8DDD",
+"/@ c #7190E0",
+"(@ c #6C8DDD",
+"_@ c #6B89DF",
+":@ c #6487E0",
+"<@ c #6085DF",
+"[@ c #5F81DE",
+"}@ c #567EDE",
+"|@ c #4F74D9",
+"1@ c #466BD7",
+"2@ c #4067D5",
+"3@ c #3C63D7",
+"4@ c #335ED3",
+"5@ c #335ED1",
+"6@ c #718EDD",
+"7@ c #728EDD",
+"8@ c #748EDD",
+"9@ c #708EDD",
+"0@ c #6F8DDD",
+"a@ c #6E8DDD",
+"b@ c #6C8ADE",
+"c@ c #6C89DF",
+"d@ c #6988DF",
+"e@ c #6387DF",
+"f@ c #6282DE",
+"g@ c #5681E0",
+"h@ c #577BDD",
+"i@ c #5277DB",
+"j@ c #4D73D8",
+"k@ c #4A70D8",
+"l@ c #436AD5",
+"m@ c #3F66D6",
+"n@ c #3C63D8",
+"o@ c #3960D8",
+"p@ c #3860D7",
+"q@ c #335ED2",
+"r@ c #345ED4",
+"s@ c #6C88DF",
+"t@ c #6D88DF",
+"u@ c #6B89DE",
+"v@ c #6888DF",
+"w@ c #6587E0",
+"x@ c #6989DF",
+"y@ c #6687E0",
+"z@ c #6287E0",
+"A@ c #6281DD",
+"B@ c #5881E0",
+"C@ c #557ADB",
+"D@ c #5176D9",
+"E@ c #4E75D7",
+"F@ c #4A6FD8",
+"G@ c #476BD6",
+"H@ c #4067D6",
+"I@ c #3C62D7",
+"J@ c #3C60D4",
+"K@ c #365ED1",
+"L@ c #345ED3",
+"M@ c #6786DF",
+"N@ c #5F85E0",
+"O@ c #5F86E0",
+"P@ c #6186DF",
+"Q@ c #6286E0",
+"R@ c #6284DF",
+"S@ c #6384DF",
+"T@ c #5B7FDE",
+"U@ c #577DDC",
+"V@ c #557BDA",
+"W@ c #5278D8",
+"X@ c #4E76D6",
+"Y@ c #4C72D7",
+"Z@ c #486DD8",
+"`@ c #4469D6",
+" # c #3F62D2",
+".# c #3C60CF",
+"+# c #345ECF",
+"@# c #6086DF",
+"## c #6085E0",
+"$# c #6285DF",
+"%# c #6383DD",
+"&# c #6481DC",
+"*# c #6380DD",
+"=# c #6183DE",
+"-# c #6083DD",
+";# c #6081DC",
+"># c #6080DD",
+",# c #6083DE",
+"'# c #6181DC",
+")# c #6280DD",
+"!# c #577EDB",
+"~# c #557CD7",
+"{# c #4F76D6",
+"]# c #4E74D7",
+"^# c #466CD7",
+"/# c #3B64D6",
+"(# c #4261CD",
+"_# c #375FCE",
+":# c #5A7FD8",
+"<# c #6281DA",
+"[# c #5F81D8",
+"}# c #5C80D8",
+"|# c #557DD7",
+"1# c #577ED8",
+"2# c #567ED7",
+"3# c #587DD8",
+"4# c #577DD8",
+"5# c #587ED8",
+"6# c #567DD8",
+"7# c #5379D9",
+"8# c #5177D7",
+"9# c #4D74D5",
+"0# c #486ED9",
+"a# c #4068D4",
+"b# c #3D65D2",
+"c# c #4361CC",
+"d# c #345ECE",
+"e# c #325DCF",
+"f# c #2C5AD1",
+"g# c #3959C5",
+"h# c #547BD8",
+"i# c #567DD7",
+"j# c #557BD8",
+"k# c #5279D9",
+"l# c #5278D9",
+"m# c #4D74D6",
+"n# c #4B71D8",
+"o# c #496CD8",
+"p# c #4669D7",
+"q# c #3D66D3",
+"r# c #3F62CF",
+"s# c #4260CC",
+"t# c #5379D8",
+"u# c #4E75D4",
+"v# c #4C73D7",
+"w# c #476CD7",
+"x# c #4869D0",
+"y# c #4067D2",
+"z# c #3D64D1",
+"A# c #4261CC",
+"B# c #395FCE",
+"C# c #4F75D3",
+"D# c #5074D2",
+"E# c #5174D1",
+"F# c #5175D1",
+"G# c #4F74D3",
+"H# c #4C73D5",
+"I# c #4C73D4",
+"J# c #4A72D1",
+"K# c #4B70CF",
+"L# c #506CCC",
+"M# c #4D6BCE",
+"N# c #4167D0",
+"O# c #3D65D1",
+"P# c #3F63CF",
+"Q# c #3B5FCD",
+"R# c #3159CD",
+"S# c #4971D0",
+"T# c #4870CF",
+"U# c #4C6FCF",
+"V# c #4E6CCE",
+"W# c #4E6BCE",
+"X# c #4769CF",
+"Y# c #3D66D0",
+"Z# c #3C65D1",
+"`# c #4062CE",
+" $ c #3D5FCD",
+".$ c #365FCF",
+"+$ c #325DCD",
+"@$ c #2D5AD0",
+"#$ c #3859C5",
+"$$ c #355FCF",
+"%$ c #355ECF",
+"&$ c #335ECE",
+"*$ c #305CCD",
+"=$ c #2B5ACE",
+"-$ c #3056C9",
+";$ c #2553C6",
+">$ c #2153C8",
+",$ c #1F4FC7",
+"'$ c #274CC5",
+")$ c #214AC7",
+"!$ c #1C48C8",
+"~$ c #1244C9",
+"{$ c #1043C9",
+"]$ c #1144C9",
+"^$ c #2A45BE",
+"/$ c #2744B5",
+"($ c #1D49C0",
+"_$ c #2B58DE",
+":$ c #002D94",
+"<$ c #2B59CA",
+"[$ c #2A59CA",
+"}$ c #2E57C8",
+"|$ c #3255C6",
+"1$ c #3355C5",
+"2$ c #1C52C8",
+"3$ c #1D50C7",
+"4$ c #234FC6",
+"5$ c #264CC5",
+"6$ c #1D48C7",
+"7$ c #1245C8",
+"8$ c #1F44C2",
+"9$ c #2945BE",
+"0$ c #2A45BD",
+"a$ c #2040BF",
+"b$ c #3156C7",
+"c$ c #3056C7",
+"d$ c #3354C5",
+"e$ c #3355C6",
+"f$ c #3255C5",
+"g$ c #3254C5",
+"h$ c #1952C7",
+"i$ c #1951C8",
+"j$ c #2050C7",
+"k$ c #274CC4",
+"l$ c #244CC6",
+"m$ c #1F49C7",
+"n$ c #1E47C5",
+"o$ c #2045C3",
+"p$ c #1C44BF",
+"q$ c #2045BE",
+"r$ c #2040B8",
+"s$ c #3254C6",
+"t$ c #3055C6",
+"u$ c #2A54C6",
+"v$ c #2353C7",
+"w$ c #3054C5",
+"x$ c #2F55C5",
+"y$ c #2A54C5",
+"z$ c #2553C5",
+"A$ c #2F54C5",
+"B$ c #3155C6",
+"C$ c #2A54C7",
+"D$ c #1A52C8",
+"E$ c #204FC2",
+"F$ c #264DC6",
+"G$ c #234BC5",
+"H$ c #1D48C1",
+"I$ c #1E48BF",
+"J$ c #2646BE",
+"K$ c #2B45BD",
+"L$ c #1E43BE",
+"M$ c #2643BF",
+"N$ c #2243BF",
+"O$ c #3049BC",
+"P$ c #1E50BE",
+"Q$ c #1D50C0",
+"R$ c #1D50BF",
+"S$ c #1852C1",
+"T$ c #1E51C0",
+"U$ c #214FBF",
+"V$ c #2050C0",
+"W$ c #244EBF",
+"X$ c #2151C0",
+"Y$ c #234FBF",
+"Z$ c #2350C0",
+"`$ c #2351C0",
+" % c #244FBF",
+".% c #2250C0",
+"+% c #2051C0",
+"@% c #1E50C0",
+"#% c #244DBE",
+"$% c #274DBF",
+"%% c #244CBF",
+"&% c #1C48C0",
+"*% c #2247BF",
+"=% c #2C44BD",
+"-% c #1C44BE",
+";% c #1444BF",
+">% c #1841BF",
+",% c #1F40BF",
+"'% c #254DBE",
+")% c #224FBE",
+"!% c #224FBF",
+"~% c #234EBF",
+"{% c #254CBD",
+"]% c #244DBD",
+"^% c #244CBD",
+"/% c #264DBE",
+"(% c #264DBD",
+"_% c #214BC0",
+":% c #1D48C0",
+"<% c #2347BF",
+"[% c #2B44BD",
+"}% c #2444BE",
+"|% c #0F42BF",
+"1% c #0641BF",
+"2% c #0F41BF",
+"3% c #1741BE",
+"4% c #1F40BD",
+"5% c #234BBF",
+"6% c #234CBE",
+"7% c #214BBE",
+"8% c #244CBE",
+"9% c #214ABE",
+"0% c #214ABF",
+"a% c #1F48C0",
+"b% c #2746BE",
+"c% c #1F43BE",
+"d% c #0941BE",
+"e% c #0342BA",
+"f% c #0242BC",
+"g% c #1241B8",
+"h% c #1F40B7",
+"i% c #2F41AC",
+"j% c #2644AE",
+"k% c #2D49B4",
+"l% c #2649B6",
+"m% c #2949B7",
+"n% c #2849B5",
+"o% c #2149B8",
+"p% c #1E49B9",
+"q% c #1F48B8",
+"r% c #1F49B9",
+"s% c #2545B6",
+"t% c #2744B7",
+"u% c #2844B7",
+"v% c #2043B8",
+"w% c #1241B7",
+"x% c #1340B8",
+"y% c #0D41B8",
+"z% c #1941B8",
+"A% c #1F40B8",
+"B% c #203FB8",
+"C% c #2549B5",
+"D% c #2648B6",
+"E% c #2547B7",
+"F% c #2248B7",
+"G% c #2048B7",
+"H% c #2346B6",
+"I% c #2146B6",
+"J% c #2247B7",
+"K% c #2148B7",
+"L% c #2743B4",
+"M% c #2643B5",
+"N% c #2542B6",
+"O% c #1D42B7",
+"P% c #0E42B8",
+"Q% c #0C41B8",
+"R% c #1341B8",
+"S% c #1740B8",
+"T% c #1C41B8",
+"U% c #1F40B1",
+"V% c #2644B5",
+"W% c #2544B5",
+"X% c #2544B4",
+"Y% c #2444B5",
+"Z% c #2444B4",
+"`% c #2744B4",
+" & c #2241B7",
+".& c #1D41B8",
+"+& c #0B42B8",
+"@& c #0942B8",
+"#& c #0C42B8",
+"$& c #0F41B8",
+"%& c #1641B8",
+"&& c #2442B5",
+"*& c #2543B3",
+"=& c #2342B2",
+"-& c #2341B4",
+";& c #2141B3",
+">& c #2141B5",
+",& c #2140B5",
+"'& c #2040B5",
+")& c #1C40B7",
+"!& c #1B41B3",
+"~& c #0142B6",
+"{& c #0E41B7",
+"]& c #1141B7",
+"^& c #1440B2",
+"/& c #113FB0",
+"(& c #1440B0",
+"_& c #213EAF",
+":& c #233DAE",
+"<& c #223EAF",
+"[& c #1E40B1",
+"}& c #173EAD",
+"|& c #1440AF",
+"1& c #0D40AF",
+"2& c #0941B0",
+"3& c #0D3FAE",
+"4& c #1B3CAC",
+"5& c #233CAD",
+"6& c #203FB0",
+"7& c #273BAD",
+"8& c #1D40B0",
+"9& c #2040B1",
+"0& c #1E40B0",
+"a& c #1C40B0",
+"b& c #1B3DAC",
+"c& c #143DAC",
+"d& c #193DAD",
+"e& c #1B3DAD",
+"f& c #173DAD",
+"g& c #153DAC",
+"h& c #1C3CAC",
+"i& c #243CAD",
+"j& c #213FB0",
+"k& c #263BAA",
+"l& c #253CAE",
+"m& c #273AAC",
+"n& c #273AAD",
+"o& c #253BAD",
+"p& c #1D3CAC",
+"q& c #243BAD",
+"r& c #1E3CAC",
+"s& c #263BAD",
+"t& c #1A3DAC",
+"u& c #143DAB",
+"v& c #163DAC",
+"w& c #1A3CAC",
+"x& c #1F3CAD",
+"y& c #263BAB",
+"z& c #263BA6",
+"A& c #1E42A4",
+"B& c #2D40A5",
+"C& c #253BA6",
+"D& c #253CA7",
+"E& c #263AA5",
+"F& c #253BA7",
+"G& c #1E3BA6",
+"H& c #193DA6",
+"I& c #173DA5",
+"J& c #143DA6",
+"K& c #1A3DA7",
+"L& c #133DA6",
+"M& c #123DA5",
+"N& c #1A3CA7",
+"O& c #243BA6",
+"P& c #263AA7",
+"Q& c #273BA7",
+"R& c #263AA6",
+"S& c #223BA6",
+"T& c #1D3BA6",
+"U& c #173CA6",
+"V& c #133DA5",
+"W& c #1B3DA6",
+"X& c #193DA5",
+"Y& c #123DA4",
+"Z& c #163CA5",
+"`& c #213CA6",
+" * c #273BA8",
+".* c #263BA7",
+"+* c #253BA5",
+"@* c #263BA5",
+"#* c #1C3BA6",
+"$* c #1B3BA9",
+"%* c #133BA8",
+"&* c #0A3BA7",
+"** c #083AA6",
+"=* c #123CA5",
+"-* c #0839A8",
+";* c #0239A6",
+">* c #123AA8",
+",* c #1F49C8",
+"'* c #2F4DA4",
+")* c #2E4DA3",
+"!* c #384CA4",
+"~* c #3C4DA7",
+"{* c #394EA7",
+"]* c #3B4CA5",
+"^* c #3C52B1",
+"/* c #3551A8",
+"(* c #3759BE",
+"_* c #4161C7",
+":* c #0033A8",
+"<* c #596FA9",
+"[* c #2F4DA3",
+"}* c #2D4BA5",
+"|* c #2E4CA4",
+"1* c #2C4AA5",
+"2* c #2D4BA4",
+"3* c #354DA4",
+"4* c #3A4BA4",
+"5* c #394DA6",
+"6* c #4056AD",
+"7* c #445BBB",
+"8* c #B5B7B4",
+"9* c #1B2F85",
+"0* c #242F79",
+"a* c #B5B5B5",
+"b* c #B5B2B6",
+"c* c #C0C3C3",
+"d* c #E3E3E4",
+"e* c #EBEDEA",
+". + @ + # $ % & # $ % & # $ % & # $ % & & * = - ; > , ' ) ! ~ { { { { { { { ] ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ / / / ( / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / _ _ / / : / < [ } | | | 1 1 ",
+"2 2 2 2 3 2 4 @ 3 2 4 @ 3 2 4 @ 3 2 4 @ # 5 6 7 8 ; > 9 0 a b c d e f { { { ] ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ( ( ( ( ( ( ( ( ( / / / / / / / / / / / / / / / / / _ _ _ _ _ _ _ _ _ _ _ g g _ / / : : : h i } 1 | 1 ",
+"j k l m n o p q n o p q r s t u v w x y z A B C D E F G H I J K L M N O P O O Q R S T T T T T T T T T T T T T T T T T T U U U U U U U U U U U U U U U U U U U U U U U U U U U U V V V U U W X : [ Y | | ",
+"Z ` . ...+.@.#...+.@.#.Z $.%.&.Z $.*.=.-.;.>.,.'.).!.~.{.].^./.(._.:.<.[.}.|.1.2.3.4.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.6.7.8.: h Y } 1 ",
+"9.0.a.b.c.c.d.e.f.c.d.e.f.c.d.e.f.c.d.e.g.h.i.j.k.l.m.n.o.p.q.r.s.s.t.u.u.v.w.x.4.4.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.y.5.7.6.: / z.A.} ",
+"-.B.C.D.-.E.g.F.G.E.g.F.G.E.g.F.G.E.g.F.H.I.J.K.L.M.N.O.P.Q.R.S.T.U.V.V.U.U.W.X.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Z.y.Y.7.7.: : `.z.} ",
+" +.+g.;.++F.@+#+++F.@+#+++F.@+#+++F.@+#+$+%+&+*+=+-+;+>+,+'+)+!+~+{+]+{+{+4.4.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.Y.Y.5.5.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Z.Z.Z.y.y.5.7.7.: : ^+z.Y ",
+"/+(+_+#+H.H.>.:+H.H.>.:+H.H.>.:+H.H.>.<+[+}+*+|+1+2+3+4+5+6+7+{+{+4.4.4.4.4.4.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.Y.Y.Y.Y.Y.Y.Y.5.Y.Y.Y.Y.Y.Y.Y.Y.5.Y.Y.5.5.5.5.Y.Y.Y.Y.Y.Y.Z.Z.Z.Z.y.y.y.y.y.y.7.7.: : ^+i } ",
+"8+9+0+0+a+0+0+b+a+0+0+b+a+0+0+b+a+0+0+c+d+e+f+g+h+i+j+k+l+m+n+o+4.4.4.4.5.5.5.5.5.5.Y.Y.5.5.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Y.Y.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.7.7.: : p+z.Y ",
+"q+r+r+s+t+u+v+w+t+u+v+w+t+u+v+w+t+u+x+&+y+z+A+B+C+D+E+5+F+G+~+4.4.4.4.5.5.5.5.5.H+Y.Y.Y.Y.Y.Y.Y.Y.I+Y.Z.Y.Y.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.7.7.: : `.z.A.",
+"J+v+K+L+M+N+O+P+Q+R+O+P+Q+R+O+P+Q+R+O+S+T+U+V+W+X+Y+P.T Z+`+ @4.4..@5.5.5.5.5.5.Y.Y.Y.I+I+I+I+I++@+@Z.Z.Y.Y.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.@@Z.7.7.: : p+z.Y ",
+"#@$@$@%@%@$@#@&@#@#@#@&@#@#@#@&@#@#@#@*@=@-@;+i+;@>@,@'@)@ @4.X.5.5.H+Y.Y.Y.!@Y.Y.I++@+@Z.Z.+@Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.y.Z.6.6.: : `.z.A.",
+"#@$@~@~@~@{@]@^@/@{@]@^@/@{@]@^@/@{@]@(@_@:@<@[@}@k+|@V 1@2@3@5.5.5.Y.Y.I+4@I+5@+@Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.y.Z.6.6.: : p+z.Y ",
+"6@7@8@9@0@a@b@c@a@a@b@c@a@a@b@c@a@a@b@d@e@<@f@g@h@i@j@k@l@m@n@o@o@p@Y.I+q@q@r@+@Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.y.Z.6.6.: : `.z.A.",
+"s@t@u@_@_@v@w@w@x@v@w@w@x@v@y@y@x@v@:@z@A@B@P C@D@E@F@G@H@I@J@K@5@+@+@+@r@I+L@Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.@@Z.W W : : p+z.Y ",
+"M@N@O@P@C+Q@Q@R@C+;+Q@R@C+;+;+S@C+Q@Q@R@T@U@V@W@X@Y@Z@`@4. #.#+#Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.8.Z.Z.Z.Z.8.8.Z.Z.y.@@@@W W : : `.z.A.",
+"@#O@O@##$#%#&#*#=#-#;#>#,#-#;#>#,#-#'#)#!#~#W@{#]#k@^#H@/#(#_#Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.8.8.Z.Z.Z.Z.Z.Z.Z.8.8.8.8.8.8.8.8.8.8.8.Z.Z.y.y.@@W W : : p+z.Y ",
+":#<#[#}#|#1#2#3#4#5#1#4#4#1#1#4#4#1#1#6#7#8#9#V 0#`+a#b#c#d#e#Z.Z.Z.f#Z.Z.Z.f#f#f#f#f#f#f#f#f#f#g#g#g#g#g#8.8.8.8.8.8.8.8.8.g#g#g#g#8.g#8.8.8.8.8.8.8.8.8.8.8.8.8.8.8.8.8.8.8.8.8.8.y.y.@@W W : : `.z.A.",
+"h#2#i#6#|#j#7#k#|#j#7#7#|#j#7#7#|#j#7#l#8#m#n#n#o#p#q#r#s#d#e#Z.Z.Z.f#f#f#f#Z.f#f#g#g#g#g#g#g#g#g#g#g#g#g#8.8.8.g#g#8.8.8.8.8.8.8.8.8.8.8.8.8.8.8.8.8.8.8.8.8.8.8.8.8.y.y.y.y.8.8.8.y.y.@@W W : : p+z.Y ",
+"l#7#7#l#7#7#7#W@7#7#7#W@7#7#k#W@t#7#7#W@u#v#n#w#x#y#z#A#B#Z.e#f#f#Z.f#f#f#Z.Z.g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#8.8.8.g#g#g#g#8.8.g#g#g#g#g#g#8.8.g#8.8.y.8.8.y.y.8.y.y.y.y.@@W W : : `.z.A.",
+"C#D#E#F#G#H#I#J#G#H#I#J#G#H#I#J#G#H#I#J#K#L#M#N#O#P#s#Q#+#f#R#f#f#f#f#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#@@@@y.y.@@@@y.y.W W : : p+z.Y ",
+"S#S#S#S#S#T#S#U#S#T#S#U#S#T#S#U#S#T#S#U#V#W#X#Y#Z#`# $.$+$@$#$g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#@@@@@@@@@@@@@@@@@@y.y.W W : : `.z.A.",
+"+$Z..$$$%$+$&$*$%$+$&$*$%$+$&$*$%$+$&$*$=$-$;$>$,$'$)$!$~${$]$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$/$/$/$/$($($_$_$:$:$p+z.Y ",
+"<$<$<$<$<$[$}$|$<$[$}$|$<$[$}$|$<$[$}$|$1$2$3$4$5$)$6$7$8$9$0$a$a$a$a$a$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$/$/$/$^$^$^$/$/$/$/$/$/$/$/$/$/$/$/$/$/$($($_$_$:$:$`.z.A.",
+"b$c$c$c$d$e$e$f$g$|$|$1$d$e$e$1$d$e$e$1$h$i$j$k$l$m$n$o$p$9$q$a$a$a$a$a$a$a$a$^$a$a$^$^$^$^$^$^$a$r$r$r$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$($($_$_$:$:$p+z.Y ",
+"e$1$s$s$1$t$u$v$w$x$y$z$A$x$u$v$g$B$C$>$D$E$F$G$H$I$J$K$L$M$N$a$a$a$a$a$a$a$a$^$r$r$a$^$^$^$a$r$r$r$r$r$/$^$r$^$^$^$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$O$($_$_$:$:$`.z.A.",
+"P$Q$R$S$T$U$V$W$X$Y$Z$W$`$ %.%W$+%U$@%#%$%%%&%($*%=%-%;%>%>%,%r$r$r$r$r$a$a$a$/$/$/$r$r$r$r$r$r$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$O$($_$_$:$:$p+z.Y ",
+"'%W$)%!%~%{%'%]%~%^%'%]%~%^%'%]%~%^%/%(%_%&%:%<%[%}%|%1%2%3%4%r$r$r$r$r$r$r$r$r$r$r$r$r$r$r$r$r$/$r$/$/$r$r$r$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$r$/$/$/$/$/$O$($_$_$:$:$`.z.A.",
+"5%6%'%'%6%7%8%9%6%7%8%9%6%7%8%9%6%7%8%0%&%a%<%b%[%c%d%e%f%g%h%r$r$r$r$r$r$r$r$r$r$r$r$r$r$r$/$r$r$r$r$r$r$r$r$r$r$r$r$r$r$r$r$r$r$r$r$/$/$/$/$/$/$/$/$/$/$/$/$/$/$r$r$/$/$r$r$/$r$i%j%O$($_$_$:$:$p+z.Y ",
+"k%l%m%n%o%o%p%q%o%o%r%q%o%o%r%q%o%o%p%q%s%t%/$u%v%w%x%y%z%A%B%r$r$r$r$r$r$r$r$r$r$r$r$r$r$r$r$r$r$r$r$r$r$/$/$/$/$/$/$/$r$r$i%i%i%r$r$i%i%i%i%i%i%i%i%i%i%i%i%r$/$/$j%j%j%j%j%j%j%j%j%O$($_$_$:$:$`.z.A.",
+"C%D%E%F%G%H%I%J%K%H%I%J%K%H%I%J%K%H%I%J%L%M%N%O%P%Q%R%S%T%A%B%r$r$r$r$r$r$r$r$r$r$r$r$r$r$r$U%U%r$r$i%i%/$/$r$r$/$/$/$/$r$r$i%i%i%i%i%i%i%i%i%i%i%i%i%i%j%i%j%j%j%j%j%j%j%j%j%j%j%j%j%O$($_$_$:$:$p+z.Y ",
+"/$/$/$/$V%V%W%X%W%Y%Y%Z%W%W%Y%Z%W%W%W%`%`% &B%.&+&@&#&$&%&A%B%r$r$r$U%U%U%U%r$U%U%U%U%U%U%U%U%U%U%i%i%i%i%i%i%i%i%/$/$/$i%i%i%i%i%i%i%i%i%j%j%j%j%i%i%i%i%i%j%j%j%i%i%j%j%j%j%j%j%j%j%O$($_$_$:$:$`.z.A.",
+"&&*&=&-&=&;&>&,&=&;&>&,&=&;&>&,&=&;&>&'&)&!&~&{&]&^&/&(&_&:&<&U%U%U%U%U%U%U%U%U%U%U%U%U%i%i%U%U%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%O$($_$_$:$:$p+z.Y ",
+"U%U%U%U%U%U%U%U%U%U%U%U%U%U%U%U%U%U%U%U%[&}&|&1&2&3&4&5&_&6&U%7&U%U%U%U%U%U%U%U%i%i%U%U%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%O$O$_$_$:$:$`.z.A.",
+"U%U%U%U%U%U%[&8&U%9&[&0&U%9&[&0&U%9&[&a&:&b&c&d&e&f&g&h&i&<&j&U%U%U%U%U%U%U%U%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%O$O$_$_$:$:$p+z.Y ",
+"k&l&m&7&7&n&o&p&7&n&q&r&s&s&q&r&s&n&o&p&t&u&u&g&v&w&x&q&n&m&y&7&7&U%U%7&z&7&z&U%A&B&i%i%B&B&i%i%B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&i%B&O$O$_$_$:$:$`.z.A.",
+"C&D&E&z&z&E&F&G&z&E&F&G&z&E&F&G&z&E&F&G&H&I&J&K&L&M&N&O&P&Q&z&z&z&z&z&z&z&z&z&z&z&z&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&O$O$_$_$:$:$p+z.Y ",
+"z&z&z&z&R&S&T&U&R&S&T&U&R&S&T&U&R&S&T&U&V&V&W&X&Y&Z&`&C&R&z&z&z&z&z&z&z&z&z&z&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&O$O$_$_$:$:$^+z.A.",
+"z& *.*+*@*#*$*%*@*#*$*%*@*#*$*%*@*#*$*%*&***=*-*;*>*k&P&+*z&z&z&z&z&z&z&z&z&z&z&z&z&z&z&z&z&z&z&z&z&z&z&z&z&z&z&z&z&z&z&B&B&B&B&z&z&z&B&B&B&z&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&/$O$O$@@_$,*:$/ ^+z.Y ",
+"'*'*'*'*'*'*'*'*'*'*'*'*'*'*'*'*'*'*'*'*'*'*'*'*'*'*)*'*!*~*{*]*^*^*^*/*/*/*/*/*/*/*^*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*^*/*/*/*/*/*h h ^*h h ^*^*h h ^*^*^*^*h ^*^*^*^*h ^*^*^*(*_*_*_*_*_$:*:$<*`.z.} ",
+"'*'*'*'*'*[*}*|*'*[*}*|*'*[*}*|*'*[*}*|*1*1*2*}*}*2*[*)*3*4*5*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*h h h h h h h h h h h h h h h h 6*7*_*_*_*_*^*:*:$: 8*z.Y } ",
+"9*9*9*9*9*9*9*9*9*9*9*9*9*9*9*9*9*9*9*9*9*9*9*9*9*9*9*9*9*9*9*9*9*9*9*9*9*9*9*0*0*0*0*0*0*0*0*0*0*0*0*0*0*0*0*0*0*0*0*0*0*0*0*0*0*0*0*0*0*0*0*0*0*0*0*0*0*0*0*0*0*0*0*0*0*0*0*0*0*0*0*0*( <*8*^+z.Y } 1 ",
+"a*a*a*a*a*a*a*a*a*a*a*a*a*a*a*a*a*a*a*a*a*a*a*a*a*a*a*a*a*a*a*8*b*8*b*8*b*8*b*b*8*b*8*b*8*b*8*b*8*b*8*b*8*b*8*b*8*b*8*b*8*b*8*b*8*b*8*b*8*b*8*b*8*b*8*b*8*b*8*b*8*b*8*b*8*b*8*b*8*8*8*8*b*8*`.z.A.Y | | ",
+"c*c*c*c*c*c*c*c*c*c*c*c*c*c*c*c*c*c*c*c*c*c*c*c*c*c*c*c*c*c*c*p+`.p+`.p+`.p+`.`.p+`.p+`.p+`.p+`.p+`.p+`.p+`.p+`.p+`.p+`.p+`.p+`.p+`.p+`.p+`.p+`.p+`.p+`.p+`.p+`.p+`.p+`.p+`.p+`.p+^+`.^+^+z.z.Y Y | | 1 ",
+"d*d*d*d*d*d*d*d*d*d*d*d*d*d*d*d*d*d*d*d*d*d*d*d*d*d*d*d*d*d*d*A.Y A.Y A.Y A.Y Y A.Y A.Y A.Y A.Y A.Y A.Y A.Y A.Y A.Y A.Y A.Y A.Y A.Y A.Y A.Y A.Y A.Y A.Y A.Y A.Y A.Y A.Y A.Y A.Y A.Y A.Y } } | | | | 1 1 ",
+"e*e*e*e*e*e*e*e*e*e*e*e*e*e*e*e*e*e*e*e*e*e*e*e*e*e*e*e*e*e*e*} | } | } | } | | } | } | } | } | } | } | } | } | } | } | } | } | } | } | } | } | } | } | } | } | } | } | } | } | } | | | | 1 | | | 1 1 1 "};
+
+
+static char * tabmiddle_xpm[] = {
+"33 42 32 1",
+" c None",
+". c #CECFEF",
+"+ c #CECBE7",
+"@ c #C6C7E7",
+"# c #C6CBE7",
+"$ c #BDBEDE",
+"% c #BDC3DE",
+"& c #CECBEF",
+"* c #B5B6D6",
+"= c #ADAECE",
+"- c #ADB2CE",
+"; c #BDBAD6",
+"> c #B5BAD6",
+", c #C6C3DE",
+"' c #ADAAC6",
+") c #B5B2CE",
+"! c #B5B6CE",
+"~ c #A5A2BD",
+"{ c #A5A6BD",
+"] c #9C9EB5",
+"^ c #9CA2BD",
+"/ c #ADAEC6",
+"( c #C6C3E7",
+"_ c #9C9AB5",
+": c #A5A6C6",
+"< c #949AAD",
+"[ c #A5AAC6",
+"} c #9496AD",
+"| c #BDBADE",
+"1 c #BDBED6",
+"2 c #9CA2B5",
+"3 c #A5AABD",
+"..........................+@.#.#.",
+"........................$@%&#.#..",
+"......................**$$@@&#.#.",
+".....................=-;>,%+@.#..",
+"....................'')!$$@@&#.#.",
+"...................~{=)$$@@&#.#..",
+"..................]^'/;;(%&#.#...",
+"................._]:/*>,%&@.#.#..",
+".................<{[)!$%+@.#.#...",
+"................}~{=!$%@@.#......",
+"................]^/-|$@@.#.......",
+"................]'/*;@@&#........",
+"...............<~[)>,%&#.#.......",
+"...............]~=)$%+#.#........",
+"...............]'/;1@@.#.........",
+"...............~{)*,%&#..........",
+"...............2/-$$@#...........",
+"...............~[*>(@&#..........",
+"...............^=)$%+#...........",
+"...............{'*>(@.#..........",
+"...............^=)$%+#...........",
+"...............{'*>(@.#..........",
+"...............^=)$%+#...........",
+"...............{'*>(@.#..........",
+"...............^=)$%+#...........",
+"...............{'*>(@.#..........",
+"...............^=)$%+#...........",
+"...............{'*>@@.#..........",
+"...............^=!$%&#...........",
+"...............{/*;@@.#..........",
+"...............{)!$%&#...........",
+"..............]'/;1@@.#..........",
+"..............23)>,%&#...........",
+"..............~=-$$@@.#..........",
+".............]{/*;@@.#...........",
+"............<^[)>,%&#............",
+"............]{/!$%@@.#...........",
+"..........]^[-!$%@@.#............",
+".........]^3/!>$@@.#.............",
+".......<]^3/!>$@@&#..............",
+".....<]2{[/!>$%@&#.#.............",
+"}<<_]2{3/-!>$%@&#.#.............."};
+
+
+static char * tabselectedbeginn_xpm[] = {
+"33 39 28 1",
+" c None",
+". c #CECFEF",
+"+ c #EFF3EF",
+"@ c #FFFBFF",
+"# c #F7FBF7",
+"$ c #FFFFFF",
+"% c #EFEFEF",
+"& c #F7F7F7",
+"* c #DEDFDE",
+"= c #E7E7E7",
+"- c #D6D3D6",
+"; c #DEE3DE",
+"> c #EFEBEF",
+", c #F7F3F7",
+"' c #CECBCE",
+") c #CECFCE",
+"! c #D6D7D6",
+"~ c #DEDBDE",
+"{ c #E7EBE7",
+"] c #C6C7C6",
+"^ c #E7E3E7",
+"/ c #BDC3BD",
+"( c #CED3CE",
+"_ c #BDBABD",
+": c #C6C3C6",
+"< c #C6CBC6",
+"[ c #D6DBD6",
+"} c #BDBEBD",
+"..........................+@#$#$$",
+"........................%%&&@#$#$",
+"......................*==%%&&@#$$",
+"....................--*;>%,&@#$#$",
+"...................')!~={,+@#$#$$",
+"...................]-!^=%%&&@#$#$",
+"................../'(~;>%&&@#$#$$",
+"................._])!*={,&@#$#$$$",
+"................_])~*>%&&$#$$$$$$",
+"................:<![={&&@#$$$$$$$",
+"................:)!^=,+@#$$$$$$$$",
+"...............}'(*^%+@#$#$$$$$$$",
+"...............:<!*>%&&$#$$$$$$$$",
+".............../)!^{,&@#$$$$$$$$$",
+"...............](*^%+@#$$$$$$$$$$",
+"...............]!~=%&&$$$$$$$$$$$",
+"...............'(*=,+@#$$$$$$$$$$",
+"...............<!*>%&&$$$$$$$$$$$",
+"...............'-^=,+@#$$$$$$$$$$",
+"...............<!*>%&#$$$$$$$$$$$",
+"...............'-^=,+@#$$$$$$$$$$",
+"...............<!*>%&#$$$$$$$$$$$",
+"...............'-^=,+@#$$$$$$$$$$",
+"...............<!*>%&#$$$$$$$$$$$",
+"...............'-^=,+@#$$$$$$$$$$",
+"...............<!*>%&#$$$$$$$$$$$",
+"...............'!^=,&@#$$$$$$$$$$",
+"...............<~*>%&#$$$$$$$$$$$",
+"...............)!^{,&@#$$$$$$$$$$",
+"..............])~;%+@#$$$$$$$$$$$",
+"..............]-[={&&$#$$$$$$$$$$",
+".............])!^=,&@#$$$$$$$$$$$",
+"............:'-*^%+@#$$$$$$$$$$$$",
+"............])~*>%&&$#$$$$$$$$$$$",
+"...........:'!*={,&@#$$$$$$$$$$$$",
+"..........:'-~^=,+@#$$$$$$$$$$$$$",
+".......}]'-~^=%,&@#$$$$$$$$$$$$$$",
+".....}:])-~^=%,+@#$#$$$$$$$$$$$$$",
+"}}}:]')-!*^=%,&@#$#$$$$$$$$$$$$$$"};
+
+
+static char * tabselectedend_xpm[] = {
+"33 42 33 1",
+" c None",
+". c #FFFFFF",
+"+ c #CECBE7",
+"@ c #C6C7E7",
+"# c #CECFEF",
+"$ c #C6CBE7",
+"% c #BDBEDE",
+"& c #BDC3DE",
+"* c #CECBEF",
+"= c #B5B6D6",
+"- c #ADAECE",
+"; c #ADB2CE",
+"> c #BDBAD6",
+", c #B5BAD6",
+"' c #C6C3DE",
+") c #ADAAC6",
+"! c #B5B2CE",
+"~ c #B5B6CE",
+"{ c #A5A2BD",
+"] c #A5A6BD",
+"^ c #9C9EB5",
+"/ c #9CA2BD",
+"( c #ADAEC6",
+"_ c #C6C3E7",
+": c #9C9AB5",
+"< c #A5A6C6",
+"[ c #949AAD",
+"} c #A5AAC6",
+"| c #9496AD",
+"1 c #BDBADE",
+"2 c #BDBED6",
+"3 c #9CA2B5",
+"4 c #A5AABD",
+"..........................+@#$#$#",
+"........................%@&*$#$##",
+"......................==%%@@*$#$#",
+".....................-;>,'&+@#$##",
+"....................))!~%%@@*$#$#",
+"...................{]-!%%@@*$#$##",
+"..................^/)(>>_&*$#$###",
+".................:^<(=,'&*@#$#$##",
+".................[]}!~%&+@#$#$###",
+"................|{]-~%&@@#$######",
+"................^/(;1%@@#$#######",
+"................^)(=>@@*$########",
+"...............[{}!,'&*$#$#######",
+"...............^{-!%&+$#$########",
+"...............^)(>2@@#$#########",
+"...............{]!='&*$##########",
+"...............3(;%%@$###########",
+"...............{}=,_@*$##########",
+".............../-!%&+$###########",
+"...............])=,_@#$##########",
+".............../-!%&+$###########",
+"...............])=,_@#$##########",
+".............../-!%&+$###########",
+"...............])=,_@#$##########",
+".............../-!%&+$###########",
+"...............])=,_@#$##########",
+".............../-!%&+$###########",
+"...............])=,@@#$##########",
+".............../-~%&*$###########",
+"...............](=>@@#$##########",
+"...............]!~%&*$###########",
+"..............^)(>2@@#$##########",
+"..............34!,'&*$###########",
+"..............{-;%%@@#$##########",
+".............^](=>@@#$###########",
+"............[/}!,'&*$############",
+"............^](~%&@@#$###########",
+"..........^/};~%&@@#$############",
+".........^/4(~,%@@#$#############",
+".......[^/4(~,%@@*$##############",
+".....[^3]}(~,%&@*$#$#############",
+"|[[:^3]4(;~,%&@*$#$##############"};
+
+
+static char * tabend_xpm[] = {
+"33 42 3 1",
+" c None",
+". c #CECFEF",
+"+ c #FFFFFF",
+"..........................+++++++",
+"........................+++++++++",
+"......................+++++++++++",
+".....................++++++++++++",
+"....................+++++++++++++",
+"...................++++++++++++++",
+"..................+++++++++++++++",
+".................++++++++++++++++",
+".................++++++++++++++++",
+"................+++++++++++++++++",
+"................+++++++++++++++++",
+"................+++++++++++++++++",
+"...............++++++++++++++++++",
+"...............++++++++++++++++++",
+"...............++++++++++++++++++",
+"...............++++++++++++++++++",
+"...............++++++++++++++++++",
+"...............++++++++++++++++++",
+"...............++++++++++++++++++",
+"...............++++++++++++++++++",
+"...............++++++++++++++++++",
+"...............++++++++++++++++++",
+"...............++++++++++++++++++",
+"...............++++++++++++++++++",
+"...............++++++++++++++++++",
+"...............++++++++++++++++++",
+"...............++++++++++++++++++",
+"...............++++++++++++++++++",
+"...............++++++++++++++++++",
+"...............++++++++++++++++++",
+"...............++++++++++++++++++",
+"..............+++++++++++++++++++",
+"..............+++++++++++++++++++",
+"..............+++++++++++++++++++",
+".............++++++++++++++++++++",
+"............+++++++++++++++++++++",
+"............+++++++++++++++++++++",
+"..........+++++++++++++++++++++++",
+".........++++++++++++++++++++++++",
+".......++++++++++++++++++++++++++",
+".....++++++++++++++++++++++++++++",
+"+++++++++++++++++++++++++++++++++"};
+
+
+
+
+QColor fromHsl(QColor c)
+{
+ const qreal h = c.hueF();
+ const qreal s = c.saturationF();
+ const qreal l = c.valueF();
+
+ qreal ca[3] = {0, 0, 0};
+
+ if (s == 0 || h == 1) {
+ // achromatic case
+ ca[0] = ca[1] = ca[2] = l;
+ } else {
+ // chromatic case
+ qreal temp2;
+ if (l < qreal(0.5))
+ temp2 = l * (qreal(1.0) + s);
+ else
+ temp2 = l + s - (l * s);
+
+ const qreal temp1 = (qreal(2.0) * l) - temp2;
+ qreal temp3[3] = { h + (qreal(1.0) / qreal(3.0)),
+ h,
+ h - (qreal(1.0) / qreal(3.0)) };
+
+ for (int i = 0; i != 3; ++i) {
+ if (temp3[i] < qreal(0.0))
+ temp3[i] += qreal(1.0);
+ else if (temp3[i] > qreal(1.0))
+ temp3[i] -= qreal(1.0);
+
+ const qreal sixtemp3 = temp3[i] * qreal(6.0);
+
+ if (sixtemp3 < qreal(1.0))
+ ca[i] = ((temp1 + (temp2 - temp1) * sixtemp3));
+ else if ((temp3[i] * qreal(2.0)) < qreal(1.0))
+ ca[i] = (temp2);
+ else if ((temp3[i] * qreal(3.0)) < qreal(2.0))
+ ca[i] = temp1 + (temp2 -temp1) * (qreal(2.0) /qreal(3.0) - temp3[i]) * qreal(6.0);
+ else ca[i] = temp1;
+ }
+ }
+
+ return QColor::fromRgbF(ca[0], ca[1], ca[2]);
+}
+
+#define Q_MAX_3(a, b, c) ( ( a > b && a > c) ? a : (b > c ? b : c) )
+#define Q_MIN_3(a, b, c) ( ( a < b && a < c) ? a : (b < c ? b : c) )
+
+QColor toHsl(QColor c)
+{
+ QColor color;
+ qreal h;
+ qreal s;
+ qreal l;
+
+ const qreal r = c.redF();
+ const qreal g = c.greenF();
+ const qreal b = c.blueF();
+ const qreal max = Q_MAX_3(r, g, b);
+ const qreal min = Q_MIN_3(r, g, b);
+ const qreal delta = max - min;
+ const qreal delta2 = max + min;
+ const qreal lightness = qreal(0.5) * delta2;
+ l = (lightness);
+ if (qFuzzyIsNull(delta)) {
+ // achromatic case, hue is undefined
+ h = 0;
+ s = 0;
+ } else {
+ // chromatic case
+ qreal hue = 0;
+ if (lightness < qreal(0.5))
+ s = ((delta / delta2));
+ else
+ s = ((delta / (qreal(2.0) - delta2)));
+ if (qFuzzyCompare(r, max)) {
+ hue = ((g - b) /delta);
+ } else if (qFuzzyCompare(g, max)) {
+ hue = (2.0 + (b - r) / delta);
+ } else if (qFuzzyCompare(b, max)) {
+ hue = (4.0 + (r - g) / delta);
+ } else {
+ Q_ASSERT_X(false, "QColor::toHsv", "internal error");
+ }
+ hue *= 60.0;
+ if (hue < 0.0)
+ hue += 360.0;
+ h = (hue * 100);
+ }
+
+ h = h / 36000;
+
+ return QColor::fromHsvF(h, s, l);
+}
+
+void tintColor(QColor &color, QColor tintColor, qreal _saturation)
+{
+ tintColor = toHsl(tintColor);
+ color = toHsl(color);
+ qreal hue = tintColor.hueF();
+
+ qreal saturation = color.saturationF();
+ if (_saturation)
+ saturation = _saturation;
+ qreal lightness = color.valueF();
+ color.setHsvF(hue, saturation, lightness);
+
+ color = fromHsl(color);
+ color.toRgb();
+}
+
+void tintImagePal(QImage *image, QColor color, qreal saturation)
+{
+ QVector<QRgb> colorTable = image->colorTable();
+ for (int i=2;i< colorTable.size();i++) {
+ QColor c(toHsl(colorTable.at(i)));
+ tintColor(c, color, saturation);
+ colorTable[i] = c.rgb();
+ }
+ image->setColorTable(colorTable);
+}
+
+
+void tintImage(QImage *image, QColor color, qreal saturation)
+{
+ *image = image->convertToFormat(QImage::Format_RGB32);
+
+ for (int x = 0; x < image->width(); x++)
+ for (int y = 0; y < image->height(); y++) {
+ QColor c(image->pixel(x,y));
+ tintColor(c, color, saturation);
+ image->setPixel(x, y, c.rgb());
+ }
+}
+
+#endif //Q_WS_WINCE_WM
enum QSliderDirection { SliderUp, SliderDown, SliderLeft, SliderRight };
+#ifdef Q_WS_WINCE_WM
+
+void QWindowsMobileStylePrivate::tintImagesButton(QColor color)
+{
+ if (currentTintButton == color)
+ return;
+
+ imageTabEnd = QImage(tabend_xpm);
+ imageTabSelectedEnd = QImage(tabselectedend_xpm);
+ imageTabSelectedBegin = QImage(tabselectedbeginn_xpm);
+ imageTabMiddle = QImage(tabmiddle_xpm);
+ tintImage(&imageTabEnd, color, 0.0);
+ tintImage(&imageTabSelectedEnd, color, 0.0);
+ tintImage(&imageTabSelectedBegin, color, 0.0);
+ tintImage(&imageTabMiddle, color, 0.0);
+
+ if (!doubleControls) {
+ int height = imageTabMiddle.height() / 2 + 1;
+ imageTabEnd = imageTabEnd.scaledToHeight(height);
+ imageTabMiddle = imageTabMiddle.scaledToHeight(height);
+ imageTabSelectedEnd = imageTabSelectedEnd.scaledToHeight(height);
+ imageTabSelectedBegin = imageTabSelectedBegin.scaledToHeight(height);
+ }
+}
+
+void QWindowsMobileStylePrivate::tintImagesHigh(QColor color)
+{
+ if (currentTintHigh == color)
+ return;
+ currentTintHigh = color;
+ tintListViewHighlight(color);
+ imageScrollbarHandleUpHigh = imageScrollbarHandleUp;
+ imageScrollbarHandleDownHigh = imageScrollbarHandleDown;
+ tintImagePal(&imageScrollbarHandleDownHigh, color, qreal(0.8));
+ tintImagePal(&imageScrollbarHandleUpHigh, color, qreal(0.8));
+}
+
+void QWindowsMobileStylePrivate::tintListViewHighlight(QColor color)
+{
+ imageListViewHighlightCornerRight = QImage(listviewhighcornerright_xpm);
+ tintImage(&imageListViewHighlightCornerRight, color, qreal(0.0));
+
+ imageListViewHighlightCornerLeft = QImage(listviewhighcornerleft_xpm);
+ tintImage(&imageListViewHighlightCornerLeft, color, qreal(0.0));
+
+ imageListViewHighlightMiddle = QImage(listviewhighmiddle_xpm);
+ tintImage(&imageListViewHighlightMiddle, color, qreal(0.0));
+
+ int height = imageListViewHighlightMiddle.height();
+ if (!doubleControls) {
+ height = height / 2;
+ imageListViewHighlightCornerRight = imageListViewHighlightCornerRight.scaledToHeight(height);
+ imageListViewHighlightCornerLeft = imageListViewHighlightCornerLeft.scaledToHeight(height);
+ imageListViewHighlightMiddle = imageListViewHighlightMiddle.scaledToHeight(height);
+ }
+}
+
+#endif //Q_WS_WINCE_WM
+
+void QWindowsMobileStylePrivate::setupWindowsMobileStyle65()
+{
+#ifdef Q_WS_WINCE_WM
+ wm65 = qt_wince_is_windows_mobile_65();
+ if (wm65) {
+ imageScrollbarHandleUp = QImage(sbhandleup_xpm);
+ imageScrollbarHandleDown = QImage(sbhandledown_xpm);
+ imageScrollbarGripUp = QImage(sbgripup_xpm);
+ imageScrollbarGripDown = QImage(sbgripdown_xpm);
+ imageScrollbarGripMiddle = QImage(sbgripmiddle_xpm);
+
+ if (!doubleControls) {
+ imageScrollbarHandleUp = imageScrollbarHandleUp.scaledToHeight(imageScrollbarHandleUp.height() / 2);
+ imageScrollbarHandleDown = imageScrollbarHandleDown.scaledToHeight(imageScrollbarHandleDown.height() / 2);
+ imageScrollbarGripMiddle = imageScrollbarGripMiddle.scaledToHeight(imageScrollbarGripMiddle.height() / 2);
+ imageScrollbarGripUp = imageScrollbarGripUp.scaledToHeight(imageScrollbarGripUp.height() / 2);
+ imageScrollbarGripDown = imageScrollbarGripDown.scaledToHeight(imageScrollbarGripDown.height() / 2);
+ } else {
+ }
+ tintImagesHigh(Qt::blue);
+ }
+#endif //Q_WS_WINCE_WM
+}
+
+void QWindowsMobileStylePrivate::drawTabBarTab(QPainter *painter, const QStyleOptionTab *tab)
+{
+#ifdef Q_WS_WINCE_WM
+ if (wm65) {
+ tintImagesButton(tab->palette.button().color());
+ QRect r;
+ r.setTopLeft(tab->rect.topRight() - QPoint(imageTabMiddle.width(), 0));
+ r.setBottomRight(tab->rect.bottomRight());
+ if (tab->state & QStyle::State_Selected) {
+ painter->fillRect(tab->rect, tab->palette.window());
+ } else {
+ painter->fillRect(tab->rect, QColor(imageTabMiddle.pixel(0,0)));
+ }
+ if (tab->selectedPosition == QStyleOptionTab::NextIsSelected) {
+ painter->drawImage(r, imageTabSelectedBegin);
+ } else if (tab->position == QStyleOptionTab::End ||
+ tab->position == QStyleOptionTab::OnlyOneTab) {
+ if (!(tab->state & QStyle::State_Selected)) {
+ painter->drawImage(r, imageTabEnd);
+ }
+ } else if (tab->state & QStyle::State_Selected) {
+ painter->drawImage(r, imageTabSelectedEnd);
+ } else {
+ painter->drawImage(r, imageTabMiddle);
+ }
+ if (tab->position == QStyleOptionTab::Beginning && ! (tab->state & QStyle::State_Selected)) {
+ painter->drawImage(tab->rect.topLeft() - QPoint(imageTabMiddle.width() * 0.60, 0), imageTabSelectedEnd);
+ }
+ //imageTabBarBig
+ return;
+ }
+#endif //Q_WS_WINCE_WM
+ painter->save();
+ painter->setPen(tab->palette.shadow().color());
+ if (doubleControls) {
+ QPen pen = painter->pen();
+ pen.setWidth(2);
+ pen.setCapStyle(Qt::FlatCap);
+ painter->setPen(pen);
+ }
+ if(tab->shape == QTabBar::RoundedNorth) {
+ if (tab->state & QStyle::State_Selected) {
+ painter->fillRect(tab->rect, tab->palette.light());
+ painter->drawLine(tab->rect.topRight(), tab->rect.bottomRight());
+ }
+ else {
+ painter->fillRect(tab->rect, tab->palette.button());
+ painter->drawLine(tab->rect.bottomLeft() , tab->rect.bottomRight());
+ painter->drawLine(tab->rect.topRight(), tab->rect.bottomRight());
+ }
+ }
+ else if(tab->shape == QTabBar::RoundedSouth) {
+ if (tab->state & QStyle::State_Selected) {
+ painter->fillRect(tab->rect.adjusted(0,-2,0,0), tab->palette.light());
+ painter->drawLine(tab->rect.topRight(), tab->rect.bottomRight());
+ }
+ else {
+ painter->fillRect(tab->rect, tab->palette.button());
+ if (doubleControls)
+ painter->drawLine(tab->rect.topLeft() + QPoint(0,1), tab->rect.topRight() + QPoint(0,1));
+ else
+ painter->drawLine(tab->rect.topLeft(), tab->rect.topRight());
+ painter->drawLine(tab->rect.topRight(), tab->rect.bottomRight());
+ }
+ }
+ else if(tab->shape == QTabBar::RoundedEast) {
+ if (tab->state & QStyle::State_Selected) {
+ painter->fillRect(tab->rect, tab->palette.light());
+ painter->drawLine(tab->rect.topLeft(), tab->rect.topRight());
+ }
+ else {
+ painter->fillRect(tab->rect, tab->palette.button());
+ painter->drawLine(tab->rect.topLeft(), tab->rect.bottomLeft());
+ painter->drawLine(tab->rect.topLeft(), tab->rect.topRight());
+ }
+ }
+ else if(tab->shape == QTabBar::RoundedWest) {
+ if (tab->state & QStyle::State_Selected) {
+ painter->fillRect(tab->rect, tab->palette.light());
+ painter->drawLine(tab->rect.bottomLeft(), tab->rect.bottomRight());
+ }
+ else {
+ painter->fillRect(tab->rect, tab->palette.button());
+ painter->drawLine(tab->rect.topRight(), tab->rect.bottomRight());
+ painter->drawLine(tab->rect.bottomLeft(), tab->rect.bottomRight());
+ }
+ }
+ painter->restore();
+}
+
+void QWindowsMobileStylePrivate::drawPanelItemViewSelected(QPainter *painter, const QStyleOptionViewItemV4 *option, QRect rect)
+{
+#ifdef Q_WS_WINCE_WM
+ if (wm65) {
+ QRect r;
+ if (rect.isValid())
+ r = rect;
+ else
+ r = option->rect;
+ tintImagesHigh(option->palette.highlight().color());
+
+ painter->setPen(QColor(Qt::lightGray));
+
+ if (option->viewItemPosition == QStyleOptionViewItemV4::Middle) {
+ painter->drawImage(r, imageListViewHighlightMiddle);
+ } else if (option->viewItemPosition == QStyleOptionViewItemV4::Beginning) {
+ painter->drawImage(r.adjusted(10, 0, 0, 0), imageListViewHighlightMiddle);
+ } else if (option->viewItemPosition == QStyleOptionViewItemV4::End) {
+ painter->drawImage(r.adjusted(0, 0, -10, 0), imageListViewHighlightMiddle);
+ } else {
+ painter->drawImage(r.adjusted(10, 0, -10, 0), imageListViewHighlightMiddle);
+ }
+
+ QImage cornerLeft = imageListViewHighlightCornerLeft;
+ QImage cornerRight = imageListViewHighlightCornerRight;
+
+ int width = r.width() > cornerRight.width() ? r.width() : cornerRight.width();
+
+ if ((width * 2) > r.width()) {
+ width = (r.width() - 5) / 2;
+ }
+
+ cornerLeft = cornerLeft.scaled(width, r.height());
+ cornerRight = cornerRight.scaled(width, r.height());
+
+ if ((option->viewItemPosition == QStyleOptionViewItemV4::Beginning) || (option->viewItemPosition == QStyleOptionViewItemV4::OnlyOne) || !option->viewItemPosition) {
+ painter->drawImage(r.topLeft(), cornerLeft);
+ }
+ if ((option->viewItemPosition == QStyleOptionViewItemV4::End) || (option->viewItemPosition == QStyleOptionViewItemV4::OnlyOne) || !option->viewItemPosition) {
+ painter->drawImage(r.topRight() - QPoint(cornerRight.width(),0), cornerRight);
+ }
+ return;
+ }
+#endif //Q_WS_WINCE_WM
+ QPalette::ColorGroup cg = option->state & QStyle::State_Enabled
+ ? QPalette::Normal : QPalette::Disabled;
+
+ if (rect.isValid())
+ painter->fillRect(rect, option->palette.brush(cg, QPalette::Highlight));
+ else
+ painter->fillRect(option->rect, option->palette.brush(cg, QPalette::Highlight));
+}
+
+void QWindowsMobileStylePrivate::drawScrollbarGrip(QPainter *p, QStyleOptionSlider *newScrollbar, const QStyleOptionComplex *option, bool drawCompleteFrame)
+{
+#ifdef Q_WS_WINCE_WM
+ if (wm65) {
+ if (newScrollbar->orientation == Qt::Horizontal) {
+ QTransform transform;
+ transform.rotate(-90);
+ QRect r = newScrollbar->rect;
+ p->drawImage(r.adjusted(10, 0, -10, 0), imageScrollbarGripMiddle.transformed(transform));
+ p->drawImage(r.topLeft(), imageScrollbarGripUp.transformed(transform));
+ p->drawImage(r.topRight() - QPoint(imageScrollbarGripDown.height() - 1, 0), imageScrollbarGripDown.transformed(transform));
+ } else {
+ QRect r = newScrollbar->rect;
+ p->drawImage(r.adjusted(0, 10, 0, -10), imageScrollbarGripMiddle);
+ p->drawImage(r.topLeft(), imageScrollbarGripUp);
+ p->drawImage(r.bottomLeft() - QPoint(0, imageScrollbarGripDown.height() - 1), imageScrollbarGripDown);
+ }
+ return ;
+ }
+#endif
+ if (newScrollbar->orientation == Qt::Horizontal) {
+ p->fillRect(newScrollbar->rect,option->palette.button());
+ QRect r = newScrollbar->rect;
+ p->drawLine(r.topLeft(), r.bottomLeft());
+ p->drawLine(r.topRight(), r.bottomRight());
+ if (smartphone) {
+ p->drawLine(r.topLeft(), r.topRight());
+ p->drawLine(r.bottomLeft(), r.bottomRight());
+ }
+ }
+ else {
+ p->fillRect(newScrollbar->rect,option->palette.button());
+ QRect r = newScrollbar->rect;
+ p->drawLine(r.topLeft(), r.topRight());
+ p->drawLine(r.bottomLeft(), r.bottomRight());
+ if (smartphone) {
+ p->drawLine(r.topLeft(), r.bottomLeft());
+ p->drawLine(r.topRight(), r.bottomRight());
+ }
+ }
+ if (newScrollbar->state & QStyle::State_HasFocus) {
+ QStyleOptionFocusRect fropt;
+ fropt.QStyleOption::operator=(*newScrollbar);
+ fropt.rect.setRect(newScrollbar->rect.x() + 2, newScrollbar->rect.y() + 2,
+ newScrollbar->rect.width() - 5,
+ newScrollbar->rect.height() - 5);
+ }
+ int gripMargin = doubleControls ? 4 : 2;
+ int doubleLines = doubleControls ? 2 : 1;
+ //If there is a frame around the scrollbar (abstractScrollArea),
+ //then the margin is different, because of the missing frame
+ int gripMarginFrame = doubleControls ? 3 : 1;
+ if (drawCompleteFrame)
+ gripMarginFrame = 0;
+ //draw grips
+ if (!smartphone)
+ if (newScrollbar->orientation == Qt::Horizontal) {
+ for (int i = -3; i < 3; i += 2) {
+ p->drawLine(
+ QPoint(newScrollbar->rect.center().x() + i * doubleLines + 1,
+ newScrollbar->rect.top() + gripMargin +gripMarginFrame),
+ QPoint(newScrollbar->rect.center().x() + i * doubleLines + 1,
+ newScrollbar->rect.bottom() - gripMargin));
+ }
+ } else {
+ for (int i = -2; i < 4 ; i += 2) {
+ p->drawLine(
+ QPoint(newScrollbar->rect.left() + gripMargin + gripMarginFrame ,
+ newScrollbar->rect.center().y() + 1 + i * doubleLines - 1),
+ QPoint(newScrollbar->rect.right() - gripMargin,
+ newScrollbar->rect.center().y() + 1 + i * doubleLines - 1));
+ }
+ }
+ if (!smartphone) {
+ QRect r;
+ if (doubleControls)
+ r = option->rect.adjusted(1, 1, -1, 0);
+ else
+ r = option->rect.adjusted(0, 0, -1, 0);
+ if (drawCompleteFrame && doubleControls)
+ r.adjust(0, 0, 0, -1);
+ //Check if the scrollbar is part of an abstractItemView and draw the frame according
+ if (drawCompleteFrame)
+ p->drawRect(r);
+ else
+ if (newScrollbar->orientation == Qt::Horizontal)
+ p->drawLine(r.topLeft(), r.topRight());
+ else
+ p->drawLine(r.topLeft(), r.bottomLeft());
+ }
+}
+
+void QWindowsMobileStylePrivate::drawScrollbarHandleUp(QPainter *p, QStyleOptionSlider *opt, bool completeFrame, bool )
+{
+#ifdef Q_WS_WINCE_WM
+ if (wm65) {
+ tintImagesHigh(opt->palette.highlight().color());
+ QRect r = opt->rect;
+ if (opt->orientation == Qt::Horizontal) {
+ QTransform transform;
+ transform.rotate(-90);
+ if (opt->state & QStyle::State_Sunken)
+ p->drawImage(r.topLeft(), imageScrollbarHandleUpHigh.transformed(transform));
+ else
+ p->drawImage(r.topLeft(), imageScrollbarHandleUp.transformed(transform));
+ } else {
+ if (opt->state & QStyle::State_Sunken)
+ p->drawImage(r.topLeft(), imageScrollbarHandleUpHigh);
+ else
+ p->drawImage(r.topLeft(), imageScrollbarHandleUp);
+ }
+ return ;
+ }
+#endif //Q_WS_WINCE_WM
+
+ QBrush fill = opt->palette.button();
+ if (opt->state & QStyle::State_Sunken)
+ fill = opt->palette.shadow();
+
+ QStyleOption arrowOpt = *opt;
+ if (doubleControls)
+ arrowOpt.rect = opt->rect.adjusted(4, 6, -5, -3);
+ else
+ arrowOpt.rect = opt->rect.adjusted(5, 6, -4, -3);
+
+ bool horizontal = (opt->orientation == Qt::Horizontal);
+
+ if (horizontal) {
+ p->fillRect(opt->rect,fill);
+ QRect r = opt->rect.adjusted(0,0,1,0);
+ p->drawLine(r.topRight(), r.bottomRight());
+ if (doubleControls)
+ arrowOpt.rect.adjust(0, -2 ,0, -2);
+ q_func()->proxy()->drawPrimitive(QStyle::PE_IndicatorArrowLeft, &arrowOpt, p, 0);
+ } else {
+ p->fillRect(opt->rect,fill);
+ QRect r = opt->rect.adjusted(0, 0, 0, 1);
+ p->drawLine(r.bottomLeft(), r.bottomRight());
+ if (completeFrame)
+ arrowOpt.rect.adjust(-2, 0, -2, 0);
+ if (doubleControls)
+ arrowOpt.rect.adjust(0, -4 , 0, -4);
+ if (completeFrame && doubleControls)
+ arrowOpt.rect.adjust(2, 0, 2, 0);
+ q_func()->proxy()->drawPrimitive(QStyle::PE_IndicatorArrowUp, &arrowOpt, p, 0);
+ }
+}
+
+void QWindowsMobileStylePrivate::drawScrollbarHandleDown(QPainter *p, QStyleOptionSlider *opt, bool completeFrame, bool secondScrollBar)
+{
+
+#ifdef Q_WS_WINCE_WM
+ if (wm65) {
+ tintImagesHigh(opt->palette.highlight().color());
+ QRect r = opt->rect;
+ if (opt->orientation == Qt::Horizontal) {
+ QTransform transform;
+ transform.rotate(-90);
+ if (opt->state & QStyle::State_Sunken)
+ p->drawImage(r.topLeft(), imageScrollbarHandleDownHigh.transformed(transform));
+ else
+ p->drawImage(r.topLeft(), imageScrollbarHandleDown.transformed(transform));
+ } else {
+ if (opt->state & QStyle::State_Sunken)
+ p->drawImage(r.topLeft(), imageScrollbarHandleDownHigh);
+ else
+ p->drawImage(r.topLeft(), imageScrollbarHandleDown);
+ }
+ return ;
+ }
+#endif //Q_WS_WINCE_WM
+
+ QBrush fill = opt->palette.button();
+ if (opt->state & QStyle::State_Sunken)
+ fill = opt->palette.shadow();
+
+ QStyleOption arrowOpt = *opt;
+ if (doubleControls)
+ arrowOpt.rect = opt->rect.adjusted(4, 0, -5, 3);
+ else
+ arrowOpt.rect = opt->rect.adjusted(5, 6, -4, -3);
+
+ bool horizontal = (opt->orientation == Qt::Horizontal);
+
+ if (horizontal) {
+ p->fillRect(opt->rect,fill);
+ QRect r = opt->rect.adjusted(0, 0, 0, 0);
+ p->drawLine(r.topLeft(), r.bottomLeft());
+ if (secondScrollBar)
+ p->drawLine(r.topRight(), r.bottomRight());
+ if (doubleControls)
+ arrowOpt.rect.adjust(0, 4, 0, 4 );
+ q_func()->proxy()->drawPrimitive(QStyle::PE_IndicatorArrowRight, &arrowOpt, p, 0);
+ } else {
+ p->fillRect(opt->rect,fill);
+ QRect r = opt->rect.adjusted(0, -1, 0, -1);
+ p->drawLine(r.topLeft(), r.topRight());
+ if (secondScrollBar)
+ p->drawLine(r.bottomLeft() + QPoint(0,1), r.bottomRight() + QPoint(0, 1));
+ if (completeFrame)
+ arrowOpt.rect.adjust(-2, 0, -2, 0);
+ if (doubleControls)
+ arrowOpt.rect.adjust(1, 0, 1, 0 );
+ if (completeFrame && doubleControls)
+ arrowOpt.rect.adjust(1, 0, 1, 0);
+ q_func()->proxy()->drawPrimitive(QStyle::PE_IndicatorArrowDown, &arrowOpt, p, 0);
+ }
+}
+
+void QWindowsMobileStylePrivate::drawScrollbarGroove(QPainter *p,const QStyleOptionSlider *opt)
+{
+#ifdef Q_OS_WINCE_WM
+ if (wm65) {
+ p->fillRect(opt->rect, QColor(231, 231, 231));
+ return ;
+ }
+#endif
+ QBrush fill;
+ if (smartphone) {
+ fill = opt->palette.light();
+ p->fillRect(opt->rect, fill);
+ fill = opt->palette.button();
+ QImage image;
+#ifndef QT_NO_IMAGEFORMAT_XPM
+ if (opt->orientation == Qt::Horizontal)
+ image = QImage(vertlines_xpm);
+ else
+ image = QImage(horlines_xpm);
+#endif
+ image.setColor(1, opt->palette.button().color().rgb());
+ fill.setTextureImage(image);
+ }
+ else {
+ fill = opt->palette.light();
+ }
+ p->fillRect(opt->rect, fill);
+}
+
QWindowsMobileStyle::QWindowsMobileStyle(QWindowsMobileStylePrivate &dd) : QWindowsStyle(dd) {
qApp->setEffectEnabled(Qt::UI_FadeMenu, false);
qApp->setEffectEnabled(Qt::UI_AnimateMenu, false);
@@ -685,13 +4512,13 @@ QWindowsMobileStyle::QWindowsMobileStyle() : QWindowsStyle(*new QWindowsMobileSt
QWindowsMobileStylePrivate::QWindowsMobileStylePrivate() :QWindowsStylePrivate() {
-#ifdef Q_OS_WINCE
+#ifdef Q_WS_WINCE
doubleControls = qt_wince_is_high_dpi();
smartphone = qt_wince_is_smartphone();
#else
doubleControls = false;
smartphone = false;
-#endif //Q_OS_WINCE
+#endif //Q_WS_WINCE
#ifndef QT_NO_IMAGEFORMAT_XPM
@@ -721,6 +4548,9 @@ QWindowsMobileStylePrivate::QWindowsMobileStylePrivate() :QWindowsStylePrivate()
imageNormalize = QImage(normal_small_xpm);
}
+ setupWindowsMobileStyle65();
+
+
imageArrowDownBig = QImage(arrowdown_big_xpm);
imageArrowUpBig = QImage(arrowdown_big_xpm).mirrored();
imageArrowLeftBig = QImage(arrowleft_big_xpm);
@@ -1156,7 +4986,7 @@ void QWindowsMobileStyle::drawPrimitive(PrimitiveElement element, const QStyleOp
case PE_IndicatorSpinPlus:
case PE_IndicatorSpinMinus: {
QRect r = option->rect;
- int fw = pixelMetric(PM_DefaultFrameWidth, option, widget)+2;
+ int fw = proxy()->pixelMetric(PM_DefaultFrameWidth, option, widget)+2;
QRect br = r.adjusted(fw, fw, -fw, -fw);
int offset = (option->state & State_Sunken) ? 1 : 0;
int step = (br.width() + 4) / 5;
@@ -1193,8 +5023,8 @@ void QWindowsMobileStyle::drawPrimitive(PrimitiveElement element, const QStyleOp
break;
}
if (option->state & State_Sunken)
- painter->translate(pixelMetric(PM_ButtonShiftHorizontal),
- pixelMetric(PM_ButtonShiftVertical));
+ painter->translate(proxy()->pixelMetric(PM_ButtonShiftHorizontal),
+ proxy()->pixelMetric(PM_ButtonShiftVertical));
if (option->state & State_Enabled) {
painter->translate(option->rect.x() + option->rect.width() / 2,
option->rect.y() + option->rect.height() / 2);
@@ -1373,21 +5203,37 @@ void QWindowsMobileStyle::drawPrimitive(PrimitiveElement element, const QStyleOp
}
switch (tab->shape) {
case QTabBar::RoundedNorth:
+#ifdef Q_WS_WINCE_WM
+ if (!d->wm65)
+#endif
+ {
if (d->doubleControls)
- painter->drawLine(rect.topLeft() + QPoint(0, 1), rect.topRight() + QPoint(0, 1));
+ painter->drawLine(rect.topLeft() + QPoint(0, 1), rect.topRight() + QPoint(0, 1));
else
painter->drawLine(rect.topLeft(), rect.topRight());
+ }
break;
case QTabBar::RoundedSouth:
+#ifdef Q_WS_WINCE_WM
+ if (!d->wm65)
+#endif
+ {
if (d->doubleControls)
painter->drawLine(rect.bottomLeft(), rect.bottomRight());
else
painter->drawLine(rect.bottomLeft(), rect.bottomRight());
+ }
break;
case QTabBar::RoundedEast:
+#ifdef Q_WS_WINCE_WM
+ if (!d->wm65)
+#endif
painter->drawLine(rect.topRight(), rect.bottomRight());
break;
case QTabBar::RoundedWest:
+#ifdef Q_WS_WINCE_WM
+ if (!d->wm65)
+#endif
painter->drawLine(rect.topLeft(), rect.bottomLeft());
break;
case QTabBar::TriangularWest:
@@ -1406,6 +5252,47 @@ void QWindowsMobileStyle::drawPrimitive(PrimitiveElement element, const QStyleOp
}
break;
#endif //QT_NO_TABBAR
+#ifndef QT_NO_ITEMVIEWS
+ case PE_PanelItemViewRow:
+ if (const QStyleOptionViewItemV4 *vopt = qstyleoption_cast<const QStyleOptionViewItemV4 *>(option)) {
+ QPalette::ColorGroup cg = vopt->state & QStyle::State_Enabled
+ ? QPalette::Normal : QPalette::Disabled;
+ if (cg == QPalette::Normal && !(vopt->state & QStyle::State_Active))
+ cg = QPalette::Inactive;
+
+ if ((vopt->state & QStyle::State_Selected) && proxy()->styleHint(QStyle::SH_ItemView_ShowDecorationSelected, option, widget))
+ d->drawPanelItemViewSelected(painter, vopt);
+ else if (vopt->features & QStyleOptionViewItemV2::Alternate)
+ painter->fillRect(vopt->rect, vopt->palette.brush(cg, QPalette::AlternateBase));
+ else if (!(vopt->state & QStyle::State_Enabled))
+ painter->fillRect(vopt->rect, vopt->palette.brush(cg, QPalette::Base));
+ }
+ break;
+ case PE_PanelItemViewItem:
+ if (const QStyleOptionViewItemV4 *vopt = qstyleoption_cast<const QStyleOptionViewItemV4 *>(option)) {
+ QPalette::ColorGroup cg = vopt->state & QStyle::State_Enabled
+ ? QPalette::Normal : QPalette::Disabled;
+ if (cg == QPalette::Normal && !(vopt->state & QStyle::State_Active))
+ cg = QPalette::Inactive;
+
+ if (vopt->showDecorationSelected && (vopt->state & QStyle::State_Selected)) {
+ d->drawPanelItemViewSelected(painter, vopt);
+ } else {
+ if (vopt->backgroundBrush.style() != Qt::NoBrush) {
+ QPointF oldBO = painter->brushOrigin();
+ painter->setBrushOrigin(vopt->rect.topLeft());
+ painter->fillRect(vopt->rect, vopt->backgroundBrush);
+ painter->setBrushOrigin(oldBO);
+ }
+
+ if (vopt->state & QStyle::State_Selected) {
+ QRect textRect = proxy()->subElementRect(QStyle::SE_ItemViewItemText, option, widget);
+ d->drawPanelItemViewSelected(painter, vopt, textRect);
+ }
+ }
+ }
+ break;
+#endif //QT_NO_ITEMVIEWS
case PE_FrameWindow: {
QPalette popupPal = option->palette;
@@ -1501,25 +5388,25 @@ void QWindowsMobileStyle::drawControl(ControlElement element, const QStyleOption
case CE_PushButtonBevel:
if (const QStyleOptionButton *button = qstyleoption_cast<const QStyleOptionButton *>(option)) {
QRect br = button->rect;
- int dbi = pixelMetric(PM_ButtonDefaultIndicator, button, widget);
+ int dbi = proxy()->pixelMetric(PM_ButtonDefaultIndicator, button, widget);
if (button->features & QStyleOptionButton::AutoDefaultButton)
br.setCoords(br.left() + dbi, br.top() + dbi, br.right() - dbi, br.bottom() - dbi);
QStyleOptionButton tmpBtn = *button;
tmpBtn.rect = br;
- drawPrimitive(PE_PanelButtonCommand, &tmpBtn, painter, widget);
+ proxy()->drawPrimitive(PE_PanelButtonCommand, &tmpBtn, painter, widget);
if (button->features & QStyleOptionButton::HasMenu) {
- int mbi = pixelMetric(PM_MenuButtonIndicator, button, widget);
+ int mbi = proxy()->pixelMetric(PM_MenuButtonIndicator, button, widget);
QRect ir = button->rect;
QStyleOptionButton newButton = *button;
if (d->doubleControls)
newButton.rect = QRect(ir.right() - mbi, ir.height() - 30, mbi, ir.height() - 4);
else
newButton.rect = QRect(ir.right() - mbi, ir.height() - 20, mbi, ir.height() - 4);
- drawPrimitive(PE_IndicatorArrowDown, &newButton, painter, widget);
+ proxy()->drawPrimitive(PE_IndicatorArrowDown, &newButton, painter, widget);
}
if (button->features & QStyleOptionButton::DefaultButton)
- drawPrimitive(PE_FrameDefaultButton, option, painter, widget);
+ proxy()->drawPrimitive(PE_FrameDefaultButton, option, painter, widget);
}
break;
case CE_RadioButton:
@@ -1527,19 +5414,19 @@ void QWindowsMobileStyle::drawControl(ControlElement element, const QStyleOption
if (const QStyleOptionButton *button = qstyleoption_cast<const QStyleOptionButton *>(option)) {
bool isRadio = (element == CE_RadioButton);
QStyleOptionButton subopt = *button;
- subopt.rect = subElementRect(isRadio ? SE_RadioButtonIndicator
+ subopt.rect = proxy()->subElementRect(isRadio ? SE_RadioButtonIndicator
: SE_CheckBoxIndicator, button, widget);
- drawPrimitive(isRadio ? PE_IndicatorRadioButton : PE_IndicatorCheckBox,
+ proxy()->drawPrimitive(isRadio ? PE_IndicatorRadioButton : PE_IndicatorCheckBox,
&subopt, painter, widget);
- subopt.rect = subElementRect(isRadio ? SE_RadioButtonContents
+ subopt.rect = proxy()->subElementRect(isRadio ? SE_RadioButtonContents
: SE_CheckBoxContents, button, widget);
- drawControl(isRadio ? CE_RadioButtonLabel : CE_CheckBoxLabel, &subopt, painter, widget);
+ proxy()->drawControl(isRadio ? CE_RadioButtonLabel : CE_CheckBoxLabel, &subopt, painter, widget);
if (button->state & State_HasFocus) {
QStyleOptionFocusRect fropt;
fropt.QStyleOption::operator=(*button);
- fropt.rect = subElementRect(isRadio ? SE_RadioButtonFocusRect
+ fropt.rect = proxy()->subElementRect(isRadio ? SE_RadioButtonFocusRect
: SE_CheckBoxFocusRect, button, widget);
- drawPrimitive(PE_FrameFocusRect, &fropt, painter, widget);
+ proxy()->drawPrimitive(PE_FrameFocusRect, &fropt, painter, widget);
}
}
break;
@@ -1553,7 +5440,7 @@ void QWindowsMobileStyle::drawControl(ControlElement element, const QStyleOption
QRect textRect = button->rect;
if (!button->icon.isNull()) {
pix = button->icon.pixmap(button->iconSize, button->state & State_Enabled ? QIcon::Normal : QIcon::Disabled);
- drawItemPixmap(painter, button->rect, alignment, pix);
+ proxy()->drawItemPixmap(painter, button->rect, alignment, pix);
if (button->direction == Qt::RightToLeft)
textRect.setRight(textRect.right() - button->iconSize.width() - 4);
else
@@ -1561,10 +5448,10 @@ void QWindowsMobileStyle::drawControl(ControlElement element, const QStyleOption
}
if (!button->text.isEmpty()){
if (button->state & State_Enabled)
- drawItemText(painter, textRect, alignment | Qt::TextShowMnemonic,
+ proxy()->drawItemText(painter, textRect, alignment | Qt::TextShowMnemonic,
button->palette, false, button->text, QPalette::WindowText);
else
- drawItemText(painter, textRect, alignment | Qt::TextShowMnemonic,
+ proxy()->drawItemText(painter, textRect, alignment | Qt::TextShowMnemonic,
button->palette, false, button->text, QPalette::Mid);
}
}
@@ -1580,73 +5467,16 @@ void QWindowsMobileStyle::drawControl(ControlElement element, const QStyleOption
#ifndef QT_NO_TABBAR
case CE_TabBarTab:
if (const QStyleOptionTab *tab = qstyleoption_cast<const QStyleOptionTab *>(option)) {
- drawControl(CE_TabBarTabShape, tab, painter, widget);
- drawControl(CE_TabBarTabLabel, tab, painter, widget);
+ proxy()->drawControl(CE_TabBarTabShape, tab, painter, widget);
+ proxy()->drawControl(CE_TabBarTabLabel, tab, painter, widget);
}
break;
case CE_TabBarTabShape:
if (const QStyleOptionTab *tab = qstyleoption_cast<const QStyleOptionTab *>(option)) {
+
if (tab->shape == QTabBar::RoundedNorth || tab->shape == QTabBar::RoundedEast ||
tab->shape == QTabBar::RoundedSouth || tab->shape == QTabBar::RoundedWest) {
-
- painter->save();
- painter->setPen(tab->palette.shadow().color());
- if (d->doubleControls) {
- QPen pen = painter->pen();
- pen.setWidth(2);
- pen.setCapStyle(Qt::FlatCap);
- painter->setPen(pen);
- }
- if(tab->shape == QTabBar::RoundedNorth) {
- if (tab->state & State_Selected) {
- painter->fillRect(tab->rect, tab->palette.light());
- painter->drawLine(tab->rect.topRight(), tab->rect.bottomRight());
- }
- else {
- painter->fillRect(tab->rect, tab->palette.button());
- painter->drawLine(tab->rect.bottomLeft() , tab->rect.bottomRight());
- painter->drawLine(tab->rect.topRight(), tab->rect.bottomRight());
- }
- }
- else if(tab->shape == QTabBar::RoundedSouth) {
-
- if (tab->state & State_Selected) {
- painter->fillRect(tab->rect.adjusted(0,-2,0,0), tab->palette.light());
- painter->drawLine(tab->rect.topRight(), tab->rect.bottomRight());
- }
- else {
- painter->fillRect(tab->rect, tab->palette.button());
- if (d->doubleControls)
- painter->drawLine(tab->rect.topLeft() + QPoint(0,1), tab->rect.topRight() + QPoint(0,1));
- else
- painter->drawLine(tab->rect.topLeft(), tab->rect.topRight());
- painter->drawLine(tab->rect.topRight(), tab->rect.bottomRight());
- }
- }
- else if(tab->shape == QTabBar::RoundedEast) {
- if (tab->state & State_Selected) {
- painter->fillRect(tab->rect, tab->palette.light());
- painter->drawLine(tab->rect.topLeft(), tab->rect.topRight());
- }
- else {
- painter->fillRect(tab->rect, tab->palette.button());
- painter->drawLine(tab->rect.topLeft(), tab->rect.bottomLeft());
- painter->drawLine(tab->rect.topLeft(), tab->rect.topRight());
- }
- }
- else if(tab->shape == QTabBar::RoundedWest) {
- if (tab->state & State_Selected) {
- painter->fillRect(tab->rect, tab->palette.light());
- painter->drawLine(tab->rect.bottomLeft(), tab->rect.bottomRight());
- }
- else {
- painter->fillRect(tab->rect, tab->palette.button());
- painter->drawLine(tab->rect.topRight(), tab->rect.bottomRight());
- painter->drawLine(tab->rect.bottomLeft(), tab->rect.bottomRight());
- }
- }
-
- painter->restore();
+ d->drawTabBarTab(painter, tab);
} else {
QCommonStyle::drawControl(element, option, painter, widget);
}
@@ -1677,17 +5507,17 @@ void QWindowsMobileStyle::drawControl(ControlElement element, const QStyleOption
if (const QStyleOptionHeader *header = qstyleoption_cast<const QStyleOptionHeader *>(option)) {
QRegion clipRegion = painter->clipRegion();
painter->setClipRect(option->rect);
- drawControl(CE_HeaderSection, header, painter, widget);
+ proxy()->drawControl(CE_HeaderSection, header, painter, widget);
QStyleOptionHeader subopt = *header;
- subopt.rect = subElementRect(SE_HeaderLabel, header, widget);
+ subopt.rect = proxy()->subElementRect(SE_HeaderLabel, header, widget);
if (header->state & State_Sunken)
subopt.palette.setColor(QPalette::ButtonText, header->palette.brightText().color());
subopt.state |= QStyle::State_On;
if (subopt.rect.isValid())
- drawControl(CE_HeaderLabel, &subopt, painter, widget);
+ proxy()->drawControl(CE_HeaderLabel, &subopt, painter, widget);
if (header->sortIndicator != QStyleOptionHeader::None) {
- subopt.rect = subElementRect(SE_HeaderArrow, option, widget);
- drawPrimitive(PE_IndicatorHeaderArrow, &subopt, painter, widget);
+ subopt.rect = proxy()->subElementRect(SE_HeaderArrow, option, widget);
+ proxy()->drawPrimitive(PE_IndicatorHeaderArrow, &subopt, painter, widget);
}
painter->setClipRegion(clipRegion);
}
@@ -1832,14 +5662,14 @@ void QWindowsMobileStyle::drawControl(ControlElement element, const QStyleOption
painter->setFont(newFont);
QPalette palette = dwOpt->palette;
palette.setColor(QPalette::Window, inactiveCaptionTextColor);
- QRect titleRect = subElementRect(SE_DockWidgetTitleBarText, option, widget);
+ QRect titleRect = proxy()->subElementRect(SE_DockWidgetTitleBarText, option, widget);
if (verticalTitleBar) {
titleRect = QRect(r.left() + rect.bottom()
- titleRect.bottom(),
r.top() + titleRect.left() - rect.left(),
titleRect.height(), titleRect.width());
}
- drawItemText(painter, titleRect,
+ proxy()->drawItemText(painter, titleRect,
Qt::AlignLeft | Qt::AlignVCenter | Qt::TextShowMnemonic, palette,
dwOpt->state & State_Enabled, dwOpt->title,
floating ? (active ? QPalette::BrightText : QPalette::Window) : QPalette::WindowText);
@@ -1889,7 +5719,7 @@ void QWindowsMobileStyle::drawControl(ControlElement element, const QStyleOption
point.rx() += pixw;
if ((button->state & (State_On | State_Sunken)) && button->direction == Qt::RightToLeft)
- point.rx() -= pixelMetric(PM_ButtonShiftHorizontal, option, widget) * 2;
+ point.rx() -= proxy()->pixelMetric(PM_ButtonShiftHorizontal, option, widget) * 2;
painter->drawPixmap(visualPos(button->direction, button->rect, point), pixmap);
@@ -1905,9 +5735,9 @@ void QWindowsMobileStyle::drawControl(ControlElement element, const QStyleOption
tf |= Qt::AlignHCenter;
}
if (button->state & State_Enabled)
- drawItemText(painter, ir, tf, button->palette, true, button->text, colorRole);
+ proxy()->drawItemText(painter, ir, tf, button->palette, true, button->text, colorRole);
else
- drawItemText(painter, ir, tf, button->palette, true, button->text, QPalette::Mid);
+ proxy()->drawItemText(painter, ir, tf, button->palette, true, button->text, QPalette::Mid);
painter->restore();
}
break;
@@ -1927,11 +5757,11 @@ void QWindowsMobileStyle::drawComplexControl(ComplexControl control, const QStyl
#ifndef QT_NO_SLIDER
case CC_Slider:
if (const QStyleOptionSlider *slider = qstyleoption_cast<const QStyleOptionSlider *>(option)) {
- int thickness = pixelMetric(PM_SliderControlThickness, slider, widget);
- int len = pixelMetric(PM_SliderLength, slider, widget);
+ int thickness = proxy()->pixelMetric(PM_SliderControlThickness, slider, widget);
+ int len = proxy()->pixelMetric(PM_SliderLength, slider, widget);
int ticks = slider->tickPosition;
- QRect groove = subControlRect(CC_Slider, slider, SC_SliderGroove, widget);
- QRect handle = subControlRect(CC_Slider, slider, SC_SliderHandle, widget);
+ QRect groove = proxy()->subControlRect(CC_Slider, slider, SC_SliderGroove, widget);
+ QRect handle = proxy()->subControlRect(CC_Slider, slider, SC_SliderHandle, widget);
if ((slider->subControls & SC_SliderGroove) && groove.isValid()) {
int mid = thickness / 2;
@@ -1982,8 +5812,8 @@ void QWindowsMobileStyle::drawComplexControl(ComplexControl control, const QStyl
if (slider->state & State_HasFocus) {
QStyleOptionFocusRect fropt;
fropt.QStyleOption::operator=(*slider);
- fropt.rect = subElementRect(SE_SliderFocusRect, slider, widget);
- drawPrimitive(PE_FrameFocusRect, &fropt, painter, widget);
+ fropt.rect = proxy()->subElementRect(SE_SliderFocusRect, slider, widget);
+ proxy()->drawPrimitive(PE_FrameFocusRect, &fropt, painter, widget);
}
if ((tickAbove && tickBelow) || (!tickAbove && !tickBelow)) {
Qt::BGMode oldMode = painter->backgroundMode();
@@ -2118,26 +5948,8 @@ void QWindowsMobileStyle::drawComplexControl(ComplexControl control, const QStyl
painter->setPen(pen);
}
if (const QStyleOptionSlider *scrollbar = qstyleoption_cast<const QStyleOptionSlider *>(option)) {
+ d->drawScrollbarGroove(painter, scrollbar);
// Make a copy here and reset it for each primitive.
- QBrush fill;
- if (d->smartphone) {
- fill = option->palette.light();
- painter->fillRect(option->rect,fill);
- fill = option->palette.button();
- QImage image;
-#ifndef QT_NO_IMAGEFORMAT_XPM
- if (scrollbar->orientation == Qt::Horizontal)
- image = QImage(vertlines_xpm);
- else
- image = QImage(horlines_xpm);
-#endif
- image.setColor(1, option->palette.button().color().rgb());
- fill.setTextureImage(image);
- }
- else {
- fill = option->palette.light();
- }
- painter->fillRect(option->rect,fill);
QStyleOptionSlider newScrollbar = *scrollbar;
State saveFlags = scrollbar->state;
//Check if the scrollbar is part of an abstractItemView and draw the frame according
@@ -2159,209 +5971,34 @@ void QWindowsMobileStyle::drawComplexControl(ComplexControl control, const QStyl
saveFlags |= State_Enabled;
if (scrollbar->subControls & SC_ScrollBarSubLine) {
newScrollbar.state = saveFlags;
- newScrollbar.rect = subControlRect(control, &newScrollbar, SC_ScrollBarSubLine, widget);
+ newScrollbar.rect = proxy()->subControlRect(control, &newScrollbar, SC_ScrollBarSubLine, widget);
if (newScrollbar.rect.isValid()) {
if (!(scrollbar->activeSubControls & SC_ScrollBarSubLine))
newScrollbar.state &= ~(State_Sunken | State_MouseOver);
- QStyleOption arrowOpt = newScrollbar;
- if (d->doubleControls)
- arrowOpt.rect = newScrollbar.rect.adjusted(4, 6, -5, -3);
- else
- arrowOpt.rect = newScrollbar.rect.adjusted(5, 6, -4, -3);
- QBrush fill = option->palette.button();
- if (newScrollbar.state & State_Sunken)
- fill = option->palette.shadow();
- if (scrollbar->orientation == Qt::Horizontal) {
- painter->fillRect(newScrollbar.rect,fill);
- QRect r = newScrollbar.rect.adjusted(0,0,1,0);
- painter->drawLine(r.topRight(), r.bottomRight());
- if (d->doubleControls)
- arrowOpt.rect.adjust(0, -2 ,0, -2);
- drawPrimitive(PE_IndicatorArrowLeft, &arrowOpt, painter, widget);
- }
- else {
- painter->fillRect(newScrollbar.rect,fill);
- QRect r = newScrollbar.rect.adjusted(0, 0, 0, 1);
- painter->drawLine(r.bottomLeft(), r.bottomRight());
- if (drawCompleteFrame)
- arrowOpt.rect.adjust(-2, 0, -2, 0);
- if (d->doubleControls)
- arrowOpt.rect.adjust(0, -4 , 0, -4);
- if (drawCompleteFrame && d->doubleControls)
- arrowOpt.rect.adjust(2, 0, 2, 0);
- drawPrimitive(PE_IndicatorArrowUp, &arrowOpt, painter, widget);
- }
+ d->drawScrollbarHandleUp(painter, &newScrollbar, drawCompleteFrame, secondScrollBar);
}
}
if (scrollbar->subControls & SC_ScrollBarAddLine) {
newScrollbar.rect = scrollbar->rect;
newScrollbar.state = saveFlags;
- newScrollbar.rect = subControlRect(control, &newScrollbar, SC_ScrollBarAddLine, widget);
+ newScrollbar.rect = proxy()->subControlRect(control, &newScrollbar, SC_ScrollBarAddLine, widget);
if (newScrollbar.rect.isValid()) {
if (!(scrollbar->activeSubControls & SC_ScrollBarAddLine))
newScrollbar.state &= ~(State_Sunken | State_MouseOver);
- QStyleOption arrowOpt = newScrollbar;
- if (d->doubleControls)
- arrowOpt.rect = newScrollbar.rect.adjusted(4, 0, -5, 3);
- else
- arrowOpt.rect = newScrollbar.rect.adjusted(5, 6, -4, -3);
- QBrush fill = option->palette.button();
- if (newScrollbar.state & State_Sunken)
- fill = option->palette.shadow();
- if (scrollbar->orientation == Qt::Horizontal) {
- painter->fillRect(newScrollbar.rect,fill);
- QRect r = newScrollbar.rect.adjusted(0, 0, 0, 0);
- painter->drawLine(r.topLeft(), r.bottomLeft());
- if (secondScrollBar)
- painter->drawLine(r.topRight(), r.bottomRight());
- if (d->doubleControls)
- arrowOpt.rect.adjust(0, 4, 0, 4 );
- drawPrimitive(PE_IndicatorArrowRight, &arrowOpt, painter, widget);
- }
- else {
- painter->fillRect(newScrollbar.rect,fill);
- QRect r = newScrollbar.rect.adjusted(0, -1, 0, -1);
- painter->drawLine(r.topLeft(), r.topRight());
- if (secondScrollBar)
- painter->drawLine(r.bottomLeft() + QPoint(0,1), r.bottomRight() + QPoint(0, 1));
- if (drawCompleteFrame)
- arrowOpt.rect.adjust(-2, 0, -2, 0);
- if (d->doubleControls)
- arrowOpt.rect.adjust(1, 0, 1, 0 );
- if (drawCompleteFrame && d->doubleControls)
- arrowOpt.rect.adjust(1, 0, 1, 0);
- drawPrimitive(PE_IndicatorArrowDown, &arrowOpt, painter, widget);
- }
- }
- }
- if (scrollbar->subControls & SC_ScrollBarSubPage) {
- newScrollbar.rect = scrollbar->rect;
- newScrollbar.state = saveFlags;
- newScrollbar.rect = subControlRect(control, &newScrollbar, SC_ScrollBarSubPage, widget);
- if (newScrollbar.rect.isValid()) {
- if (!(scrollbar->activeSubControls & SC_ScrollBarSubPage))
- newScrollbar.state &= ~(State_Sunken | State_MouseOver);
- if (scrollbar->orientation == Qt::Horizontal) {
- QRect r = newScrollbar.rect.adjusted(0, 0, 0, 0);
- }
- else{
- QRect r = newScrollbar.rect.adjusted(0, 0, 0, 0);
- }
- }
- }
- if (scrollbar->subControls & SC_ScrollBarAddPage) {
- newScrollbar.rect = scrollbar->rect;
- newScrollbar.state = saveFlags;
- newScrollbar.rect = subControlRect(control, &newScrollbar, SC_ScrollBarAddPage, widget);
- if (newScrollbar.rect.isValid()) {
- if (!(scrollbar->activeSubControls & SC_ScrollBarAddPage))
- newScrollbar.state &= ~(State_Sunken | State_MouseOver);
- if (scrollbar->orientation == Qt::Horizontal) {
- QRect r = newScrollbar.rect.adjusted(0, 0, 0, -1);
- }
- else {
- QRect r = newScrollbar.rect.adjusted(0, 0,- 1, 0);
- }
- }
- }
- if (scrollbar->subControls & SC_ScrollBarFirst) {
- newScrollbar.rect = scrollbar->rect;
- newScrollbar.state = saveFlags;
- newScrollbar.rect = subControlRect(control, &newScrollbar, SC_ScrollBarFirst, widget);
- if (newScrollbar.rect.isValid()) {
- if (!(scrollbar->activeSubControls & SC_ScrollBarFirst))
- newScrollbar.state &= ~(State_Sunken | State_MouseOver);
- QRect r = newScrollbar.rect;
- }
- }
- if (scrollbar->subControls & SC_ScrollBarLast) {
- newScrollbar.rect = scrollbar->rect;
- newScrollbar.state = saveFlags;
- newScrollbar.rect = subControlRect(control, &newScrollbar, SC_ScrollBarLast, widget);
- if (newScrollbar.rect.isValid()) {
- if (!(scrollbar->activeSubControls & SC_ScrollBarLast))
- newScrollbar.state &= ~(State_Sunken | State_MouseOver);
- QRect r = newScrollbar.rect;
+ d->drawScrollbarHandleDown(painter, &newScrollbar, drawCompleteFrame, secondScrollBar);
}
}
if (scrollbar->subControls & SC_ScrollBarSlider) {
- newScrollbar.rect = scrollbar->rect;
- newScrollbar.state = saveFlags;
- newScrollbar.rect = subControlRect(control, &newScrollbar, SC_ScrollBarSlider, widget);
- if (newScrollbar.rect.isValid()) {
- if (!(scrollbar->activeSubControls & SC_ScrollBarSlider))
- newScrollbar.state &= ~(State_Sunken | State_MouseOver);
- if (scrollbar->orientation == Qt::Horizontal) {
- painter->fillRect(newScrollbar.rect,option->palette.button());
- QRect r = newScrollbar.rect;
- painter->drawLine(r.topLeft(), r.bottomLeft());
- painter->drawLine(r.topRight(), r.bottomRight());
- if (d->smartphone) {
- painter->drawLine(r.topLeft(), r.topRight());
- painter->drawLine(r.bottomLeft(), r.bottomRight());
- }
- }
- else {
- painter->fillRect(newScrollbar.rect,option->palette.button());
- QRect r = newScrollbar.rect;
- painter->drawLine(r.topLeft(), r.topRight());
- painter->drawLine(r.bottomLeft(), r.bottomRight());
- if (d->smartphone) {
- painter->drawLine(r.topLeft(), r.bottomLeft());
- painter->drawLine(r.topRight(), r.bottomRight());
- }
- }
- if (scrollbar->state & State_HasFocus) {
- QStyleOptionFocusRect fropt;
- fropt.QStyleOption::operator=(newScrollbar);
- fropt.rect.setRect(newScrollbar.rect.x() + 2, newScrollbar.rect.y() + 2,
- newScrollbar.rect.width() - 5,
- newScrollbar.rect.height() - 5);
- }
- }
- }
- int gripMargin = d->doubleControls ? 4 : 2;
- int doubleLines = d->doubleControls ? 2 : 1;
- //If there is a frame around the scrollbar (abstractScrollArea),
- //then the margin is different, because of the missing frame
- int gripMarginFrame = d->doubleControls ? 3 : 1;
- if (drawCompleteFrame)
- gripMarginFrame = 0;
- //draw grips
- if (!d->smartphone)
- if (scrollbar->orientation == Qt::Horizontal) {
- for (int i = -3; i < 3; i += 2) {
- painter->drawLine(
- QPoint(newScrollbar.rect.center().x() + i * doubleLines + 1,
- newScrollbar.rect.top() + gripMargin +gripMarginFrame),
- QPoint(newScrollbar.rect.center().x() + i * doubleLines + 1,
- newScrollbar.rect.bottom() - gripMargin));
- }
- } else {
- for (int i = -2; i < 4 ; i += 2) {
- painter->drawLine(
- QPoint(newScrollbar.rect.left() + gripMargin + gripMarginFrame ,
- newScrollbar.rect.center().y() + 1 + i * doubleLines - 1),
- QPoint(newScrollbar.rect.right() - gripMargin,
- newScrollbar.rect.center().y() + 1 + i * doubleLines - 1));
- }
- }
- if (!d->smartphone) {
- QRect r;
- if (d->doubleControls)
- r = option->rect.adjusted(1, 1, -1, 0);
- else
- r = option->rect.adjusted(0, 0, -1, 0);
- if (drawCompleteFrame && d->doubleControls)
- r.adjust(0, 0, 0, -1);
- //Check if the scrollbar is part of an abstractItemView and draw the frame according
- if (drawCompleteFrame)
- painter->drawRect(r);
- else
- if (scrollbar->orientation == Qt::Horizontal)
- painter->drawLine(r.topLeft(), r.topRight());
- else
- painter->drawLine(r.topLeft(), r.bottomLeft());
+
+ newScrollbar.rect = scrollbar->rect;
+ newScrollbar.state = saveFlags;
+ newScrollbar.rect = proxy()->subControlRect(control, &newScrollbar, SC_ScrollBarSlider, widget);
+
+ if (newScrollbar.rect.isValid()) {
+ if (!(scrollbar->activeSubControls & SC_ScrollBarSlider))
+ newScrollbar.state &= ~(State_Sunken | State_MouseOver);
+ d->drawScrollbarGrip(painter, &newScrollbar, option, drawCompleteFrame);
+ }
}
}
painter->restore();
@@ -2378,8 +6015,8 @@ void QWindowsMobileStyle::drawComplexControl(ComplexControl control, const QStyl
isTabWidget = (qobject_cast<QTabWidget *>(parent->parentWidget()));
#endif //QT_NO_TABWIDGET
- button = subControlRect(control, toolbutton, SC_ToolButton, widget);
- menuarea = subControlRect(control, toolbutton, SC_ToolButtonMenu, widget);
+ button = proxy()->subControlRect(control, toolbutton, SC_ToolButton, widget);
+ menuarea = proxy()->subControlRect(control, toolbutton, SC_ToolButtonMenu, widget);
State buttonFlags = toolbutton->state;
if (buttonFlags & State_AutoRaise) {
if (!(buttonFlags & State_MouseOver)) {
@@ -2396,7 +6033,7 @@ void QWindowsMobileStyle::drawComplexControl(ComplexControl control, const QStyl
if (toolbutton->subControls & SC_ToolButton) {
tool.rect = button;
tool.state = buttonFlags;
- drawPrimitive(PE_PanelButtonTool, &tool, painter, widget);
+ proxy()->drawPrimitive(PE_PanelButtonTool, &tool, painter, widget);
}
if (toolbutton->subControls & SC_ToolButtonMenu) {
tool.rect = menuarea;
@@ -2405,7 +6042,7 @@ void QWindowsMobileStyle::drawComplexControl(ComplexControl control, const QStyl
toolMenu = *toolbutton;
toolMenu.state = menuFlags;
if (buttonFlags & State_Sunken)
- drawPrimitive(PE_PanelButtonTool, &toolMenu, painter, widget);
+ proxy()->drawPrimitive(PE_PanelButtonTool, &toolMenu, painter, widget);
QStyleOption arrowOpt(0);
arrowOpt.rect = tool.rect;
arrowOpt.palette = tool.palette;
@@ -2417,25 +6054,25 @@ void QWindowsMobileStyle::drawComplexControl(ComplexControl control, const QStyl
painter->fillRect(menuarea, option->palette.shadow());
}
arrowOpt.state = flags;
- drawPrimitive(PE_IndicatorArrowDown, &arrowOpt, painter, widget);
+ proxy()->drawPrimitive(PE_IndicatorArrowDown, &arrowOpt, painter, widget);
}
if (toolbutton->state & State_HasFocus) {
QStyleOptionFocusRect focusRect;
focusRect.QStyleOption::operator=(*toolbutton);
focusRect.rect.adjust(3, 3, -3, -3);
if (toolbutton->features & QStyleOptionToolButton::Menu)
- focusRect.rect.adjust(0, 0, -pixelMetric(QStyle::PM_MenuButtonIndicator,
+ focusRect.rect.adjust(0, 0, -proxy()->pixelMetric(QStyle::PM_MenuButtonIndicator,
toolbutton, widget), 0);
- drawPrimitive(PE_FrameFocusRect, &focusRect, painter, widget);
+ proxy()->drawPrimitive(PE_FrameFocusRect, &focusRect, painter, widget);
}
QStyleOptionToolButton label = *toolbutton;
if (isTabWidget)
label.state = toolbutton->state;
else
label.state = toolbutton->state & State_Enabled;
- int fw = pixelMetric(PM_DefaultFrameWidth, option, widget);
+ int fw = proxy()->pixelMetric(PM_DefaultFrameWidth, option, widget);
label.rect = button.adjusted(fw, fw, -fw, -fw);
- drawControl(CE_ToolButtonLabel, &label, painter, widget);
+ proxy()->drawControl(CE_ToolButtonLabel, &label, painter, widget);
}
break;
@@ -2449,15 +6086,15 @@ void QWindowsMobileStyle::drawComplexControl(ComplexControl control, const QStyl
painter->setFont(font);
QStyleOptionGroupBox groupBoxFont = *groupBox;
groupBoxFont.fontMetrics = QFontMetrics(font);
- QRect textRect = subControlRect(CC_GroupBox, &groupBoxFont, SC_GroupBoxLabel, widget);
- QRect checkBoxRect = subControlRect(CC_GroupBox, option, SC_GroupBoxCheckBox, widget).adjusted(0,0,0,0);
+ QRect textRect = proxy()->subControlRect(CC_GroupBox, &groupBoxFont, SC_GroupBoxLabel, widget);
+ QRect checkBoxRect = proxy()->subControlRect(CC_GroupBox, option, SC_GroupBoxCheckBox, widget).adjusted(0,0,0,0);
if (groupBox->subControls & QStyle::SC_GroupBoxFrame) {
QStyleOptionFrameV2 frame;
frame.QStyleOption::operator=(*groupBox);
frame.features = groupBox->features;
frame.lineWidth = groupBox->lineWidth;
frame.midLineWidth = groupBox->midLineWidth;
- frame.rect = subControlRect(CC_GroupBox, option, SC_GroupBoxFrame, widget);
+ frame.rect = proxy()->subControlRect(CC_GroupBox, option, SC_GroupBoxFrame, widget);
painter->save();
QRegion region(groupBox->rect);
if (!groupBox->text.isEmpty()) {
@@ -2467,7 +6104,7 @@ void QWindowsMobileStyle::drawComplexControl(ComplexControl control, const QStyl
finalRect.adjust(ltr ? -4 : 0, 0, ltr ? 0 : 4, 0);
region -= finalRect;
}
- drawPrimitive(PE_FrameGroupBox, &frame, painter, widget);
+ proxy()->drawPrimitive(PE_FrameGroupBox, &frame, painter, widget);
painter->restore();
}
// Draw checkbox
@@ -2475,7 +6112,7 @@ void QWindowsMobileStyle::drawComplexControl(ComplexControl control, const QStyl
QStyleOptionButton box;
box.QStyleOption::operator=(*groupBox);
box.rect = checkBoxRect;
- drawPrimitive(PE_IndicatorCheckBox, &box, painter, widget);
+ proxy()->drawPrimitive(PE_IndicatorCheckBox, &box, painter, widget);
}
// Draw title
if ((groupBox->subControls & QStyle::SC_GroupBoxLabel) && !groupBox->text.isEmpty()) {
@@ -2491,17 +6128,17 @@ void QWindowsMobileStyle::drawComplexControl(ComplexControl control, const QStyl
alignment |= Qt::TextHideMnemonic;
if (groupBox->state & State_Enabled)
- drawItemText(painter, textRect, Qt::TextShowMnemonic | Qt::AlignHCenter | alignment,
+ proxy()->drawItemText(painter, textRect, Qt::TextShowMnemonic | Qt::AlignHCenter | alignment,
groupBox->palette, true, groupBox->text,
textColor.isValid() ? QPalette::NoRole : QPalette::Link);
else
- drawItemText(painter, textRect, Qt::TextShowMnemonic | Qt::AlignHCenter | alignment,
+ proxy()->drawItemText(painter, textRect, Qt::TextShowMnemonic | Qt::AlignHCenter | alignment,
groupBox->palette, true, groupBox->text, QPalette::Mid);
if (groupBox->state & State_HasFocus) {
QStyleOptionFocusRect fropt;
fropt.QStyleOption::operator=(*groupBox);
fropt.rect = textRect;
- drawPrimitive(PE_FrameFocusRect, &fropt, painter, widget);
+ proxy()->drawPrimitive(PE_FrameFocusRect, &fropt, painter, widget);
}
}
painter->restore();
@@ -2514,11 +6151,11 @@ void QWindowsMobileStyle::drawComplexControl(ComplexControl control, const QStyl
if (const QStyleOptionComboBox *cmb = qstyleoption_cast<const QStyleOptionComboBox *>(option)) {
QBrush editBrush = cmb->palette.brush(QPalette::Base);
if ((cmb->subControls & SC_ComboBoxFrame) && cmb->frame)
- qDrawPlainRect(painter, option->rect, option->palette.shadow().color(), pixelMetric(PM_ComboBoxFrameWidth, option, widget), &editBrush);
+ qDrawPlainRect(painter, option->rect, option->palette.shadow().color(), proxy()->pixelMetric(PM_ComboBoxFrameWidth, option, widget), &editBrush);
else
painter->fillRect(option->rect, editBrush);
State flags = State_None;
- QRect ar = subControlRect(CC_ComboBox, cmb, SC_ComboBoxArrow, widget);
+ QRect ar = proxy()->subControlRect(CC_ComboBox, cmb, SC_ComboBoxArrow, widget);
if ((option->state & State_On)) {
painter->fillRect(ar.adjusted(0, 0, 1, 1),cmb->palette.brush(QPalette::Shadow));
}
@@ -2534,9 +6171,9 @@ void QWindowsMobileStyle::drawComplexControl(ComplexControl control, const QStyl
arrowOpt.rect = ar;
arrowOpt.palette = cmb->palette;
arrowOpt.state = flags;
- drawPrimitive(PrimitiveElement(PE_IndicatorArrowDownBig), &arrowOpt, painter, widget);
+ proxy()->drawPrimitive(PrimitiveElement(PE_IndicatorArrowDownBig), &arrowOpt, painter, widget);
if (cmb->subControls & SC_ComboBoxEditField) {
- QRect re = subControlRect(CC_ComboBox, cmb, SC_ComboBoxEditField, widget);
+ QRect re = proxy()->subControlRect(CC_ComboBox, cmb, SC_ComboBoxEditField, widget);
if (cmb->state & State_HasFocus && !cmb->editable)
painter->fillRect(re.x(), re.y(), re.width(), re.height(),
cmb->palette.brush(QPalette::Highlight));
@@ -2550,11 +6187,11 @@ void QWindowsMobileStyle::drawComplexControl(ComplexControl control, const QStyl
if (cmb->state & State_HasFocus && !cmb->editable) {
QStyleOptionFocusRect focus;
focus.QStyleOption::operator=(*cmb);
- focus.rect = subElementRect(SE_ComboBoxFocusRect, cmb, widget);
+ focus.rect = proxy()->subElementRect(SE_ComboBoxFocusRect, cmb, widget);
focus.state |= State_FocusAtBorder;
focus.backgroundColor = cmb->palette.highlight().color();
if ((option->state & State_On))
- drawPrimitive(PE_FrameFocusRect, &focus, painter, widget);
+ proxy()->drawPrimitive(PE_FrameFocusRect, &focus, painter, widget);
}
}
}
@@ -2570,8 +6207,8 @@ void QWindowsMobileStyle::drawComplexControl(ComplexControl control, const QStyl
int primitiveElement;
if (spinBox->frame && (spinBox->subControls & SC_SpinBoxFrame)) {
- QRect r = subControlRect(CC_SpinBox, spinBox, SC_SpinBoxFrame, widget);
- qDrawPlainRect(painter, r, option->palette.shadow().color(),pixelMetric(PM_SpinBoxFrameWidth, option, widget),0);
+ QRect r = proxy()->subControlRect(CC_SpinBox, spinBox, SC_SpinBoxFrame, widget);
+ qDrawPlainRect(painter, r, option->palette.shadow().color(), proxy()->pixelMetric(PM_SpinBoxFrameWidth, option, widget),0);
}
QPalette shadePal(option->palette);
shadePal.setColor(QPalette::Button, option->palette.light().color());
@@ -2593,13 +6230,13 @@ void QWindowsMobileStyle::drawComplexControl(ComplexControl control, const QStyl
}
primitiveElement = (spinBox->buttonSymbols == QAbstractSpinBox::PlusMinus ? PE_IndicatorArrowUpBig
: PE_IndicatorArrowUpBig);
- copy.rect = subControlRect(CC_SpinBox, spinBox, SC_SpinBoxUp, widget);
+ copy.rect = proxy()->subControlRect(CC_SpinBox, spinBox, SC_SpinBoxUp, widget);
if (copy.state & (State_Sunken | State_On))
- qDrawPlainRect(painter, copy.rect, option->palette.shadow().color(),pixelMetric(PM_SpinBoxFrameWidth, option, widget), &copy.palette.brush(QPalette::Shadow));
+ qDrawPlainRect(painter, copy.rect, option->palette.shadow().color(), proxy()->pixelMetric(PM_SpinBoxFrameWidth, option, widget), &copy.palette.brush(QPalette::Shadow));
else
- qDrawPlainRect(painter, copy.rect, option->palette.shadow().color(),pixelMetric(PM_SpinBoxFrameWidth, option, widget), &copy.palette.brush(QPalette::Base));
- copy.rect.adjust(pixelMetric(PM_SpinBoxFrameWidth, option, widget), 0, -pixelMetric(PM_SpinBoxFrameWidth, option, widget), 0);
- drawPrimitive(PrimitiveElement(primitiveElement), &copy, painter, widget);
+ qDrawPlainRect(painter, copy.rect, option->palette.shadow().color(), proxy()->pixelMetric(PM_SpinBoxFrameWidth, option, widget), &copy.palette.brush(QPalette::Base));
+ copy.rect.adjust(proxy()->pixelMetric(PM_SpinBoxFrameWidth, option, widget), 0, -pixelMetric(PM_SpinBoxFrameWidth, option, widget), 0);
+ proxy()->drawPrimitive(PrimitiveElement(primitiveElement), &copy, painter, widget);
}
if (spinBox->subControls & SC_SpinBoxDown) {
copy.subControls = SC_SpinBoxDown;
@@ -2619,23 +6256,23 @@ void QWindowsMobileStyle::drawComplexControl(ComplexControl control, const QStyl
}
primitiveElement = (spinBox->buttonSymbols == QAbstractSpinBox::PlusMinus ? PE_IndicatorArrowDownBig
: PE_IndicatorArrowDownBig);
- copy.rect = subControlRect(CC_SpinBox, spinBox, SC_SpinBoxDown, widget);
- qDrawPlainRect(painter, copy.rect, option->palette.shadow().color(),pixelMetric(PM_SpinBoxFrameWidth, option, widget), &copy.palette.brush(QPalette::Base));
+ copy.rect = proxy()->subControlRect(CC_SpinBox, spinBox, SC_SpinBoxDown, widget);
+ qDrawPlainRect(painter, copy.rect, option->palette.shadow().color(), proxy()->pixelMetric(PM_SpinBoxFrameWidth, option, widget), &copy.palette.brush(QPalette::Base));
if (copy.state & (State_Sunken | State_On))
- qDrawPlainRect(painter, copy.rect, option->palette.shadow().color(),pixelMetric(PM_SpinBoxFrameWidth, option, widget), &copy.palette.brush(QPalette::Shadow));
+ qDrawPlainRect(painter, copy.rect, option->palette.shadow().color(), proxy()->pixelMetric(PM_SpinBoxFrameWidth, option, widget), &copy.palette.brush(QPalette::Shadow));
else
- qDrawPlainRect(painter, copy.rect, option->palette.shadow().color(),pixelMetric(PM_SpinBoxFrameWidth, option, widget), &copy.palette.brush(QPalette::Base));
+ qDrawPlainRect(painter, copy.rect, option->palette.shadow().color(), proxy()->pixelMetric(PM_SpinBoxFrameWidth, option, widget), &copy.palette.brush(QPalette::Base));
copy.rect.adjust(3, 0, -4, 0);
if (primitiveElement == PE_IndicatorArrowUp || primitiveElement == PE_IndicatorArrowDown) {
- int frameWidth = pixelMetric(PM_SpinBoxFrameWidth, option, widget);
+ int frameWidth = proxy()->pixelMetric(PM_SpinBoxFrameWidth, option, widget);
copy.rect = copy.rect.adjusted(frameWidth, frameWidth, -frameWidth, -frameWidth);
- drawPrimitive(PrimitiveElement(primitiveElement), &copy, painter, widget);
+ proxy()->drawPrimitive(PrimitiveElement(primitiveElement), &copy, painter, widget);
}
else {
- drawPrimitive(PrimitiveElement(primitiveElement), &copy, painter, widget);
+ proxy()->drawPrimitive(PrimitiveElement(primitiveElement), &copy, painter, widget);
}
if (spinBox->frame && (spinBox->subControls & SC_SpinBoxFrame)) {
- QRect r = subControlRect(CC_SpinBox, spinBox, SC_SpinBoxEditField, widget);
+ QRect r = proxy()->subControlRect(CC_SpinBox, spinBox, SC_SpinBoxEditField, widget);
}
}
}
@@ -2660,7 +6297,7 @@ QSize QWindowsMobileStyle::sizeFromContents(ContentsType type, const QStyleOptio
h = newSize.height();
int defwidth = 0;
if (button->features & QStyleOptionButton::AutoDefaultButton)
- defwidth = 2 * pixelMetric(PM_ButtonDefaultIndicator, button, widget);
+ defwidth = 2 * proxy()->pixelMetric(PM_ButtonDefaultIndicator, button, widget);
if (w < 75 + defwidth && button->icon.isNull())
w = 75 + defwidth;
if (h < 23 + defwidth)
@@ -2683,9 +6320,9 @@ QSize QWindowsMobileStyle::sizeFromContents(ContentsType type, const QStyleOptio
if (const QStyleOptionButton *button = qstyleoption_cast<const QStyleOptionButton *>(option)) {
bool isRadio = (type == CT_RadioButton);
QRect irect = visualRect(button->direction, button->rect,
- subElementRect(isRadio ? SE_RadioButtonIndicator
+ proxy()->subElementRect(isRadio ? SE_RadioButtonIndicator
: SE_CheckBoxIndicator, button, widget));
- int h = pixelMetric(isRadio ? PM_ExclusiveIndicatorHeight
+ int h = proxy()->pixelMetric(isRadio ? PM_ExclusiveIndicatorHeight
: PM_IndicatorHeight, button, widget);
int margins = (!button->icon.isNull() && button->text.isEmpty()) ? 0 : 10;
if (d_func()->doubleControls)
@@ -2697,7 +6334,7 @@ QSize QWindowsMobileStyle::sizeFromContents(ContentsType type, const QStyleOptio
#ifndef QT_NO_COMBOBOX
case CT_ComboBox:
if (const QStyleOptionComboBox *comboBox = qstyleoption_cast<const QStyleOptionComboBox *>(option)) {
- int fw = comboBox->frame ? pixelMetric(PM_ComboBoxFrameWidth, option, widget) * 2 : 0;
+ int fw = comboBox->frame ? proxy()->pixelMetric(PM_ComboBoxFrameWidth, option, widget) * 2 : 0;
newSize = QSize(newSize.width() + fw + 9, newSize.height() + fw-4); //Nine is a magic Number - See CommonStyle for real magic (23)
}
break;
@@ -2705,7 +6342,7 @@ QSize QWindowsMobileStyle::sizeFromContents(ContentsType type, const QStyleOptio
#ifndef QT_NO_SPINBOX
case CT_SpinBox:
if (const QStyleOptionSpinBox *spinBox = qstyleoption_cast<const QStyleOptionSpinBox *>(option)) {
- int fw = spinBox->frame ? pixelMetric(PM_SpinBoxFrameWidth, option, widget) * 2 : 0;
+ int fw = spinBox->frame ? proxy()->pixelMetric(PM_SpinBoxFrameWidth, option, widget) * 2 : 0;
newSize = QSize(newSize.width() + fw-5, newSize.height() + fw-6);
}
break;
@@ -2719,11 +6356,25 @@ QSize QWindowsMobileStyle::sizeFromContents(ContentsType type, const QStyleOptio
newSize = QSize(newSize.width() + 1, newSize.height());
break;
case CT_TabBarTab:
- newSize += QSize(0,0);
+ if (d_func()->doubleControls)
+ newSize = QSize(newSize.width(), 42);
+ else
+ newSize = QSize(newSize.width(), 21);
break;
case CT_HeaderSection:
newSize += QSize(4, 2);
break;
+#ifndef QT_NO_ITEMVIEWS
+#ifdef Q_WS_WINCE_WM
+ case CT_ItemViewItem:
+ if (d_func()->wm65)
+ if (d_func()->doubleControls)
+ newSize.setHeight(46);
+ else
+ newSize.setHeight(23);
+ break;
+#endif //Q_WS_WINCE_WM
+#endif //QT_NO_ITEMVIEWS
default:
break;
}
@@ -2751,7 +6402,7 @@ QRect QWindowsMobileStyle::subElementRect(SubElement element, const QStyleOption
break;
default:
break;
- #ifndef QT_NO_SLIDER
+#ifndef QT_NO_SLIDER
case SE_SliderFocusRect:
if (const QStyleOptionSlider *slider = qstyleoption_cast<const QStyleOptionSlider *>(option)) {
rect = slider->rect;
@@ -2762,6 +6413,14 @@ QRect QWindowsMobileStyle::subElementRect(SubElement element, const QStyleOption
rect.adjust(-1, -1, 0, 0);
break;
#endif // QT_NO_SLIDER
+#ifndef QT_NO_ITEMVIEWS
+ case SE_ItemViewItemFocusRect:
+#ifdef Q_WS_WINCE_WM
+ if (d->wm65)
+ rect = QRect();
+#endif
+ break;
+#endif //QT_NO_ITEMVIEWS
}
return rect;
}
@@ -2777,10 +6436,19 @@ QRect QWindowsMobileStyle::subControlRect(ComplexControl control, const QStyleOp
#ifndef QT_NO_SCROLLBAR
case CC_ScrollBar:
if (const QStyleOptionSlider *scrollbar = qstyleoption_cast<const QStyleOptionSlider *>(option)) {
- int sliderButtonExtent = pixelMetric(PM_ScrollBarExtent, scrollbar, widget);
- int sliderlen;
+ int sliderButtonExtent = proxy()->pixelMetric(PM_ScrollBarExtent, scrollbar, widget);
float stretchFactor = 1.4f;
int sliderButtonExtentDir = int (sliderButtonExtent * stretchFactor);
+
+#ifdef Q_WS_WINCE_WM
+ if (d->wm65)
+ {
+ sliderButtonExtent = d->imageScrollbarHandleUp.width();
+ sliderButtonExtentDir = d->imageScrollbarHandleUp.height();
+ }
+#endif //Q_WS_WINCE_WM
+
+ int sliderlen;
int maxlen = ((scrollbar->orientation == Qt::Horizontal) ?
scrollbar->rect.width() : scrollbar->rect.height()) - (sliderButtonExtentDir * 2);
// calculate slider length
@@ -2788,7 +6456,7 @@ QRect QWindowsMobileStyle::subControlRect(ComplexControl control, const QStyleOp
uint range = scrollbar->maximum - scrollbar->minimum;
sliderlen = (qint64(scrollbar->pageStep) * maxlen) / (range + scrollbar->pageStep);
- int slidermin = pixelMetric(PM_ScrollBarSliderMin, scrollbar, widget);
+ int slidermin = proxy()->pixelMetric(PM_ScrollBarSliderMin, scrollbar, widget);
if (sliderlen < slidermin || range > INT_MAX / 2)
sliderlen = slidermin;
if (sliderlen > maxlen)
@@ -2883,7 +6551,7 @@ QRect QWindowsMobileStyle::subControlRect(ComplexControl control, const QStyleOp
#ifndef QT_NO_TOOLBUTTON
case CC_ToolButton:
if (const QStyleOptionToolButton *toolButton = qstyleoption_cast<const QStyleOptionToolButton *>(option)) {
- int mbi = pixelMetric(PM_MenuButtonIndicator, toolButton, widget);
+ int mbi = proxy()->pixelMetric(PM_MenuButtonIndicator, toolButton, widget);
rect = toolButton->rect;
switch (subControl) {
case SC_ToolButton:
@@ -2909,12 +6577,12 @@ QRect QWindowsMobileStyle::subControlRect(ComplexControl control, const QStyleOp
#ifndef QT_NO_SLIDER
case CC_Slider:
if (const QStyleOptionSlider *slider = qstyleoption_cast<const QStyleOptionSlider *>(option)) {
- int tickOffset = pixelMetric(PM_SliderTickmarkOffset, slider, widget);
- int thickness = pixelMetric(PM_SliderControlThickness, slider, widget);
+ int tickOffset = proxy()->pixelMetric(PM_SliderTickmarkOffset, slider, widget);
+ int thickness = proxy()->pixelMetric(PM_SliderControlThickness, slider, widget);
switch (subControl) {
case SC_SliderHandle: {
int sliderPos = 0;
- int len = pixelMetric(PM_SliderLength, slider, widget);
+ int len = proxy()->pixelMetric(PM_SliderLength, slider, widget);
bool horizontal = slider->orientation == Qt::Horizontal;
sliderPos = sliderPositionFromValue(slider->minimum, slider->maximum,
slider->sliderPosition,
@@ -2967,7 +6635,7 @@ QRect QWindowsMobileStyle::subControlRect(ComplexControl control, const QStyleOp
case CC_SpinBox:
if (const QStyleOptionSpinBox *spinBox = qstyleoption_cast<const QStyleOptionSpinBox *>(option)) {
QSize bs;
- int fw = spinBox->frame ? pixelMetric(PM_SpinBoxFrameWidth, spinBox, widget) : 0;
+ int fw = spinBox->frame ? proxy()->pixelMetric(PM_SpinBoxFrameWidth, spinBox, widget) : 0;
bs.setHeight(qMax(d->doubleControls ? 28 : 14, (spinBox->rect.height())));
// 1.6 -approximate golden mean
bs.setWidth(qMax(d->doubleControls ? 28 : 14, qMin((bs.height()*7/8), (spinBox->rect.width() / 8))));
@@ -2978,7 +6646,7 @@ QRect QWindowsMobileStyle::subControlRect(ComplexControl control, const QStyleOp
rx = x - fw;
switch (subControl) {
case SC_SpinBoxUp:
- rect = QRect(x+pixelMetric(PM_SpinBoxFrameWidth, option, widget), 0 , bs.width(), bs.height());
+ rect = QRect(x + proxy()->pixelMetric(PM_SpinBoxFrameWidth, option, widget), 0 , bs.width(), bs.height());
break;
case SC_SpinBoxDown:
rect = QRect(x + bs.width(), 0, bs.width(), bs.height());
@@ -3028,7 +6696,7 @@ QRect QWindowsMobileStyle::subControlRect(ComplexControl control, const QStyleOp
}
int frameWidth = 0;
if (groupBox->text.size()) {
- frameWidth = pixelMetric(PM_DefaultFrameWidth, groupBox, widget);
+ frameWidth = proxy()->pixelMetric(PM_DefaultFrameWidth, groupBox, widget);
rect = frameRect.adjusted(frameWidth, frameWidth + topHeight + labelMargin, -frameWidth, -frameWidth);
}
else {
@@ -3049,8 +6717,8 @@ QRect QWindowsMobileStyle::subControlRect(ComplexControl control, const QStyleOp
rect.setHeight(h);
else
rect.setHeight(0);
- int indicatorWidth = pixelMetric(PM_IndicatorWidth, option, widget);
- int indicatorSpace = pixelMetric(PM_CheckBoxLabelSpacing, option, widget) - 1;
+ int indicatorWidth = proxy()->pixelMetric(PM_IndicatorWidth, option, widget);
+ int indicatorSpace = proxy()->pixelMetric(PM_CheckBoxLabelSpacing, option, widget) - 1;
bool hasCheckBox = groupBox->subControls & QStyle::SC_GroupBoxCheckBox;
int checkBoxSize = hasCheckBox ? (indicatorWidth + indicatorSpace) : 0;
@@ -3064,7 +6732,7 @@ QRect QWindowsMobileStyle::subControlRect(ComplexControl control, const QStyleOp
int left = 2;
// Adjust for check box
if (subControl == SC_GroupBoxCheckBox) {
- int indicatorHeight = pixelMetric(PM_IndicatorHeight, option, widget);
+ int indicatorHeight = proxy()->pixelMetric(PM_IndicatorHeight, option, widget);
left = ltr ? totalRect.left() : (totalRect.right() - indicatorWidth);
int top = totalRect.top() + (fontMetrics.height() - indicatorHeight) / 2;
totalRect.setRect(left, top, indicatorWidth, indicatorHeight);
@@ -3260,7 +6928,6 @@ int QWindowsMobileStyle::pixelMetric(PixelMetric pm, const QStyleOption *opt, co
case PM_RadioButtonLabelSpacing:
ret = d->doubleControls ? 6 * 2 : 6;
break;
- break;
// Returns the number of pixels to use for the business part of the
// slider (i.e., the non-tickmark portion). The remaining space is shared
// equally between the tickmark regions.
@@ -3279,7 +6946,7 @@ int QWindowsMobileStyle::pixelMetric(PixelMetric pm, const QStyleOption *opt, co
}
int thick = 8;
if (ticks != QSlider::TicksBothSides && ticks != QSlider::NoTicks)
- thick += pixelMetric(PM_SliderLength, sl, widget) / 4;
+ thick += proxy()->pixelMetric(PM_SliderLength, sl, widget) / 4;
space -= thick;
if (space > 0)
@@ -3301,7 +6968,7 @@ int QWindowsMobileStyle::pixelMetric(PixelMetric pm, const QStyleOption *opt, co
d->doubleControls ? ret = 64 : ret = 32;
break;
case PM_IconViewIconSize:
- ret = pixelMetric(PM_LargeIconSize, opt, widget);
+ ret = proxy()->pixelMetric(PM_LargeIconSize, opt, widget);
break;
case PM_ToolBarIconSize:
d->doubleControls ? ret = 2 * windowsMobileIconSize : ret = windowsMobileIconSize;
@@ -3322,15 +6989,36 @@ int QWindowsMobileStyle::pixelMetric(PixelMetric pm, const QStyleOption *opt, co
d->doubleControls ? ret = 42 : ret = 21;
break;
case PM_ScrollBarSliderMin:
- d->doubleControls ? ret = 36 : ret = 18;
+#ifdef Q_WS_WINCE_WM
+ if (d->wm65)
+#else
+ if (false)
+#endif
+ {
+ d->doubleControls ? ret = 68 : ret = 34;
+ } else {
+ d->doubleControls ? ret = 36 : ret = 18;
+ }
break;
case PM_ScrollBarExtent: {
- //Check if the scrollbar is part of an abstractItemView and set size according
+
if (d->smartphone)
ret = 9;
else
d->doubleControls ? ret = 25 : ret = 13;
+
+#ifdef Q_WS_WINCE_WM
+ if (d->wm65)
+#else
+ if (false)
+#endif
+ {
+ d->doubleControls ? ret = 26 : ret = 13;
+ break;
+ }
+
#ifndef QT_NO_SCROLLAREA
+ //Check if the scrollbar is part of an abstractItemView and set size according
if (widget)
if (QWidget *parent = widget->parentWidget())
if (qobject_cast<QAbstractScrollArea *>(parent->parentWidget()))
@@ -3408,6 +7096,9 @@ int QWindowsMobileStyle::styleHint(StyleHint hint, const QStyleOption *opt, cons
case SH_MenuBar_AltKeyNavigation:
ret = false;
break;
+ case SH_RequestSoftwareInputPanel:
+ ret = RSIP_OnMouseClick;
+ break;
default:
ret = QWindowsStyle::styleHint(hint, opt, widget, returnData);
break;
@@ -3470,6 +7161,10 @@ QPixmap QWindowsMobileStyle::generatedIconPixmap(QIcon::Mode iconMode, const QPi
switch (iconMode) {
case QIcon::Selected: {
+#ifdef Q_WS_WINCE_WM
+ if (d_func()->wm65)
+ return pixmap;
+#endif //Q_WS_WINCE_WM
QImage img = pixmap.toImage().convertToFormat(QImage::Format_ARGB32);
int imgh = img.height();
int imgw = img.width();
diff --git a/src/gui/styles/qwindowsmobilestyle.h b/src/gui/styles/qwindowsmobilestyle.h
index 99baf1b..135d3e9 100644
--- a/src/gui/styles/qwindowsmobilestyle.h
+++ b/src/gui/styles/qwindowsmobilestyle.h
@@ -1,7 +1,6 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the QtGui module of the Qt Toolkit.
@@ -21,9 +20,10 @@
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.1, included in the file LGPL_EXCEPTION.txt in this
+** package.
**
** If you have questions regarding the use of this file, please contact
** Nokia at qt-info@nokia.com.
diff --git a/src/gui/styles/qwindowsmobilestyle_p.h b/src/gui/styles/qwindowsmobilestyle_p.h
index bde8a9b..f643937 100644
--- a/src/gui/styles/qwindowsmobilestyle_p.h
+++ b/src/gui/styles/qwindowsmobilestyle_p.h
@@ -1,7 +1,6 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the QtGui module of the Qt Toolkit.
@@ -21,9 +20,10 @@
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.1, included in the file LGPL_EXCEPTION.txt in this
+** package.
**
** If you have questions regarding the use of this file, please contact
** Nokia at qt-info@nokia.com.
@@ -67,6 +67,9 @@ public:
QWindowsMobileStylePrivate();
bool doubleControls;
bool smartphone;
+#ifdef Q_WS_WINCE_WM
+ bool wm65;
+#endif
QImage imageRadioButton;
QImage imageRadioButtonChecked;
@@ -85,6 +88,42 @@ public:
QImage imageMaximize;
QImage imageNormalize;
QImage imageMinimize;
+
+ void setupWindowsMobileStyle65();
+
+#ifdef Q_WS_WINCE_WM
+ //Windows Mobile 6.5 images
+ QImage imageScrollbarHandleUp;
+ QImage imageScrollbarHandleDown;
+ QImage imageScrollbarHandleUpHigh;
+ QImage imageScrollbarHandleDownHigh;
+ QImage imageScrollbarGripUp;
+ QImage imageScrollbarGripDown;
+ QImage imageScrollbarGripMiddle;
+ QImage imageListViewHighlightCornerLeft;
+ QImage imageListViewHighlightCornerRight;
+ QImage imageListViewHighlightMiddle;
+ QImage imageTabEnd;
+ QImage imageTabSelectedEnd;
+ QImage imageTabSelectedBegin;
+ QImage imageTabMiddle;
+
+ QColor currentTintHigh;
+ QColor currentTintButton;
+
+ void tintImagesHigh(QColor color);
+ void tintImagesButton(QColor color);
+ void tintListViewHighlight(QColor color);
+
+#endif //Q_WS_WINCE_WM
+
+ void drawScrollbarHandleUp(QPainter *p, QStyleOptionSlider *opt, bool completeFrame = false, bool secondScrollBar = false);
+ void drawScrollbarHandleDown(QPainter *p, QStyleOptionSlider *opt, bool completeFrame = false, bool secondScrollBar = false);
+ void drawScrollbarGroove(QPainter *p, const QStyleOptionSlider *opt);
+ void drawScrollbarGrip(QPainter *p, QStyleOptionSlider *newScrollbar, const QStyleOptionComplex *option, bool drawCompleteFrame);
+ void drawTabBarTab(QPainter *p, const QStyleOptionTab *tab);
+ void drawPanelItemViewSelected(QPainter *painter, const QStyleOptionViewItemV4 *option, QRect rect = QRect());
+
};
QT_END_NAMESPACE
diff --git a/src/gui/styles/qwindowsstyle.cpp b/src/gui/styles/qwindowsstyle.cpp
index 4654b1f..2a88578 100644
--- a/src/gui/styles/qwindowsstyle.cpp
+++ b/src/gui/styles/qwindowsstyle.cpp
@@ -1,7 +1,6 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the QtGui module of the Qt Toolkit.
@@ -21,9 +20,10 @@
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.1, included in the file LGPL_EXCEPTION.txt in this
+** package.
**
** If you have questions regarding the use of this file, please contact
** Nokia at qt-info@nokia.com.
@@ -42,6 +42,7 @@
#include "qwindowsstyle.h"
#include "qwindowsstyle_p.h"
#include <private/qpixmapdata_p.h>
+#include <private/qstylehelper_p.h>
#if !defined(QT_NO_STYLE_WINDOWS) || defined(QT_PLUGIN)
@@ -67,6 +68,9 @@
#include "qpixmapcache.h"
#include "qwizard.h"
#include "qlistview.h"
+#include <private/qmath_p.h>
+#include <qmath.h>
+
#ifdef Q_WS_X11
#include "qfileinfo.h"
@@ -117,13 +121,9 @@ static const int windowsSepHeight = 9; // separator item height
static const int windowsItemHMargin = 3; // menu item hor text margin
static const int windowsItemVMargin = 2; // menu item ver text margin
static const int windowsArrowHMargin = 6; // arrow horizontal margin
-static const int windowsTabSpacing = 12; // space between text and tab
-static const int windowsCheckMarkHMargin = 2; // horiz. margins of check mark
static const int windowsRightBorder = 15; // right border on windows
static const int windowsCheckMarkWidth = 12; // checkmarks width on windows
-static bool use2000style = true;
-
enum QSliderDirection { SlUp, SlDown, SlLeft, SlRight };
/*
@@ -265,9 +265,6 @@ bool QWindowsStyle::eventFilter(QObject *o, QEvent *e)
*/
QWindowsStyle::QWindowsStyle() : QCommonStyle(*new QWindowsStylePrivate)
{
-#if defined(Q_OS_WIN32)
- use2000style = QSysInfo::WindowsVersion != QSysInfo::WV_NT && QSysInfo::WindowsVersion != QSysInfo::WV_95;
-#endif
}
/*!
@@ -277,9 +274,6 @@ QWindowsStyle::QWindowsStyle() : QCommonStyle(*new QWindowsStylePrivate)
*/
QWindowsStyle::QWindowsStyle(QWindowsStylePrivate &dd) : QCommonStyle(dd)
{
-#if defined(Q_OS_WIN32)
- use2000style = QSysInfo::WindowsVersion != QSysInfo::WV_NT && QSysInfo::WindowsVersion != QSysInfo::WV_95;
-#endif
}
@@ -301,7 +295,7 @@ void QWindowsStyle::polish(QApplication *app)
QCommonStyle::polish(app);
QWindowsStylePrivate *d = const_cast<QWindowsStylePrivate*>(d_func());
// We only need the overhead when shortcuts are sometimes hidden
- if (!styleHint(SH_UnderlineShortcut, 0) && app)
+ if (!proxy()->styleHint(SH_UnderlineShortcut, 0) && app)
app->installEventFilter(this);
d->activeCaptionColor = app->palette().highlight().color();
@@ -402,7 +396,7 @@ int QWindowsStyle::pixelMetric(PixelMetric pm, const QStyleOption *opt, const QW
#ifndef QT_NO_SLIDER
case PM_SliderLength:
- ret = 11;
+ ret = int(QStyleHelper::dpiScaled(11.));
break;
// Returns the number of pixels to use for the business part of the
@@ -424,7 +418,7 @@ int QWindowsStyle::pixelMetric(PixelMetric pm, const QStyleOption *opt, const QW
int thick = 6; // Magic constant to get 5 + 16 + 5
if (ticks != QSlider::TicksBothSides && ticks != QSlider::NoTicks)
- thick += pixelMetric(PM_SliderLength, sl, widget) / 4;
+ thick += proxy()->pixelMetric(PM_SliderLength, sl, widget) / 4;
space -= thick;
if (space > 0)
@@ -450,25 +444,25 @@ int QWindowsStyle::pixelMetric(PixelMetric pm, const QStyleOption *opt, const QW
break;
case PM_SmallIconSize:
- ret = 16;
+ ret = int(QStyleHelper::dpiScaled(16.));
break;
case PM_LargeIconSize:
- ret = 32;
+ ret = int(QStyleHelper::dpiScaled(32.));
break;
case PM_IconViewIconSize:
- ret = pixelMetric(PM_LargeIconSize, opt, widget);
+ ret = proxy()->pixelMetric(PM_LargeIconSize, opt, widget);
break;
case PM_ToolBarIconSize:
- ret = 24;
+ ret = int(QStyleHelper::dpiScaled(24.));
break;
case PM_DockWidgetTitleMargin:
- ret = 2;
+ ret = int(QStyleHelper::dpiScaled(2.));
break;
case PM_DockWidgetTitleBarButtonMargin:
- ret = 4;
+ ret = int(QStyleHelper::dpiScaled(4.));
break;
#if defined(Q_WS_WIN)
case PM_DockWidgetFrameWidth:
@@ -550,7 +544,7 @@ int QWindowsStyle::pixelMetric(PixelMetric pm, const QStyleOption *opt, const QW
ret = 0;
break;
case PM_ToolBarHandleExtent:
- ret = 10;
+ ret = int(QStyleHelper::dpiScaled(10.));
break;
default:
ret = QCommonStyle::pixelMetric(pm, opt, widget);
@@ -1065,6 +1059,8 @@ QPixmap QWindowsStyle::standardPixmap(StandardPixmap standardPixmap, const QStyl
}
}
break;
+ default:
+ break;
}
if (!desktopIcon.isNull()) {
return desktopIcon;
@@ -1133,12 +1129,7 @@ int QWindowsStyle::styleHint(StyleHint hint, const QStyleOption *opt, const QWid
#endif
break;
case SH_ItemView_ChangeHighlightOnFocus:
-#if defined(Q_WS_WIN)
- if (QSysInfo::WindowsVersion != QSysInfo::WV_95 && QSysInfo::WindowsVersion != QSysInfo::WV_NT)
- ret = 1;
- else
-#endif
- ret = 0;
+ ret = 1;
break;
case SH_ToolBox_SelectedPageTitleBold:
ret = 0;
@@ -1146,36 +1137,34 @@ int QWindowsStyle::styleHint(StyleHint hint, const QStyleOption *opt, const QWid
#if defined(Q_WS_WIN)
case SH_UnderlineShortcut:
+ {
ret = 1;
- if (QSysInfo::WindowsVersion != QSysInfo::WV_95
- && QSysInfo::WindowsVersion != QSysInfo::WV_98
- && QSysInfo::WindowsVersion != QSysInfo::WV_NT) {
- BOOL cues;
- SystemParametersInfo(SPI_GETKEYBOARDCUES, 0, &cues, 0);
- ret = int(cues);
- // Do nothing if we always paint underlines
- Q_D(const QWindowsStyle);
- if (!ret && widget && d) {
+ BOOL cues = false;
+ SystemParametersInfo(SPI_GETKEYBOARDCUES, 0, &cues, 0);
+ ret = int(cues);
+ // Do nothing if we always paint underlines
+ Q_D(const QWindowsStyle);
+ if (!ret && widget && d) {
#ifndef QT_NO_MENUBAR
- const QMenuBar *menuBar = qobject_cast<const QMenuBar *>(widget);
- if (!menuBar && qobject_cast<const QMenu *>(widget)) {
- QWidget *w = QApplication::activeWindow();
- if (w && w != widget)
- menuBar = qFindChild<QMenuBar *>(w);
- }
- // If we paint a menu bar draw underlines if is in the keyboardState
- if (menuBar) {
- if (menuBar->d_func()->keyboardState || d->altDown())
- ret = 1;
- // Otherwise draw underlines if the toplevel widget has seen an alt-press
- } else
-#endif // QT_NO_MENUBAR
- if (d->hasSeenAlt(widget)) {
+ const QMenuBar *menuBar = qobject_cast<const QMenuBar *>(widget);
+ if (!menuBar && qobject_cast<const QMenu *>(widget)) {
+ QWidget *w = QApplication::activeWindow();
+ if (w && w != widget)
+ menuBar = qFindChild<QMenuBar *>(w);
+ }
+ // If we paint a menu bar draw underlines if is in the keyboardState
+ if (menuBar) {
+ if (menuBar->d_func()->keyboardState || d->altDown())
ret = 1;
- }
+ // Otherwise draw underlines if the toplevel widget has seen an alt-press
+ } else
+#endif // QT_NO_MENUBAR
+ if (d->hasSeenAlt(widget)) {
+ ret = 1;
}
}
break;
+ }
#endif
#ifndef QT_NO_RUBBERBAND
case SH_RubberBand_Mask:
@@ -1217,6 +1206,9 @@ int QWindowsStyle::styleHint(StyleHint hint, const QStyleOption *opt, const QWid
case SH_ItemView_ArrowKeysNavigateIntoChildren:
ret = true;
break;
+ case SH_DialogButtonBox_ButtonsHaveIcons:
+ ret = 0;
+ break;
default:
ret = QCommonStyle::styleHint(hint, opt, widget, returnData);
break;
@@ -1272,7 +1264,7 @@ void QWindowsStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *opt,
p->translate(opt->rect.x(), opt->rect.y());
if (opt->state & State_Horizontal) {
int x = opt->rect.width() / 2 - 4;
- if (QApplication::layoutDirection() == Qt::RightToLeft)
+ if (opt->direction == Qt::RightToLeft)
x -= 2;
if (opt->rect.height() > 4) {
qDrawShadePanel(p, x, 2, 3, opt->rect.height() - 4,
@@ -1313,7 +1305,7 @@ void QWindowsStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *opt,
if ((!(opt->state & State_Sunken ))
&& (!(opt->state & State_Enabled)
|| !(opt->state & State_MouseOver && opt->state & State_AutoRaise))
- && (opt->state & State_On) && use2000style) {
+ && (opt->state & State_On)) {
fill = QBrush(opt->palette.light().color(), Qt::Dense4Pattern);
stippled = true;
} else {
@@ -1386,11 +1378,8 @@ void QWindowsStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *opt,
QRect r = opt->rect;
int size = qMin(r.height(), r.width());
QPixmap pixmap;
- QString pixmapName;
- pixmapName.sprintf("%s-%s-%d-%d-%d-%lld",
- "$qt_ia", metaObject()->className(),
- uint(opt->state), pe,
- size, opt->palette.cacheKey());
+ QString pixmapName = QStyleHelper::uniqueName(QLatin1String("$qt_ia-") + QLatin1String(metaObject()->className()), opt, QSize(size, size))
+ + QLatin1Char('-') + QString::number(pe);
if (!QPixmapCache::find(pixmapName, pixmap)) {
int border = size/5;
int sqsize = 2*(size/2);
@@ -1420,8 +1409,8 @@ void QWindowsStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *opt,
int bsy = 0;
if (opt->state & State_Sunken) {
- bsx = pixelMetric(PM_ButtonShiftHorizontal, opt, w);
- bsy = pixelMetric(PM_ButtonShiftVertical, opt, w);
+ bsx = proxy()->pixelMetric(PM_ButtonShiftHorizontal, opt, w);
+ bsy = proxy()->pixelMetric(PM_ButtonShiftVertical, opt, w);
}
QRect bounds = a.boundingRect();
@@ -1510,7 +1499,7 @@ void QWindowsStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *opt,
case PE_FrameFocusRect:
if (const QStyleOptionFocusRect *fropt = qstyleoption_cast<const QStyleOptionFocusRect *>(opt)) {
//### check for d->alt_down
- if (!(fropt->state & State_KeyboardFocusChange) && !styleHint(SH_UnderlineShortcut, opt))
+ if (!(fropt->state & State_KeyboardFocusChange) && !proxy()->styleHint(SH_UnderlineShortcut, opt))
return;
QRect r = opt->rect;
p->save();
@@ -1577,8 +1566,8 @@ void QWindowsStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *opt,
//center when rect is larger than indicator size
int xOffset = 0;
int yOffset = 0;
- int indicatorWidth = pixelMetric(PM_ExclusiveIndicatorWidth);
- int indicatorHeight = pixelMetric(PM_ExclusiveIndicatorWidth);
+ int indicatorWidth = proxy()->pixelMetric(PM_ExclusiveIndicatorWidth);
+ int indicatorHeight = proxy()->pixelMetric(PM_ExclusiveIndicatorWidth);
if (ir.width() > indicatorWidth)
xOffset += (ir.width() - indicatorWidth)/2;
if (ir.height() > indicatorHeight)
@@ -1627,9 +1616,9 @@ void QWindowsStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *opt,
popupPal.setColor(QPalette::Light, frame->palette.background().color());
popupPal.setColor(QPalette::Midlight, frame->palette.light().color());
}
- if (use2000style && pe == PE_Frame && (frame->state & State_Raised))
+ if (pe == PE_Frame && (frame->state & State_Raised))
qDrawWinButton(p, frame->rect, popupPal, frame->state & State_Sunken);
- else if (use2000style && pe == PE_Frame && (frame->state & State_Sunken))
+ else if (pe == PE_Frame && (frame->state & State_Sunken))
{
popupPal.setColor(QPalette::Midlight, frame->palette.background().color());
qDrawWinPanel(p, frame->rect, popupPal, frame->state & State_Sunken);
@@ -1735,7 +1724,7 @@ void QWindowsStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *opt,
break; }
case PE_FrameDockWidget:
if (qstyleoption_cast<const QStyleOptionFrame *>(opt)) {
- drawPrimitive(QStyle::PE_FrameWindow, opt, p, w);
+ proxy()->drawPrimitive(QStyle::PE_FrameWindow, opt, p, w);
}
break;
#endif // QT_NO_DOCKWIDGET
@@ -1754,7 +1743,7 @@ case PE_FrameDockWidget:
}
int space = 2;
- int chunksize = pixelMetric(PM_ProgressBarChunkWidth, opt, w) - space;
+ int chunksize = proxy()->pixelMetric(PM_ProgressBarChunkWidth, opt, w) - space;
if (!vertical) {
if (opt->rect.width() <= chunksize)
space = 0;
@@ -1780,13 +1769,12 @@ case PE_FrameDockWidget:
break;
#endif // QT_NO_PROGRESSBAR
- case PE_FrameTabWidget:
- if (use2000style) {
- QRect rect = opt->rect;
- QPalette pal = opt->palette;
- qDrawWinButton(p, opt->rect, opt->palette, false, 0);
- break;
- }
+ case PE_FrameTabWidget: {
+ QRect rect = opt->rect;
+ QPalette pal = opt->palette;
+ qDrawWinButton(p, opt->rect, opt->palette, false, 0);
+ break;
+ }
default:
QCommonStyle::drawPrimitive(pe, opt, p, w);
}
@@ -1813,7 +1801,7 @@ void QWindowsStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPai
p->save();
QRect r = opt->rect;
QStyleHintReturnMask mask;
- if (styleHint(QStyle::SH_RubberBand_Mask, opt, widget, &mask))
+ if (proxy()->styleHint(QStyle::SH_RubberBand_Mask, opt, widget, &mask))
p->setClipRegion(mask.region);
p->drawTiledPixmap(r.x(), r.y(), r.width(), r.height(), tiledPixmap);
p->restore();
@@ -1882,9 +1870,9 @@ void QWindowsStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPai
mode = QIcon::Active;
QPixmap pixmap;
if (checked)
- pixmap = menuitem->icon.pixmap(pixelMetric(PM_SmallIconSize, opt, widget), mode, QIcon::On);
+ pixmap = menuitem->icon.pixmap(proxy()->pixelMetric(PM_SmallIconSize, opt, widget), mode, QIcon::On);
else
- pixmap = menuitem->icon.pixmap(pixelMetric(PM_SmallIconSize, opt, widget), mode);
+ pixmap = menuitem->icon.pixmap(proxy()->pixelMetric(PM_SmallIconSize, opt, widget), mode);
int pixw = pixmap.width();
int pixh = pixmap.height();
if (act && !dis && !checked)
@@ -1903,7 +1891,7 @@ void QWindowsStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPai
newMi.state |= State_On;
newMi.rect = visualRect(opt->direction, menuitem->rect, QRect(menuitem->rect.x() + windowsItemFrame, menuitem->rect.y() + windowsItemFrame,
checkcol - 2 * windowsItemFrame, menuitem->rect.height() - 2*windowsItemFrame));
- drawPrimitive(PE_IndicatorMenuCheckMark, &newMi, p, widget);
+ proxy()->drawPrimitive(PE_IndicatorMenuCheckMark, &newMi, p, widget);
}
p->setPen(act ? menuitem->palette.highlightedText().color() : menuitem->palette.buttonText().color());
@@ -1922,13 +1910,13 @@ void QWindowsStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPai
p->save();
int t = s.indexOf(QLatin1Char('\t'));
int text_flags = Qt::AlignVCenter | Qt::TextShowMnemonic | Qt::TextDontClip | Qt::TextSingleLine;
- if (!styleHint(SH_UnderlineShortcut, menuitem, widget))
+ if (!proxy()->styleHint(SH_UnderlineShortcut, menuitem, widget))
text_flags |= Qt::TextHideMnemonic;
text_flags |= Qt::AlignLeft;
if (t >= 0) {
QRect vShortcutRect = visualRect(opt->direction, menuitem->rect,
QRect(textRect.topRight(), QPoint(menuitem->rect.right(), textRect.bottom())));
- if (dis && !act && styleHint(SH_EtchDisabledText, opt, widget)) {
+ if (dis && !act && proxy()->styleHint(SH_EtchDisabledText, opt, widget)) {
p->setPen(menuitem->palette.light().color());
p->drawText(vShortcutRect.adjusted(1,1,1,1), text_flags, s.mid(t + 1));
p->setPen(discol);
@@ -1940,7 +1928,7 @@ void QWindowsStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPai
if (menuitem->menuItemType == QStyleOptionMenuItem::DefaultItem)
font.setBold(true);
p->setFont(font);
- if (dis && !act && styleHint(SH_EtchDisabledText, opt, widget)) {
+ if (dis && !act && proxy()->styleHint(SH_EtchDisabledText, opt, widget)) {
p->setPen(menuitem->palette.light().color());
p->drawText(vTextRect.adjusted(1,1,1,1), text_flags, s.left(t));
p->setPen(discol);
@@ -1960,7 +1948,7 @@ void QWindowsStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPai
if (act)
newMI.palette.setColor(QPalette::ButtonText,
newMI.palette.highlightedText().color());
- drawPrimitive(arrow, &newMI, p, widget);
+ proxy()->drawPrimitive(arrow, &newMI, p, widget);
}
}
@@ -1982,8 +1970,8 @@ void QWindowsStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPai
qDrawShadeRect(p, mbi->rect.x(), mbi->rect.y(), mbi->rect.width(),
mbi->rect.height(), mbi->palette, active && down, 1, 0, &b);
if (active && down) {
- newMbi.rect.translate(pixelMetric(PM_ButtonShiftHorizontal, mbi, widget),
- pixelMetric(PM_ButtonShiftVertical, mbi, widget));
+ newMbi.rect.translate(proxy()->pixelMetric(PM_ButtonShiftHorizontal, mbi, widget),
+ proxy()->pixelMetric(PM_ButtonShiftVertical, mbi, widget));
p->setBrushOrigin(p->brushOrigin() - QPoint(1, 1));
}
}
@@ -2017,7 +2005,7 @@ void QWindowsStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPai
|| (rtlHorTabs
&& tab->selectedPosition
== QStyleOptionTab::PreviousIsSelected));
- int tabBarAlignment = styleHint(SH_TabBar_Alignment, tab, widget);
+ int tabBarAlignment = proxy()->styleHint(SH_TabBar_Alignment, tab, widget);
bool leftAligned = (!rtlHorTabs && tabBarAlignment == Qt::AlignLeft)
|| (rtlHorTabs
&& tabBarAlignment == Qt::AlignRight);
@@ -2031,7 +2019,7 @@ void QWindowsStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPai
QColor dark = tab->palette.dark().color();
QColor shadow = tab->palette.shadow().color();
QColor background = tab->palette.background().color();
- int borderThinkness = pixelMetric(PM_TabBarBaseOverlap, tab, widget);
+ int borderThinkness = proxy()->pixelMetric(PM_TabBarBaseOverlap, tab, widget);
if (selected)
borderThinkness /= 2;
QRect r2(opt->rect);
@@ -2062,10 +2050,6 @@ void QWindowsStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPai
p->setPen(light);
p->drawLine(x1, y1 + 2, x1, y2 - ((onlyOne || firstTab) && selected && leftAligned ? 0 : borderThinkness));
p->drawPoint(x1 + 1, y1 + 1);
- if (!use2000style) {
- p->setPen(midlight);
- p->drawLine(x1 + 1, y1 + 2, x1 + 1, y2 - ((onlyOne || firstTab) && selected && leftAligned ? 0 : borderThinkness));
- }
}
// Top
{
@@ -2073,10 +2057,6 @@ void QWindowsStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPai
int end = x2 - (nextSelected ? 0 : 2);
p->setPen(light);
p->drawLine(beg, y1, end, y1);
- if (!use2000style) {
- p->setPen(midlight);
- p->drawLine(beg, y1 + 1, end, y1 + 1);
- }
}
// Right
if (lastTab || selected || onlyOne || !nextSelected) {
@@ -2106,10 +2086,6 @@ void QWindowsStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPai
p->setPen(light);
p->drawLine(x1, y2 - 2, x1, y1 + ((onlyOne || firstTab) && selected && leftAligned ? 0 : borderThinkness));
p->drawPoint(x1 + 1, y2 - 1);
- if (!use2000style) {
- p->setPen(midlight);
- p->drawLine(x1 + 1, y2 - 2, x1 + 1, y1 + ((onlyOne || firstTab) && selected && leftAligned ? 0 : borderThinkness));
- }
}
// Bottom
{
@@ -2148,10 +2124,6 @@ void QWindowsStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPai
p->setPen(light);
p->drawLine(x1 + 2, y1, x2 - ((onlyOne || firstTab) && selected && leftAligned ? 0 : borderThinkness), y1);
p->drawPoint(x1 + 1, y1 + 1);
- if (!use2000style) {
- p->setPen(midlight);
- p->drawLine(x1 + 2, y1 + 1, x2 - ((onlyOne || firstTab) && selected && leftAligned ? 0 : borderThinkness), y1 + 1);
- }
}
// Left
{
@@ -2159,10 +2131,6 @@ void QWindowsStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPai
int end = y2 - (nextSelected ? 0 : 2);
p->setPen(light);
p->drawLine(x1, beg, x1, end);
- if (!use2000style) {
- p->setPen(midlight);
- p->drawLine(x1 + 1, beg, x1 + 1, end);
- }
}
// Bottom
if (lastTab || selected || onlyOne || !nextSelected) {
@@ -2194,11 +2162,6 @@ void QWindowsStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPai
p->setPen(light);
p->drawLine(x2 - 2, y1, x1 + ((onlyOne || firstTab) && selected && leftAligned ? 0 : borderThinkness), y1);
p->drawPoint(x2 - 1, y1 + 1);
- if (!use2000style) {
- p->setPen(midlight);
- p->drawLine(x2 - 3, y1 + 1, x1 + ((onlyOne || firstTab) && selected && leftAligned ? 0 : borderThinkness), y1 + 1);
- p->drawPoint(x2 - 1, y1);
- }
}
// Right
{
@@ -2235,7 +2198,7 @@ void QWindowsStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPai
#ifndef QT_NO_SCROLLBAR
case CE_ScrollBarSubLine:
case CE_ScrollBarAddLine: {
- if (use2000style && (opt->state & State_Sunken)) {
+ if ((opt->state & State_Sunken)) {
p->setPen(opt->palette.dark().color());
p->setBrush(opt->palette.brush(QPalette::Button));
p->drawRect(opt->rect.adjusted(0, 0, -1, -1));
@@ -2263,7 +2226,7 @@ void QWindowsStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPai
}
QStyleOption arrowOpt = *opt;
arrowOpt.rect = opt->rect.adjusted(4, 4, -4, -4);
- drawPrimitive(arrow, &arrowOpt, p, widget);
+ proxy()->drawPrimitive(arrow, &arrowOpt, p, widget);
break; }
case CE_ScrollBarAddPage:
case CE_ScrollBarSubPage: {
@@ -2352,7 +2315,7 @@ void QWindowsStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPai
default:
break;
}
- if(QApplication::layoutDirection() == Qt::RightToLeft){ //reverse layout changes the order of Beginning/end
+ if(opt->direction == Qt::RightToLeft){ //reverse layout changes the order of Beginning/end
bool tmp = paintLeftBorder;
paintRightBorder=paintLeftBorder;
paintLeftBorder=tmp;
@@ -2449,7 +2412,7 @@ void QWindowsStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPai
int w = rect.width();
if (pb->minimum == 0 && pb->maximum == 0) {
Q_D(const QWindowsStyle);
- const int unit_width = pixelMetric(PM_ProgressBarChunkWidth, pb, widget);
+ const int unit_width = proxy()->pixelMetric(PM_ProgressBarChunkWidth, pb, widget);
QStyleOptionProgressBarV2 pbBits = *pb;
Q_ASSERT(unit_width >0);
@@ -2473,7 +2436,7 @@ void QWindowsStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPai
for (int i = 0; i < chunksToDraw ; ++i) {
pbBits.rect.setRect(x0 + x, myY, unit_width, myHeight);
pbBits.rect = m.mapRect(QRectF(pbBits.rect)).toRect();
- drawPrimitive(PE_IndicatorProgressChunk, &pbBits, p, widget);
+ proxy()->drawPrimitive(PE_IndicatorProgressChunk, &pbBits, p, widget);
x += reverse ? -unit_width : unit_width;
}
//Draw wrap-around chunks
@@ -2484,7 +2447,7 @@ void QWindowsStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPai
for (int i = 0; i < chunksToDraw ; ++i) {
pbBits.rect.setRect(x0 + x, myY, unit_width, myHeight);
pbBits.rect = m.mapRect(QRectF(pbBits.rect)).toRect();
- drawPrimitive(PE_IndicatorProgressChunk, &pbBits, p, widget);
+ proxy()->drawPrimitive(PE_IndicatorProgressChunk, &pbBits, p, widget);
x += reverse ? -unit_width : unit_width;
}
}
@@ -2523,7 +2486,6 @@ void QWindowsStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPai
bool floating = false;
bool active = dwOpt->state & State_Active;
- int menuOffset = 0; //used to center text when floated
QColor inactiveCaptionTextColor = d->inactiveCaptionText;
if (dwOpt->movable) {
QColor left, right;
@@ -2538,7 +2500,6 @@ void QWindowsStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPai
left = d->inactiveCaptionColor;
right = d->inactiveGradientCaptionColor;
}
- menuOffset = 2;
QBrush fillBrush(left);
if (left != right) {
QPoint p1(r.x(), r.top() + r.height()/2);
@@ -2572,7 +2533,7 @@ void QWindowsStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPai
r.top() + titleRect.left() - rect.left(),
titleRect.height(), titleRect.width());
}
- drawItemText(p, titleRect,
+ proxy()->drawItemText(p, titleRect,
Qt::AlignLeft | Qt::AlignVCenter | Qt::TextShowMnemonic, palette,
dwOpt->state & State_Enabled, dwOpt->title,
floating ? (active ? QPalette::BrightText : QPalette::Window) : QPalette::WindowText);
@@ -2602,11 +2563,11 @@ QRect QWindowsStyle::subElementRect(SubElement sr, const QStyleOption *opt, cons
const QStyleOptionDockWidgetV2 *v2
= qstyleoption_cast<const QStyleOptionDockWidgetV2*>(opt);
bool verticalTitleBar = v2 == 0 ? false : v2->verticalTitleBar;
- int m = pixelMetric(PM_DockWidgetTitleMargin, opt, w);
+ int m = proxy()->pixelMetric(PM_DockWidgetTitleMargin, opt, w);
if (verticalTitleBar) {
r.adjust(0, 0, 0, -m);
} else {
- if (QApplication::layoutDirection() == Qt::LeftToRight)
+ if (opt->direction == Qt::LeftToRight)
r.adjust(m, 0, 0, 0);
else
r.adjust(0, 0, -m, 0);
@@ -2636,11 +2597,11 @@ void QWindowsStyle::drawComplexControl(ComplexControl cc, const QStyleOptionComp
#ifndef QT_NO_SLIDER
case CC_Slider:
if (const QStyleOptionSlider *slider = qstyleoption_cast<const QStyleOptionSlider *>(opt)) {
- int thickness = pixelMetric(PM_SliderControlThickness, slider, widget);
- int len = pixelMetric(PM_SliderLength, slider, widget);
+ int thickness = proxy()->pixelMetric(PM_SliderControlThickness, slider, widget);
+ int len = proxy()->pixelMetric(PM_SliderLength, slider, widget);
int ticks = slider->tickPosition;
- QRect groove = subControlRect(CC_Slider, slider, SC_SliderGroove, widget);
- QRect handle = subControlRect(CC_Slider, slider, SC_SliderHandle, widget);
+ QRect groove = proxy()->subControlRect(CC_Slider, slider, SC_SliderGroove, widget);
+ QRect handle = proxy()->subControlRect(CC_Slider, slider, SC_SliderHandle, widget);
if ((slider->subControls & SC_SliderGroove) && groove.isValid()) {
int mid = thickness / 2;
@@ -2711,7 +2672,7 @@ void QWindowsStyle::drawComplexControl(ComplexControl cc, const QStyleOptionComp
QStyleOptionFocusRect fropt;
fropt.QStyleOption::operator=(*slider);
fropt.rect = subElementRect(SE_SliderFocusRect, slider, widget);
- drawPrimitive(PE_FrameFocusRect, &fropt, p, widget);
+ proxy()->drawPrimitive(PE_FrameFocusRect, &fropt, p, widget);
}
if ((tickAbove && tickBelow) || (!tickAbove && !tickBelow)) {
@@ -3023,8 +2984,7 @@ void QWindowsStyle::drawComplexControl(ComplexControl cc, const QStyleOptionComp
if ((cmb->subControls & SC_ComboBoxFrame)) {
if (cmb->frame) {
QPalette shadePal = opt->palette;
- if (use2000style)
- shadePal.setColor(QPalette::Midlight, shadePal.button().color());
+ shadePal.setColor(QPalette::Midlight, shadePal.button().color());
qDrawWinPanel(p, opt->rect, shadePal, true, &editBrush);
}
else {
@@ -3034,7 +2994,7 @@ void QWindowsStyle::drawComplexControl(ComplexControl cc, const QStyleOptionComp
if (cmb->subControls & SC_ComboBoxArrow) {
State flags = State_None;
- QRect ar = subControlRect(CC_ComboBox, cmb, SC_ComboBoxArrow, widget);
+ QRect ar = proxy()->subControlRect(CC_ComboBox, cmb, SC_ComboBoxArrow, widget);
bool sunkenArrow = cmb->activeSubControls == SC_ComboBoxArrow
&& cmb->state & State_Sunken;
if (sunkenArrow) {
@@ -3060,11 +3020,11 @@ void QWindowsStyle::drawComplexControl(ComplexControl cc, const QStyleOptionComp
arrowOpt.rect = ar.adjusted(1, 1, -1, -1);
arrowOpt.palette = cmb->palette;
arrowOpt.state = flags;
- drawPrimitive(PE_IndicatorArrowDown, &arrowOpt, p, widget);
+ proxy()->drawPrimitive(PE_IndicatorArrowDown, &arrowOpt, p, widget);
}
if (cmb->subControls & SC_ComboBoxEditField) {
- QRect re = subControlRect(CC_ComboBox, cmb, SC_ComboBoxEditField, widget);
+ QRect re = proxy()->subControlRect(CC_ComboBox, cmb, SC_ComboBoxEditField, widget);
if (cmb->state & State_HasFocus && !cmb->editable)
p->fillRect(re.x(), re.y(), re.width(), re.height(),
cmb->palette.brush(QPalette::Highlight));
@@ -3084,7 +3044,7 @@ void QWindowsStyle::drawComplexControl(ComplexControl cc, const QStyleOptionComp
focus.rect = subElementRect(SE_ComboBoxFocusRect, cmb, widget);
focus.state |= State_FocusAtBorder;
focus.backgroundColor = cmb->palette.highlight().color();
- drawPrimitive(PE_FrameFocusRect, &focus, p, widget);
+ proxy()->drawPrimitive(PE_FrameFocusRect, &focus, p, widget);
}
}
}
@@ -3098,10 +3058,9 @@ void QWindowsStyle::drawComplexControl(ComplexControl cc, const QStyleOptionComp
bool enabled = opt->state & State_Enabled;
if (sb->frame && (sb->subControls & SC_SpinBoxFrame)) {
QBrush editBrush = sb->palette.brush(QPalette::Base);
- QRect r = subControlRect(CC_SpinBox, sb, SC_SpinBoxFrame, widget);
+ QRect r = proxy()->subControlRect(CC_SpinBox, sb, SC_SpinBoxFrame, widget);
QPalette shadePal = sb->palette;
- if (use2000style)
- shadePal.setColor(QPalette::Midlight, shadePal.button().color());
+ shadePal.setColor(QPalette::Midlight, shadePal.button().color());
qDrawWinPanel(p, r, shadePal, true, &editBrush);
}
@@ -3129,7 +3088,7 @@ void QWindowsStyle::drawComplexControl(ComplexControl cc, const QStyleOptionComp
pe = (sb->buttonSymbols == QAbstractSpinBox::PlusMinus ? PE_IndicatorSpinPlus
: PE_IndicatorSpinUp);
- copy.rect = subControlRect(CC_SpinBox, sb, SC_SpinBoxUp, widget);
+ copy.rect = proxy()->subControlRect(CC_SpinBox, sb, SC_SpinBoxUp, widget);
qDrawWinButton(p, copy.rect, shadePal, copy.state & (State_Sunken | State_On),
&copy.palette.brush(QPalette::Button));
copy.rect.adjust(4, 1, -5, -1);
@@ -3137,9 +3096,9 @@ void QWindowsStyle::drawComplexControl(ComplexControl cc, const QStyleOptionComp
QStyleOptionSpinBox lightCopy = copy;
lightCopy.rect.adjust(1, 1, 1, 1);
lightCopy.palette.setBrush(QPalette::ButtonText, copy.palette.light());
- drawPrimitive(pe, &lightCopy, p, widget);
+ proxy()->drawPrimitive(pe, &lightCopy, p, widget);
}
- drawPrimitive(pe, &copy, p, widget);
+ proxy()->drawPrimitive(pe, &copy, p, widget);
}
if (sb->subControls & SC_SpinBoxDown) {
@@ -3162,7 +3121,7 @@ void QWindowsStyle::drawComplexControl(ComplexControl cc, const QStyleOptionComp
pe = (sb->buttonSymbols == QAbstractSpinBox::PlusMinus ? PE_IndicatorSpinMinus
: PE_IndicatorSpinDown);
- copy.rect = subControlRect(CC_SpinBox, sb, SC_SpinBoxDown, widget);
+ copy.rect = proxy()->subControlRect(CC_SpinBox, sb, SC_SpinBoxDown, widget);
qDrawWinButton(p, copy.rect, shadePal, copy.state & (State_Sunken | State_On),
&copy.palette.brush(QPalette::Button));
copy.rect.adjust(4, 0, -5, -1);
@@ -3170,13 +3129,14 @@ void QWindowsStyle::drawComplexControl(ComplexControl cc, const QStyleOptionComp
QStyleOptionSpinBox lightCopy = copy;
lightCopy.rect.adjust(1, 1, 1, 1);
lightCopy.palette.setBrush(QPalette::ButtonText, copy.palette.light());
- drawPrimitive(pe, &lightCopy, p, widget);
+ proxy()->drawPrimitive(pe, &lightCopy, p, widget);
}
- drawPrimitive(pe, &copy, p, widget);
+ proxy()->drawPrimitive(pe, &copy, p, widget);
}
}
break;
#endif // QT_NO_SPINBOX
+
default:
QCommonStyle::drawComplexControl(cc, opt, p, widget);
}
@@ -3195,12 +3155,15 @@ QSize QWindowsStyle::sizeFromContents(ContentsType ct, const QStyleOption *opt,
h = sz.height();
int defwidth = 0;
if (btn->features & QStyleOptionButton::AutoDefaultButton)
- defwidth = 2 * pixelMetric(PM_ButtonDefaultIndicator, btn, widget);
+ defwidth = 2 * proxy()->pixelMetric(PM_ButtonDefaultIndicator, btn, widget);
+ int minwidth = int(QStyleHelper::dpiScaled(75.));
+ int minheight = int(QStyleHelper::dpiScaled(23.));
+
#ifndef QT_QWS_SMALL_PUSHBUTTON
- if (w < 75 + defwidth && !btn->text.isEmpty())
- w = 75 + defwidth;
- if (h < 23 + defwidth)
- h = 23 + defwidth;
+ if (w < minwidth + defwidth && !btn->text.isEmpty())
+ w = minwidth + defwidth;
+ if (h < minheight + defwidth)
+ h = minheight + defwidth;
#endif
sz = QSize(w, h);
}
@@ -3220,13 +3183,13 @@ QSize QWindowsStyle::sizeFromContents(ContentsType ct, const QStyleOption *opt,
}
if (mi->menuItemType != QStyleOptionMenuItem::Separator && !mi->icon.isNull()) {
- int iconExtent = pixelMetric(PM_SmallIconSize, opt, widget);
+ int iconExtent = proxy()->pixelMetric(PM_SmallIconSize, opt, widget);
sz.setHeight(qMax(sz.height(),
mi->icon.actualSize(QSize(iconExtent, iconExtent)).height()
+ 2 * windowsItemFrame));
}
int maxpmw = mi->maxIconWidth;
- int tabSpacing = use2000style ? 20 :windowsTabSpacing;
+ int tabSpacing = 20;
if (mi->text.contains(QLatin1Char('\t')))
w += tabSpacing;
else if (mi->menuItemType == QStyleOptionMenuItem::SubMenu)
@@ -3380,7 +3343,7 @@ QIcon QWindowsStyle::standardIconImplementation(StandardPixmap standardIcon, con
&& QSysInfo::WindowsVersion < QSysInfo::WV_NT_based
&& pSHGetStockIconInfo)
{
- icon.addPixmap(standardPixmap(SP_VistaShield, option, widget)); //fetches small icon
+ icon.addPixmap(proxy()->standardPixmap(SP_VistaShield, option, widget)); //fetches small icon
QSHSTOCKICONINFO iconInfo; //append large icon
memset(&iconInfo, 0, sizeof(iconInfo));
iconInfo.cbSize = sizeof(iconInfo);
diff --git a/src/gui/styles/qwindowsstyle.h b/src/gui/styles/qwindowsstyle.h
index 359e828..f372150 100644
--- a/src/gui/styles/qwindowsstyle.h
+++ b/src/gui/styles/qwindowsstyle.h
@@ -1,7 +1,6 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the QtGui module of the Qt Toolkit.
@@ -21,9 +20,10 @@
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.1, included in the file LGPL_EXCEPTION.txt in this
+** package.
**
** If you have questions regarding the use of this file, please contact
** Nokia at qt-info@nokia.com.
diff --git a/src/gui/styles/qwindowsstyle_p.h b/src/gui/styles/qwindowsstyle_p.h
index fb84dce..54abb3d 100644
--- a/src/gui/styles/qwindowsstyle_p.h
+++ b/src/gui/styles/qwindowsstyle_p.h
@@ -1,7 +1,6 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the QtGui module of the Qt Toolkit.
@@ -21,9 +20,10 @@
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.1, included in the file LGPL_EXCEPTION.txt in this
+** package.
**
** If you have questions regarding the use of this file, please contact
** Nokia at qt-info@nokia.com.
diff --git a/src/gui/styles/qwindowsvistastyle.cpp b/src/gui/styles/qwindowsvistastyle.cpp
index a2b3209..3789854 100644
--- a/src/gui/styles/qwindowsvistastyle.cpp
+++ b/src/gui/styles/qwindowsvistastyle.cpp
@@ -1,7 +1,6 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the QtGui module of the Qt Toolkit.
@@ -21,9 +20,10 @@
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.1, included in the file LGPL_EXCEPTION.txt in this
+** package.
**
** If you have questions regarding the use of this file, please contact
** Nokia at qt-info@nokia.com.
@@ -41,6 +41,7 @@
#include "qwindowsvistastyle.h"
#include "qwindowsvistastyle_p.h"
+#include <private/qstylehelper_p.h>
#if !defined(QT_NO_STYLE_WINDOWSVISTA) || defined(QT_PLUGIN)
@@ -195,17 +196,15 @@ void Animation::paint(QPainter *painter, const QStyleOption *option)
Q_UNUSED(painter);
}
-/*
-* ! \internal
-*
-* Helperfunction to paint the current transition state
-* between two animation frames.
-*
-* The result is a blended image consisting of
-* ((alpha)*_primaryImage) + ((1-alpha)*_secondaryImage)
-*
-*/
+/*! \internal
+
+ Helperfunction to paint the current transition state between two
+ animation frames.
+ The result is a blended image consisting of ((alpha)*_primaryImage)
+ + ((1-alpha)*_secondaryImage)
+
+*/
void Animation::drawBlendedImage(QPainter *painter, QRect rect, float alpha) {
if (_secondaryImage.isNull() || _primaryImage.isNull())
return;
@@ -247,14 +246,11 @@ void Animation::drawBlendedImage(QPainter *painter, QRect rect, float alpha) {
painter->drawImage(rect, _tempImage);
}
-/*
-* ! \internal
-*
-* Paints a transition state. The result will be a mix between the
-* initial and final state of the transition, depending on the
-* time difference between _startTime and current time.
+/*! \internal
+ Paints a transition state. The result will be a mix between the
+ initial and final state of the transition, depending on the time
+ difference between _startTime and current time.
*/
-
void Transition::paint(QPainter *painter, const QStyleOption *option)
{
float alpha = 1.0;
@@ -277,15 +273,11 @@ void Transition::paint(QPainter *painter, const QStyleOption *option)
drawBlendedImage(painter, option->rect, alpha);
}
-/*
-* ! \internal
-*
-* Paints a pulse. The result will be a mix between the
-* primary and secondary pulse images depending on the
-* time difference between _startTime and current time.
+/*! \internal
+ Paints a pulse. The result will be a mix between the primary and
+ secondary pulse images depending on the time difference between
+ _startTime and current time.
*/
-
-
void Pulse::paint(QPainter *painter, const QStyleOption *option)
{
float alpha = 1.0;
@@ -307,31 +299,37 @@ void Pulse::paint(QPainter *painter, const QStyleOption *option)
/*!
- \reimp
- *
- * Animations are used for some state transitions on specific widgets.
- *
- * Only one running animation can exist for a widget at any specific time.
- * Animations can be added through QWindowsVistaStylePrivate::startAnimation(Animation *)
- * and any existing animation on a widget can be retrieved with
- * QWindowsVistaStylePrivate::widgetAnimation(Widget *).
- *
- * Once an animation has been started, QWindowsVistaStylePrivate::timerEvent(QTimerEvent *)
- * will continuously call update() on the widget until it is stopped, meaning that drawPrimitive
- * will be called many times until the transition has completed. During this time, the result
- * will be retrieved by the Animation::paint(...) function and not by the style itself.
- *
- * To determine if a transition should occur, the style needs to know the previous state of the
- * widget as well as the current one. This is solved by updating dynamic properties on the widget
- * every time the function is called.
- *
- * Transitions interrupting existing transitions should always be smooth, so whenever a hover-transition
- * is started on a pulsating button, it uses the current frame of the pulse-animation as the
- * starting image for the hover transition.
- *
+ \internal
+
+ Animations are used for some state transitions on specific widgets.
+
+ Only one running animation can exist for a widget at any specific
+ time. Animations can be added through
+ QWindowsVistaStylePrivate::startAnimation(Animation *) and any
+ existing animation on a widget can be retrieved with
+ QWindowsVistaStylePrivate::widgetAnimation(Widget *).
+
+ Once an animation has been started,
+ QWindowsVistaStylePrivate::timerEvent(QTimerEvent *) will
+ continuously call update() on the widget until it is stopped,
+ meaning that drawPrimitive will be called many times until the
+ transition has completed. During this time, the result will be
+ retrieved by the Animation::paint(...) function and not by the style
+ itself.
+
+ To determine if a transition should occur, the style needs to know
+ the previous state of the widget as well as the current one. This is
+ solved by updating dynamic properties on the widget every time the
+ function is called.
+
+ Transitions interrupting existing transitions should always be
+ smooth, so whenever a hover-transition is started on a pulsating
+ button, it uses the current frame of the pulse-animation as the
+ starting image for the hover transition.
+
*/
void QWindowsVistaStyle::drawPrimitive(PrimitiveElement element, const QStyleOption *option,
- QPainter *painter, const QWidget *widget) const
+ QPainter *painter, const QWidget *widget) const
{
QWindowsVistaStylePrivate *d = const_cast<QWindowsVistaStylePrivate*>(d_func());
@@ -366,7 +364,8 @@ void QWindowsVistaStyle::drawPrimitive(PrimitiveElement element, const QStyleOpt
w->setProperty("_q_stylestate", (int)option->state);
w->setProperty("_q_stylerect", w->rect());
- bool doTransition = ((state & State_Sunken) != (oldState & State_Sunken) ||
+ bool doTransition = oldState &&
+ ((state & State_Sunken) != (oldState & State_Sunken) ||
(state & State_On) != (oldState & State_On) ||
(state & State_MouseOver) != (oldState & State_MouseOver));
@@ -403,7 +402,7 @@ void QWindowsVistaStyle::drawPrimitive(PrimitiveElement element, const QStyleOpt
// pulsating default button into the intended target state.
if (!anim)
- drawPrimitive(element, &opt, &startPainter, 0); // Note that the widget pointer is intentionally 0
+ proxy()->drawPrimitive(element, &opt, &startPainter, 0); // Note that the widget pointer is intentionally 0
else // this ensures that we do not recurse in the animation logic above
anim->paint(&startPainter, &opt);
@@ -417,7 +416,7 @@ void QWindowsVistaStyle::drawPrimitive(PrimitiveElement element, const QStyleOpt
endImage.fill(0);
QStyleOption opt2 = opt;
opt2.state = option->state;
- drawPrimitive(element, &opt2, &endPainter, 0); // Note that the widget pointer is intentionally 0
+ proxy()->drawPrimitive(element, &opt2, &endPainter, 0); // Note that the widget pointer is intentionally 0
// this ensures that we do not recurse in the animation logic above
t->setEndImage(endImage);
@@ -487,7 +486,12 @@ void QWindowsVistaStyle::drawPrimitive(PrimitiveElement element, const QStyleOpt
case PE_IndicatorBranch:
{
XPThemeData theme(d->treeViewHelper(), painter, QLatin1String("TREEVIEW"));
- static const int decoration_size = 16;
+ static int decoration_size = 0;
+ if (theme.isValid() && !decoration_size) {
+ SIZE size;
+ pGetThemePartSize(theme.handle(), 0, TVP_HOTGLYPH, GLPS_OPENED, 0, TS_TRUE, &size);
+ decoration_size = qMax(size.cx, size.cy);
+ }
int mid_h = option->rect.x() + option->rect.width() / 2;
int mid_v = option->rect.y() + option->rect.height() / 2;
int bef_h = mid_h;
@@ -535,17 +539,6 @@ void QWindowsVistaStyle::drawPrimitive(PrimitiveElement element, const QStyleOpt
}
break;
- case PE_IndicatorToolBarHandle:
- {
- XPThemeData theme;
- if (option->state & State_Horizontal)
- theme = XPThemeData(widget, painter, QLatin1String("REBAR"), RP_GRIPPER, ETS_NORMAL, option->rect.adjusted(0, 1, -2, -2));
- else
- theme = XPThemeData(widget, painter, QLatin1String("REBAR"), RP_GRIPPERVERT, ETS_NORMAL, option->rect.adjusted(0, 1, -2, -2));
- d->drawBackground(theme);
- }
- break;
-
case PE_FrameMenu:
{
int stateId = option->state & State_Active ? MB_ACTIVE : MB_INACTIVE;
@@ -645,7 +638,7 @@ void QWindowsVistaStyle::drawPrimitive(PrimitiveElement element, const QStyleOpt
}
}
if (panel->lineWidth > 0)
- drawPrimitive(PE_FrameLineEdit, panel, painter, widget);
+ proxy()->drawPrimitive(PE_FrameLineEdit, panel, painter, widget);
return;
}
break;
@@ -694,6 +687,24 @@ void QWindowsVistaStyle::drawPrimitive(PrimitiveElement element, const QStyleOpt
}
break;
+ case PE_IndicatorToolBarHandle:
+ {
+ XPThemeData theme;
+ QRect rect;
+ if (option->state & State_Horizontal) {
+ theme = XPThemeData(widget, painter, QLatin1String("REBAR"), RP_GRIPPER, ETS_NORMAL, option->rect.adjusted(0, 1, -2, -2));
+ rect = option->rect.adjusted(0, 1, 0, -2);
+ rect.setWidth(4);
+ } else {
+ theme = XPThemeData(widget, painter, QLatin1String("REBAR"), RP_GRIPPERVERT, ETS_NORMAL, option->rect.adjusted(0, 1, -2, -2));
+ rect = option->rect.adjusted(1, 0, -1, 0);
+ rect.setHeight(4);
+ }
+ theme.rect = rect;
+ d->drawBackground(theme);
+ }
+ break;
+
case PE_IndicatorToolBarSeparator:
{
QPen pen = painter->pen();
@@ -725,7 +736,7 @@ void QWindowsVistaStyle::drawPrimitive(PrimitiveElement element, const QStyleOpt
if (const QListView *listview = qobject_cast<const QListView *>(widget)) {
if (listview->viewMode() == QListView::IconMode)
newStyle = true;
- } else if (const QTreeView* treeview = qobject_cast<const QTreeView *>(widget)) {
+ } else if (qobject_cast<const QTreeView *>(widget)) {
newStyle = true;
}
if (newStyle && view && (vopt = qstyleoption_cast<const QStyleOptionViewItemV4 *>(option))) {
@@ -864,11 +875,9 @@ void QWindowsVistaStyle::drawPrimitive(PrimitiveElement element, const QStyleOpt
/*!
-
- \reimp
+ \internal
see drawPrimitive for comments on the animation support
-
*/
void QWindowsVistaStyle::drawControl(ControlElement element, const QStyleOption *option,
QPainter *painter, const QWidget *widget) const
@@ -934,7 +943,7 @@ void QWindowsVistaStyle::drawControl(ControlElement element, const QStyleOption
QPainter startPainter(&startImage);
if (!anim) {
- drawControl(element, &opt, &startPainter, 0 /* Intentional */);
+ proxy()->drawControl(element, &opt, &startPainter, 0 /* Intentional */);
} else {
anim->paint(&startPainter, &opt);
d->stopAnimation(widget);
@@ -945,7 +954,7 @@ void QWindowsVistaStyle::drawControl(ControlElement element, const QStyleOption
endImage.fill(0);
QPainter endPainter(&endImage);
- drawControl(element, option, &endPainter, 0 /* Intentional */);
+ proxy()->drawControl(element, option, &endPainter, 0 /* Intentional */);
t->setEndImage(endImage);
int duration = 0;
HTHEME theme = pOpenThemeData(0, L"Button");
@@ -1047,9 +1056,10 @@ void QWindowsVistaStyle::drawControl(ControlElement element, const QStyleOption
QRect ir = subElementRect(SE_PushButtonContents, option, 0);
QStyleOptionButton newBtn = *btn;
newBtn.rect = QStyle::visualRect(option->direction, option->rect,
- QRect(ir.right() - mbiw - 2, (option->rect.height()/2) - (mbih/2),
+ QRect(ir.right() - mbiw - 2,
+ option->rect.top() + (option->rect.height()/2) - (mbih/2),
mbiw + 1, mbih + 1));
- drawPrimitive(PE_IndicatorArrowDown, &newBtn, painter, widget);
+ proxy()->drawPrimitive(PE_IndicatorArrowDown, &newBtn, painter, widget);
}
return;
}
@@ -1084,7 +1094,7 @@ void QWindowsVistaStyle::drawControl(ControlElement element, const QStyleOption
XPThemeData theme(widget, painter, QLatin1String("PROGRESS"), vertical ? PP_FILLVERT : PP_FILL);
theme.rect = option->rect;
- bool reverse = bar->direction == Qt::LeftToRight && inverted || bar->direction == Qt::RightToLeft && !inverted;
+ bool reverse = (bar->direction == Qt::LeftToRight && inverted) || (bar->direction == Qt::RightToLeft && !inverted);
QTime current = QTime::currentTime();
if (isIndeterminate) {
@@ -1197,10 +1207,10 @@ void QWindowsVistaStyle::drawControl(ControlElement element, const QStyleOption
break;
QPalette::ColorRole textRole = disabled ? QPalette::Text : QPalette::ButtonText;
- QPixmap pix = mbi->icon.pixmap(pixelMetric(PM_SmallIconSize, option, widget), QIcon::Normal);
+ QPixmap pix = mbi->icon.pixmap(proxy()->pixelMetric(PM_SmallIconSize, option, widget), QIcon::Normal);
uint alignment = Qt::AlignCenter | Qt::TextShowMnemonic | Qt::TextDontClip | Qt::TextSingleLine;
- if (!styleHint(SH_UnderlineShortcut, mbi, widget))
+ if (!proxy()->styleHint(SH_UnderlineShortcut, mbi, widget))
alignment |= Qt::TextHideMnemonic;
//The rect adjustment is a workaround for the menu not really filling its background.
@@ -1229,7 +1239,15 @@ void QWindowsVistaStyle::drawControl(ControlElement element, const QStyleOption
case CE_MenuItem:
if (const QStyleOptionMenuItem *menuitem = qstyleoption_cast<const QStyleOptionMenuItem *>(option)) {
// windows always has a check column, regardless whether we have an icon or not
- int checkcol = qMax(menuitem->maxIconWidth, 28);
+ int checkcol = 28;
+ {
+ SIZE size;
+ MARGINS margins;
+ XPThemeData theme(widget, 0, QLatin1String("MENU"), MENU_POPUPCHECKBACKGROUND, MBI_HOT);
+ pGetThemePartSize(theme.handle(), NULL, MENU_POPUPCHECK, 0, NULL,TS_TRUE, &size);
+ pGetThemeMargins(theme.handle(), NULL, MENU_POPUPCHECK, 0, TMT_CONTENTMARGINS, NULL, &margins);
+ checkcol = qMax(menuitem->maxIconWidth, int(6 + size.cx + margins.cxLeftWidth + margins.cxRightWidth));
+ }
QColor darkLine = option->palette.background().color().darker(108);
QColor lightLine = option->palette.background().color().lighter(107);
QRect rect = option->rect;
@@ -1254,7 +1272,7 @@ void QWindowsVistaStyle::drawControl(ControlElement element, const QStyleOption
int yoff = y-2 + h / 2;
QPoint p1 = QPoint(x + checkcol, yoff);
QPoint p2 = QPoint(x + w + 6 , yoff);
- int stateId = stateId = MBI_HOT;
+ stateId = MBI_HOT;
QRect subRect(p1.x(), p1.y(), p2.x() - p1.x(), 6);
subRect = QStyle::visualRect(option->direction, option->rect, subRect );
XPThemeData theme2(widget, painter, QLatin1String("MENU"), MENU_POPUPSEPARATOR, stateId, subRect);
@@ -1266,7 +1284,7 @@ void QWindowsVistaStyle::drawControl(ControlElement element, const QStyleOption
menuitem->rect.y(), checkcol - 6, menuitem->rect.height()));
if (act) {
- int stateId = stateId = MBI_HOT;
+ stateId = MBI_HOT;
XPThemeData theme2(widget, painter, QLatin1String("MENU"), MENU_POPUPITEM, stateId, option->rect);
d->drawBackground(theme2);
}
@@ -1274,8 +1292,23 @@ void QWindowsVistaStyle::drawControl(ControlElement element, const QStyleOption
if (checked) {
XPThemeData theme(widget, painter, QLatin1String("MENU"), MENU_POPUPCHECKBACKGROUND,
menuitem->icon.isNull() ? MBI_HOT : MBI_PUSHED, vCheckRect);
+ SIZE size;
+ MARGINS margins;
+ pGetThemePartSize(theme.handle(), NULL, MENU_POPUPCHECK, 0, NULL,TS_TRUE, &size);
+ pGetThemeMargins(theme.handle(), NULL, MENU_POPUPCHECK, 0,
+ TMT_CONTENTMARGINS, NULL, &margins);
+ QRect checkRect(0, 0, size.cx + margins.cxLeftWidth + margins.cxRightWidth ,
+ size.cy + margins.cyBottomHeight + margins.cyTopHeight);
+ checkRect.moveCenter(vCheckRect.center());
+ theme.rect = checkRect;
+
d->drawBackground(theme);
+
if (menuitem->icon.isNull()) {
+ checkRect = QRect(0, 0, size.cx, size.cy);
+ checkRect.moveCenter(theme.rect.center());
+ theme.rect = checkRect;
+
theme.partId = MENU_POPUPCHECK;
bool bullet = menuitem->checkType & QStyleOptionMenuItem::Exclusive;
if (dis)
@@ -1292,9 +1325,9 @@ void QWindowsVistaStyle::drawControl(ControlElement element, const QStyleOption
mode = QIcon::Active;
QPixmap pixmap;
if (checked)
- pixmap = menuitem->icon.pixmap(pixelMetric(PM_SmallIconSize, option, widget), mode, QIcon::On);
+ pixmap = menuitem->icon.pixmap(proxy()->pixelMetric(PM_SmallIconSize, option, widget), mode, QIcon::On);
else
- pixmap = menuitem->icon.pixmap(pixelMetric(PM_SmallIconSize, option, widget), mode);
+ pixmap = menuitem->icon.pixmap(proxy()->pixelMetric(PM_SmallIconSize, option, widget), mode);
int pixw = pixmap.width();
int pixh = pixmap.height();
QRect pmr(0, 0, pixw, pixh);
@@ -1320,7 +1353,7 @@ void QWindowsVistaStyle::drawControl(ControlElement element, const QStyleOption
painter->save();
int t = s.indexOf(QLatin1Char('\t'));
int text_flags = Qt::AlignVCenter | Qt::TextShowMnemonic | Qt::TextDontClip | Qt::TextSingleLine;
- if (!styleHint(SH_UnderlineShortcut, menuitem, widget))
+ if (!proxy()->styleHint(SH_UnderlineShortcut, menuitem, widget))
text_flags |= Qt::TextHideMnemonic;
text_flags |= Qt::AlignLeft;
if (t >= 0) {
@@ -1346,7 +1379,7 @@ void QWindowsVistaStyle::drawControl(ControlElement element, const QStyleOption
QStyleOptionMenuItem newMI = *menuitem;
newMI.rect = vSubMenuRect;
newMI.state = dis ? State_None : State_Enabled;
- drawPrimitive(arrow, &newMI, painter, widget);
+ proxy()->drawPrimitive(arrow, &newMI, painter, widget);
}
}
break;
@@ -1371,7 +1404,7 @@ void QWindowsVistaStyle::drawControl(ControlElement element, const QStyleOption
break;
case CE_MenuBarEmptyArea:
{
- int stateId = MBI_NORMAL;
+ stateId = MBI_NORMAL;
if (!(state & State_Enabled))
stateId = MBI_DISABLED;
XPThemeData theme(widget, painter, QLatin1String("MENU"), MENU_BARBACKGROUND, stateId, option->rect);
@@ -1416,8 +1449,8 @@ void QWindowsVistaStyle::drawControl(ControlElement element, const QStyleOption
painter->drawRect(rect.adjusted(0, 1, -1, -3));
int buttonMargin = 4;
- int mw = pixelMetric(QStyle::PM_DockWidgetTitleMargin, dwOpt, widget);
- int fw = pixelMetric(PM_DockWidgetFrameWidth, dwOpt, widget);
+ int mw = proxy()->pixelMetric(QStyle::PM_DockWidgetTitleMargin, dwOpt, widget);
+ int fw = proxy()->pixelMetric(PM_DockWidgetFrameWidth, dwOpt, widget);
const QDockWidget *dw = qobject_cast<const QDockWidget *>(widget);
bool isFloating = dw != 0 && dw->isFloating();
@@ -1436,7 +1469,7 @@ void QWindowsVistaStyle::drawControl(ControlElement element, const QStyleOption
if (isFloating) {
titleRect.adjust(0, -fw, 0, 0);
- if (widget != 0 && widget->windowIcon().cacheKey() != qApp->windowIcon().cacheKey())
+ if (widget != 0 && widget->windowIcon().cacheKey() != QApplication::windowIcon().cacheKey())
titleRect.adjust(titleRect.height() + mw, 0, 0, 0);
} else {
titleRect.adjust(mw, 0, 0, 0);
@@ -1468,7 +1501,7 @@ void QWindowsVistaStyle::drawControl(ControlElement element, const QStyleOption
if (const QListView *listview = qobject_cast<const QListView *>(widget)) {
if (listview->viewMode() == QListView::IconMode)
newStyle = true;
- } else if (const QTreeView* treeview = qobject_cast<const QTreeView *>(widget)) {
+ } else if (qobject_cast<const QTreeView *>(widget)) {
newStyle = true;
}
if (newStyle && view && (vopt = qstyleoption_cast<const QStyleOptionViewItemV4 *>(option))) {
@@ -1504,7 +1537,7 @@ void QWindowsVistaStyle::drawControl(ControlElement element, const QStyleOption
}
/*!
- \reimp
+ \internal
see drawPrimitive for comments on the animation support
@@ -1556,7 +1589,7 @@ void QWindowsVistaStyle::drawComplexControl(ComplexControl control, const QStyle
if (qstyleoption_cast<const QStyleOptionSlider *>(option)) {
QRect oldSliderPos = w->property("_q_stylesliderpos").toRect();
- QRect currentPos = subControlRect(CC_ScrollBar, option, SC_ScrollBarSlider, widget);
+ QRect currentPos = proxy()->subControlRect(CC_ScrollBar, option, SC_ScrollBarSlider, widget);
w->setProperty("_q_stylesliderpos", currentPos);
if (oldSliderPos != currentPos) {
doTransition = false;
@@ -1587,7 +1620,7 @@ void QWindowsVistaStyle::drawComplexControl(ComplexControl control, const QStyle
QStyleOptionComboBox startCombo = *combo;
startCombo.state = (QStyle::State)oldState;
startCombo.activeSubControls = (QStyle::SubControl)oldActiveControls;
- drawComplexControl(control, &startCombo, &startPainter, 0 /* Intentional */);
+ proxy()->drawComplexControl(control, &startCombo, &startPainter, 0 /* Intentional */);
t->setStartImage(startImage);
} else if (const QStyleOptionSlider *slider = qstyleoption_cast<const QStyleOptionSlider*>(option)) {
//This is a workaround for the direct3d engine as it currently has some issues with grabWindow
@@ -1596,7 +1629,7 @@ void QWindowsVistaStyle::drawComplexControl(ComplexControl control, const QStyle
QStyleOptionSlider startSlider = *slider;
startSlider.state = (QStyle::State)oldState;
startSlider.activeSubControls = (QStyle::SubControl)oldActiveControls;
- drawComplexControl(control, &startSlider, &startPainter, 0 /* Intentional */);
+ proxy()->drawComplexControl(control, &startSlider, &startPainter, 0 /* Intentional */);
t->setStartImage(startImage);
} else {
QPoint offset(0, 0);
@@ -1614,7 +1647,7 @@ void QWindowsVistaStyle::drawComplexControl(ComplexControl control, const QStyle
d->startAnimation(t);
endImage.fill(0);
QPainter endPainter(&endImage);
- drawComplexControl(control, option, &endPainter, 0 /* Intentional */);
+ proxy()->drawComplexControl(control, option, &endPainter, 0 /* Intentional */);
t->setEndImage(endImage);
t->setStartTime(QTime::currentTime());
@@ -1653,9 +1686,9 @@ void QWindowsVistaStyle::drawComplexControl(ComplexControl control, const QStyle
d->drawBackground(theme);
}
if (sub & SC_ComboBoxArrow) {
- QRect subRect = subControlRect(CC_ComboBox, option, SC_ComboBoxArrow, widget);
+ QRect subRect = proxy()->subControlRect(CC_ComboBox, option, SC_ComboBoxArrow, widget);
XPThemeData theme(widget, painter, QLatin1String("COMBOBOX"));
- theme.rect = subControlRect(CC_ComboBox, option, SC_ComboBoxArrow, widget);
+ theme.rect = subRect;
partId = option->direction == Qt::RightToLeft ? CP_DROPDOWNBUTTONLEFT : CP_DROPDOWNBUTTONRIGHT;
if (!(cmb->state & State_Enabled))
@@ -1679,7 +1712,7 @@ void QWindowsVistaStyle::drawComplexControl(ComplexControl control, const QStyle
btn.rect = option->rect.adjusted(-1, -1, 1, 1);
if (sub & SC_ComboBoxArrow)
btn.features = QStyleOptionButton::HasMenu;
- drawControl(QStyle::CE_PushButton, &btn, painter, widget);
+ proxy()->drawControl(QStyle::CE_PushButton, &btn, painter, widget);
}
}
}
@@ -1696,7 +1729,7 @@ void QWindowsVistaStyle::drawComplexControl(ComplexControl control, const QStyle
bool isHorz = flags & State_Horizontal;
bool isRTL = option->direction == Qt::RightToLeft;
if (sub & SC_ScrollBarAddLine) {
- theme.rect = subControlRect(CC_ScrollBar, option, SC_ScrollBarAddLine, widget);
+ theme.rect = proxy()->subControlRect(CC_ScrollBar, option, SC_ScrollBarAddLine, widget);
partId = SBP_ARROWBTN;
if (!(flags & State_Enabled))
stateId = (isHorz ? (isRTL ? ABS_LEFTDISABLED : ABS_RIGHTDISABLED) : ABS_DOWNDISABLED);
@@ -1713,7 +1746,7 @@ void QWindowsVistaStyle::drawComplexControl(ComplexControl control, const QStyle
d->drawBackground(theme);
}
if (sub & SC_ScrollBarSubLine) {
- theme.rect = subControlRect(CC_ScrollBar, option, SC_ScrollBarSubLine, widget);
+ theme.rect = proxy()->subControlRect(CC_ScrollBar, option, SC_ScrollBarSubLine, widget);
partId = SBP_ARROWBTN;
if (!(flags & State_Enabled))
stateId = (isHorz ? (isRTL ? ABS_RIGHTDISABLED : ABS_LEFTDISABLED) : ABS_UPDISABLED);
@@ -1730,9 +1763,9 @@ void QWindowsVistaStyle::drawComplexControl(ComplexControl control, const QStyle
d->drawBackground(theme);
}
if (maxedOut) {
- theme.rect = subControlRect(CC_ScrollBar, option, SC_ScrollBarSlider, widget);
- theme.rect = theme.rect.united(subControlRect(CC_ScrollBar, option, SC_ScrollBarSubPage, widget));
- theme.rect = theme.rect.united(subControlRect(CC_ScrollBar, option, SC_ScrollBarAddPage, widget));
+ theme.rect = proxy()->subControlRect(CC_ScrollBar, option, SC_ScrollBarSlider, widget);
+ theme.rect = theme.rect.united(proxy()->subControlRect(CC_ScrollBar, option, SC_ScrollBarSubPage, widget));
+ theme.rect = theme.rect.united(proxy()->subControlRect(CC_ScrollBar, option, SC_ScrollBarAddPage, widget));
partId = flags & State_Horizontal ? SBP_LOWERTRACKHORZ : SBP_LOWERTRACKVERT;
stateId = SCRBS_DISABLED;
theme.partId = partId;
@@ -1740,7 +1773,7 @@ void QWindowsVistaStyle::drawComplexControl(ComplexControl control, const QStyle
d->drawBackground(theme);
} else {
if (sub & SC_ScrollBarSubPage) {
- theme.rect = subControlRect(CC_ScrollBar, option, SC_ScrollBarSubPage, widget);
+ theme.rect = proxy()->subControlRect(CC_ScrollBar, option, SC_ScrollBarSubPage, widget);
partId = flags & State_Horizontal ? SBP_UPPERTRACKHORZ : SBP_UPPERTRACKVERT;
if (!(flags & State_Enabled))
stateId = SCRBS_DISABLED;
@@ -1755,7 +1788,7 @@ void QWindowsVistaStyle::drawComplexControl(ComplexControl control, const QStyle
d->drawBackground(theme);
}
if (sub & SC_ScrollBarAddPage) {
- theme.rect = subControlRect(CC_ScrollBar, option, SC_ScrollBarAddPage, widget);
+ theme.rect = proxy()->subControlRect(CC_ScrollBar, option, SC_ScrollBarAddPage, widget);
partId = flags & State_Horizontal ? SBP_LOWERTRACKHORZ : SBP_LOWERTRACKVERT;
if (!(flags & State_Enabled))
stateId = SCRBS_DISABLED;
@@ -1770,7 +1803,7 @@ void QWindowsVistaStyle::drawComplexControl(ComplexControl control, const QStyle
d->drawBackground(theme);
}
if (sub & SC_ScrollBarSlider) {
- theme.rect = subControlRect(CC_ScrollBar, option, SC_ScrollBarSlider, widget);
+ theme.rect = proxy()->subControlRect(CC_ScrollBar, option, SC_ScrollBarSlider, widget);
if (!(flags & State_Enabled))
stateId = SCRBS_DISABLED;
else if (scrollbar->activeSubControls & SC_ScrollBarSlider && (scrollbar->state & State_Sunken))
@@ -1783,7 +1816,7 @@ void QWindowsVistaStyle::drawComplexControl(ComplexControl control, const QStyle
stateId = SCRBS_NORMAL;
// Draw handle
- theme.rect = subControlRect(CC_ScrollBar, option, SC_ScrollBarSlider, widget);
+ theme.rect = proxy()->subControlRect(CC_ScrollBar, option, SC_ScrollBarSlider, widget);
theme.partId = flags & State_Horizontal ? SBP_THUMBBTNHORZ : SBP_THUMBBTNVERT;
theme.stateId = stateId;
d->drawBackground(theme);
@@ -1851,7 +1884,7 @@ void QWindowsVistaStyle::drawComplexControl(ComplexControl control, const QStyle
d->drawBackground(ftheme);
}
if (sub & SC_SpinBoxUp) {
- theme.rect = subControlRect(CC_SpinBox, option, SC_SpinBoxUp, widget).adjusted(0, 0, 0, 1);
+ theme.rect = proxy()->subControlRect(CC_SpinBox, option, SC_SpinBoxUp, widget).adjusted(0, 0, 0, 1);
partId = SPNP_UP;
if (!(sb->stepEnabled & QAbstractSpinBox::StepUpEnabled) || !(flags & State_Enabled))
stateId = UPS_DISABLED;
@@ -1866,7 +1899,7 @@ void QWindowsVistaStyle::drawComplexControl(ComplexControl control, const QStyle
d->drawBackground(theme);
}
if (sub & SC_SpinBoxDown) {
- theme.rect = subControlRect(CC_SpinBox, option, SC_SpinBoxDown, widget);
+ theme.rect = proxy()->subControlRect(CC_SpinBox, option, SC_SpinBoxDown, widget);
partId = SPNP_DOWN;
if (!(sb->stepEnabled & QAbstractSpinBox::StepDownEnabled) || !(flags & State_Enabled))
stateId = DNS_DISABLED;
@@ -1890,7 +1923,7 @@ void QWindowsVistaStyle::drawComplexControl(ComplexControl control, const QStyle
}
/*!
- \reimp
+ \internal
*/
QSize QWindowsVistaStyle::sizeFromContents(ContentsType type, const QStyleOption *option,
const QSize &size, const QWidget *widget) const
@@ -1925,9 +1958,18 @@ QSize QWindowsVistaStyle::sizeFromContents(ContentsType type, const QStyleOption
return sz;
case CT_MenuItem:
sz = QWindowsXPStyle::sizeFromContents(type, option, size, widget);
- sz.rwidth() += 28;
+ int minimumHeight;
+ {
+ SIZE size;
+ MARGINS margins;
+ XPThemeData theme(widget, 0, QLatin1String("MENU"), MENU_POPUPCHECKBACKGROUND, MBI_HOT);
+ pGetThemePartSize(theme.handle(), NULL, MENU_POPUPCHECK, 0, NULL,TS_TRUE, &size);
+ pGetThemeMargins(theme.handle(), NULL, MENU_POPUPCHECK, 0, TMT_CONTENTMARGINS, NULL, &margins);
+ minimumHeight = qMax<qint32>(size.cy + margins.cyBottomHeight+ margins.cyTopHeight, sz.height());
+ sz.rwidth() += size.cx + margins.cxLeftWidth + margins.cxRightWidth;
+ }
+
if (const QStyleOptionMenuItem *menuitem = qstyleoption_cast<const QStyleOptionMenuItem *>(option)) {
- int minimumHeight = qMax<qint32>(22, sz.height());
if (menuitem->menuItemType != QStyleOptionMenuItem::Separator)
sz.setHeight(minimumHeight);
}
@@ -1947,7 +1989,7 @@ QSize QWindowsVistaStyle::sizeFromContents(ContentsType type, const QStyleOption
{
//Spinbox adds frame twice
sz = QWindowsStyle::sizeFromContents(type, option, size, widget);
- int border = pixelMetric(PM_SpinBoxFrameWidth, option, widget);
+ int border = proxy()->pixelMetric(PM_SpinBoxFrameWidth, option, widget);
sz -= QSize(2*border, 2*border);
}
return sz;
@@ -1958,7 +2000,7 @@ QSize QWindowsVistaStyle::sizeFromContents(ContentsType type, const QStyleOption
}
/*!
- \reimp
+ \internal
*/
QRect QWindowsVistaStyle::subElementRect(SubElement element, const QStyleOption *option, const QWidget *widget) const
{
@@ -1973,7 +2015,7 @@ QRect QWindowsVistaStyle::subElementRect(SubElement element, const QStyleOption
MARGINS borderSize;
HTHEME theme = pOpenThemeData(widget ? QWindowsVistaStylePrivate::winId(widget) : 0, L"Button");
if (theme) {
- int stateId;
+ int stateId = PBS_NORMAL;
if (!(option->state & State_Enabled))
stateId = PBS_DISABLED;
else if (option->state & State_Sunken)
@@ -1982,10 +2024,8 @@ QRect QWindowsVistaStyle::subElementRect(SubElement element, const QStyleOption
stateId = PBS_HOT;
else if (btn->features & QStyleOptionButton::DefaultButton)
stateId = PBS_DEFAULTED;
- else
- stateId = PBS_NORMAL;
- int border = pixelMetric(PM_DefaultFrameWidth, btn, widget);
+ int border = proxy()->pixelMetric(PM_DefaultFrameWidth, btn, widget);
rect = option->rect.adjusted(border, border, -border, -border);
int result = pGetThemeMargins(theme,
@@ -2012,7 +2052,7 @@ QRect QWindowsVistaStyle::subElementRect(SubElement element, const QStyleOption
int w = option->rect.width();
int x = option->rect.x();
int y = option->rect.y();
- int margin = pixelMetric(QStyle::PM_HeaderMargin, option, widget);
+ int margin = proxy()->pixelMetric(QStyle::PM_HeaderMargin, option, widget);
XPThemeData theme(widget, 0, QLatin1String("HEADER"), HP_HEADERSORTARROW, HSAS_SORTEDDOWN, option->rect);
@@ -2038,7 +2078,7 @@ QRect QWindowsVistaStyle::subElementRect(SubElement element, const QStyleOption
case SE_HeaderLabel:
{
- int margin = pixelMetric(QStyle::PM_HeaderMargin, option, widget);
+ int margin = proxy()->pixelMetric(QStyle::PM_HeaderMargin, option, widget);
QRect r = option->rect;
r.setRect(option->rect.x() + margin, option->rect.y() + margin,
option->rect.width() - margin * 2, option->rect.height() - margin * 2);
@@ -2056,7 +2096,7 @@ QRect QWindowsVistaStyle::subElementRect(SubElement element, const QStyleOption
rect = QCommonStyle::subElementRect(SE_ProgressBarGroove, option, widget);
break;
case SE_ItemViewItemDecoration:
- if (const QStyleOptionViewItemV4 *vopt = qstyleoption_cast<const QStyleOptionViewItemV4 *>(option))
+ if (qstyleoption_cast<const QStyleOptionViewItemV4 *>(option))
rect.adjust(-2, 0, 2, 0);
break;
case SE_ItemViewItemFocusRect:
@@ -2129,7 +2169,7 @@ static bool buttonVisible(const QStyle::SubControl sc, const QStyleOptionTitleBa
}
-/*! \reimp */
+/*! \internal */
int QWindowsVistaStyle::styleHint(StyleHint hint, const QStyleOption *option, const QWidget *widget,
QStyleHintReturn *returnData) const
{
@@ -2163,7 +2203,7 @@ int QWindowsVistaStyle::styleHint(StyleHint hint, const QStyleOption *option, co
/*!
- \reimp
+ \internal
*/
QRect QWindowsVistaStyle::subControlRect(ComplexControl control, const QStyleOptionComplex *option,
SubControl subControl, const QWidget *widget) const
@@ -2190,7 +2230,7 @@ QRect QWindowsVistaStyle::subControlRect(ComplexControl control, const QStyleOpt
rect = cb->rect;
break;
case SC_ComboBoxArrow:
- rect.setRect(cb->editable ? xpos : 0, y , wi - xpos, he);
+ rect.setRect(xpos, y , wi - xpos, he);
break;
case SC_ComboBoxEditField:
rect.setRect(x + margin, y + margin, wi - 2 * margin - 16, he - 2 * margin);
@@ -2214,7 +2254,7 @@ QRect QWindowsVistaStyle::subControlRect(ComplexControl control, const QStyleOpt
const int width = tb->rect.width();
int buttonWidth = GetSystemMetrics(SM_CXSIZE) - 4;
- const int frameWidth = pixelMetric(PM_MdiSubWindowFrameWidth, option, widget);
+ const int frameWidth = proxy()->pixelMetric(PM_MdiSubWindowFrameWidth, option, widget);
const bool sysmenuHint = (tb->titleBarFlags & Qt::WindowSystemMenuHint) != 0;
const bool minimizeHint = (tb->titleBarFlags & Qt::WindowMinimizeButtonHint) != 0;
const bool maximizeHint = (tb->titleBarFlags & Qt::WindowMaximizeButtonHint) != 0;
@@ -2251,7 +2291,7 @@ QRect QWindowsVistaStyle::subControlRect(ComplexControl control, const QStyleOpt
{
const int controlTop = 6;
const int controlHeight = height - controlTop - 3;
- int iconExtent = pixelMetric(PM_SmallIconSize);
+ int iconExtent = proxy()->pixelMetric(PM_SmallIconSize);
QSize iconSize = tb->icon.actualSize(QSize(iconExtent, iconExtent));
if (tb->icon.isNull())
iconSize = QSize(controlHeight, controlHeight);
@@ -2262,6 +2302,8 @@ QRect QWindowsVistaStyle::subControlRect(ComplexControl control, const QStyleOpt
rect = visualRect(option->direction, option->rect, rect);
}
break;
+ default:
+ break;
}
}
break;
@@ -2272,7 +2314,7 @@ QRect QWindowsVistaStyle::subControlRect(ComplexControl control, const QStyleOpt
}
/*!
- \reimp
+ \internal
*/
bool QWindowsVistaStyle::event(QEvent *e)
{
@@ -2295,7 +2337,7 @@ bool QWindowsVistaStyle::event(QEvent *e)
}
/*!
- \reimp
+ \internal
*/
QStyle::SubControl QWindowsVistaStyle::hitTestComplexControl(ComplexControl control, const QStyleOptionComplex *option,
const QPoint &pos, const QWidget *widget) const
@@ -2307,7 +2349,7 @@ QStyle::SubControl QWindowsVistaStyle::hitTestComplexControl(ComplexControl cont
}
/*!
- \reimp
+ \internal
*/
int QWindowsVistaStyle::pixelMetric(PixelMetric metric, const QStyleOption *option, const QWidget *widget) const
{
@@ -2317,9 +2359,9 @@ int QWindowsVistaStyle::pixelMetric(PixelMetric metric, const QStyleOption *opti
switch (metric) {
case PM_DockWidgetTitleBarButtonMargin:
- return 5;
+ return int(QStyleHelper::dpiScaled(5.));
case PM_ScrollBarSliderMin:
- return 18;
+ return int(QStyleHelper::dpiScaled(18.));
case PM_MenuHMargin:
case PM_MenuVMargin:
return 0;
@@ -2332,7 +2374,7 @@ int QWindowsVistaStyle::pixelMetric(PixelMetric metric, const QStyleOption *opti
}
/*!
- \reimp
+ \internal
*/
QPalette QWindowsVistaStyle::standardPalette() const
{
@@ -2340,7 +2382,7 @@ QPalette QWindowsVistaStyle::standardPalette() const
}
/*!
- \reimp
+ \internal
*/
void QWindowsVistaStyle::polish(QApplication *app)
{
@@ -2348,7 +2390,7 @@ void QWindowsVistaStyle::polish(QApplication *app)
}
/*!
- \reimp
+ \internal
*/
void QWindowsVistaStyle::polish(QWidget *widget)
{
@@ -2402,7 +2444,7 @@ void QWindowsVistaStyle::polish(QWidget *widget)
}
/*!
- \reimp
+ \internal
*/
void QWindowsVistaStyle::unpolish(QWidget *widget)
{
@@ -2435,7 +2477,7 @@ void QWindowsVistaStyle::unpolish(QWidget *widget)
else if (QTreeView *tree = qobject_cast<QTreeView *> (widget)) {
tree->viewport()->setAttribute(Qt::WA_Hover, false);
} else if (qobject_cast<QCommandLinkButton*>(widget)) {
- QFont font = qApp->font("QCommandLinkButton");
+ QFont font = QApplication::font("QCommandLinkButton");
QFont widgetFont = widget->font();
widgetFont.setFamily(font.family()); //Only family set by polish
widget->setFont(widgetFont);
@@ -2444,7 +2486,7 @@ void QWindowsVistaStyle::unpolish(QWidget *widget)
/*!
- \reimp
+ \internal
*/
void QWindowsVistaStyle::unpolish(QApplication *app)
{
@@ -2452,7 +2494,7 @@ void QWindowsVistaStyle::unpolish(QApplication *app)
}
/*!
- \reimp
+ \internal
*/
void QWindowsVistaStyle::polish(QPalette &pal)
{
@@ -2461,7 +2503,7 @@ void QWindowsVistaStyle::polish(QPalette &pal)
}
/*!
- \reimp
+ \internal
*/
QPixmap QWindowsVistaStyle::standardPixmap(StandardPixmap standardPixmap, const QStyleOption *option,
const QWidget *widget) const
@@ -2530,9 +2572,7 @@ void QWindowsVistaStylePrivate::startAnimation(Animation *t)
bool QWindowsVistaStylePrivate::transitionsEnabled() const
{
BOOL animEnabled = false;
- if (QT_WA_INLINE(SystemParametersInfo(SPI_GETCLIENTAREAANIMATION, 0, &animEnabled, 0),
- SystemParametersInfoA(SPI_GETCLIENTAREAANIMATION, 0, &animEnabled, 0)
- ))
+ if (SystemParametersInfo(SPI_GETCLIENTAREAANIMATION, 0, &animEnabled, 0))
{
if (animEnabled)
return true;
diff --git a/src/gui/styles/qwindowsvistastyle.h b/src/gui/styles/qwindowsvistastyle.h
index 6bf4e0c..9d4f99d 100644
--- a/src/gui/styles/qwindowsvistastyle.h
+++ b/src/gui/styles/qwindowsvistastyle.h
@@ -1,7 +1,6 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the QtGui module of the Qt Toolkit.
@@ -21,9 +20,10 @@
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.1, included in the file LGPL_EXCEPTION.txt in this
+** package.
**
** If you have questions regarding the use of this file, please contact
** Nokia at qt-info@nokia.com.
diff --git a/src/gui/styles/qwindowsvistastyle_p.h b/src/gui/styles/qwindowsvistastyle_p.h
index d4170aa..072aab9 100644
--- a/src/gui/styles/qwindowsvistastyle_p.h
+++ b/src/gui/styles/qwindowsvistastyle_p.h
@@ -1,7 +1,6 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the QtGui module of the Qt Toolkit.
@@ -21,9 +20,10 @@
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.1, included in the file LGPL_EXCEPTION.txt in this
+** package.
**
** If you have questions regarding the use of this file, please contact
** Nokia at qt-info@nokia.com.
diff --git a/src/gui/styles/qwindowsxpstyle.cpp b/src/gui/styles/qwindowsxpstyle.cpp
index ed2ee8a..de63274 100644
--- a/src/gui/styles/qwindowsxpstyle.cpp
+++ b/src/gui/styles/qwindowsxpstyle.cpp
@@ -1,7 +1,6 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the QtGui module of the Qt Toolkit.
@@ -21,9 +20,10 @@
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.1, included in the file LGPL_EXCEPTION.txt in this
+** package.
**
** If you have questions regarding the use of this file, please contact
** Nokia at qt-info@nokia.com.
@@ -46,6 +46,7 @@
#include <private/qobject_p.h>
#include <private/qpaintengine_raster_p.h>
#include <private/qapplication_p.h>
+#include <private/qstylehelper_p.h>
#include <qlibrary.h>
#include <qpainter.h>
#include <qpaintengine.h>
@@ -124,15 +125,14 @@ static PtrIsThemeBackgroundPartiallyTransparent pIsThemeBackgroundPartiallyTrans
// General const values
static const int windowsItemFrame = 2; // menu item frame width
-static const int windowsSepHeight = 9; // separator item height
static const int windowsItemHMargin = 3; // menu item hor text margin
static const int windowsItemVMargin = 0; // menu item ver text margin
static const int windowsArrowHMargin = 6; // arrow horizontal margin
-static const int windowsCheckMarkHMargin = 0; // horiz. margins of check mark
static const int windowsRightBorder = 12; // right border on windows
// External function calls
extern Q_GUI_EXPORT HDC qt_win_display_dc();
+extern QRegion qt_region_from_HRGN(HRGN rgn);
@@ -160,8 +160,7 @@ HTHEME XPThemeData::handle()
htheme = QWindowsXPStylePrivate::handleMap->operator[](name);
if (!htheme) {
- htheme = pOpenThemeData(QWindowsXPStylePrivate::winId(widget),
- (TCHAR*)name.utf16());
+ htheme = pOpenThemeData(QWindowsXPStylePrivate::winId(widget), (wchar_t*)name.utf16());
if (htheme) {
if (!QWindowsXPStylePrivate::handleMap)
QWindowsXPStylePrivate::handleMap = new QMap<QString, HTHEME>;
@@ -260,7 +259,7 @@ void QWindowsXPStylePrivate::cleanup(bool force)
use_xp = false;
cleanupHandleMap();
if (limboWidget) {
- if (qApp->closingDown())
+ if (QApplication::closingDown())
delete limboWidget;
else
limboWidget->deleteLater();
@@ -445,6 +444,7 @@ bool QWindowsXPStylePrivate::isTransparent(XPThemeData &themeData)
themeData.stateId);
}
+
/*! \internal
Returns a QRegion of the region of the part
*/
@@ -456,12 +456,18 @@ QRegion QWindowsXPStylePrivate::region(XPThemeData &themeData)
themeData.stateId, &rect, &hRgn)))
return QRegion();
- QRegion rgn = QRegion(0,0,1,1);
- const bool success = CombineRgn(rgn.handle(), hRgn, 0, RGN_COPY) != ERROR;
- DeleteObject(hRgn);
+ HRGN dest = CreateRectRgn(0, 0, 0, 0);
+ const bool success = CombineRgn(dest, hRgn, 0, RGN_COPY) != ERROR;
+
+ QRegion region;
+
if (success)
- return rgn;
- return QRegion();
+ region = qt_region_from_HRGN(dest);
+
+ DeleteObject(hRgn);
+ DeleteObject(dest);
+
+ return region;
}
/*! \internal
@@ -1025,7 +1031,7 @@ void QWindowsXPStylePrivate::drawBackgroundThruNativeBuffer(XPThemeData &themeDa
Most of the functions are documented in the base classes
QWindowsStyle, QCommonStyle, and QStyle, but the
QWindowsXPStyle overloads of drawComplexControl(), drawControl(),
- drawControlMask(), drawPrimitive(), subControlRect(), and
+ drawControlMask(), drawPrimitive(), proxy()->subControlRect(), and
sizeFromContents(), are documented here.
\img qwindowsxpstyle.png
@@ -1192,8 +1198,8 @@ QRect QWindowsXPStyle::subElementRect(SubElement sr, const QStyleOption *option,
QStyleOptionTab otherOption;
otherOption.shape = (twfOption->shape == QTabBar::RoundedNorth
? QTabBar::RoundedEast : QTabBar::RoundedSouth);
- int overlap = pixelMetric(PM_TabBarBaseOverlap, &otherOption, widget);
- int borderThickness = pixelMetric(PM_DefaultFrameWidth, option, widget);
+ int overlap = proxy()->pixelMetric(PM_TabBarBaseOverlap, &otherOption, widget);
+ int borderThickness = proxy()->pixelMetric(PM_DefaultFrameWidth, option, widget);
rect.adjust(-overlap + borderThickness, 0, -overlap + borderThickness, 0);
}
break;}
@@ -1217,7 +1223,7 @@ QRect QWindowsXPStyle::subElementRect(SubElement sr, const QStyleOption *option,
else
stateId = PBS_NORMAL;
- int border = pixelMetric(PM_DefaultFrameWidth, btn, widget);
+ int border = proxy()->pixelMetric(PM_DefaultFrameWidth, btn, widget);
rect = option->rect.adjusted(border, border, -border, -border);
int result = pGetThemeMargins(theme,
@@ -1533,7 +1539,7 @@ case PE_Frame:
}
if (panel->lineWidth > 0)
- drawPrimitive(PE_FrameLineEdit, panel, p, widget);
+ proxy()->drawPrimitive(PE_FrameLineEdit, panel, p, widget);
return;
}
break;
@@ -1547,11 +1553,11 @@ case PE_Frame:
if (widget) {
bool useGradient = true;
const int maxlength = 256;
- WCHAR themeFileName[maxlength];
- WCHAR themeColor[maxlength];
+ wchar_t themeFileName[maxlength];
+ wchar_t themeColor[maxlength];
// Due to a a scaling issue with the XP Silver theme, tab gradients are not used with it
if (pGetCurrentThemeName(themeFileName, maxlength, themeColor, maxlength, NULL, 0) == S_OK) {
- WCHAR* offset;
+ wchar_t *offset = 0;
if ((offset = wcsrchr(themeFileName, QChar(QLatin1Char('\\')).unicode())) != NULL) {
offset++;
if (!lstrcmp(offset, L"Luna.msstyles") && !lstrcmp(offset, L"Metallic")) {
@@ -1618,7 +1624,7 @@ case PE_Frame:
else
stateId = FS_INACTIVE;
- int fwidth = pixelMetric(PM_DockWidgetFrameWidth, frm, widget);
+ int fwidth = proxy()->pixelMetric(PM_DockWidgetFrameWidth, frm, widget);
XPThemeData theme(widget, p, name, 0, stateId);
if (!theme.isValid())
@@ -1792,7 +1798,12 @@ case PE_Frame:
return;
case PE_IndicatorToolBarSeparator:
-
+ if (option->rect.height() < 3) {
+ // XP style requires a few pixels for the separator
+ // to be visible.
+ QWindowsStyle::drawPrimitive(pe, option, p, widget);
+ return;
+ }
name = QLatin1String("TOOLBAR");
partId = TP_SEPARATOR;
@@ -1821,7 +1832,7 @@ case PE_Frame:
QStyleOptionButton button;
button.QStyleOption::operator=(*option);
button.state &= ~State_MouseOver;
- drawPrimitive(PE_IndicatorCheckBox, &button, p, widget);
+ proxy()->drawPrimitive(PE_IndicatorCheckBox, &button, p, widget);
return;
}
@@ -1914,8 +1925,8 @@ void QWindowsXPStyle::drawControl(ControlElement element, const QStyleOption *op
{
name = QLatin1String("BUTTON");
partId = BP_PUSHBUTTON;
- bool justFlat = (btn->features & QStyleOptionButton::Flat) && !(flags & (State_On|State_Sunken))
- || (btn->features & QStyleOptionButton::CommandLinkButton
+ bool justFlat = ((btn->features & QStyleOptionButton::Flat) && !(flags & (State_On|State_Sunken)))
+ || ((btn->features & QStyleOptionButton::CommandLinkButton)
&& !(flags & State_MouseOver)
&& !(btn->features & QStyleOptionButton::DefaultButton));
if (!(flags & State_Enabled) && !(btn->features & QStyleOptionButton::Flat))
@@ -1949,7 +1960,7 @@ void QWindowsXPStyle::drawControl(ControlElement element, const QStyleOption *op
QRect ir = btn->rect;
QStyleOptionButton newBtn = *btn;
newBtn.rect = QRect(ir.right() - mbiw - 1, 1 + (ir.height()/2) - (mbih/2), mbiw, mbih);
- drawPrimitive(PE_IndicatorArrowDown, &newBtn, p, widget);
+ proxy()->drawPrimitive(PE_IndicatorArrowDown, &newBtn, p, widget);
}
return;
}
@@ -1972,10 +1983,10 @@ void QWindowsXPStyle::drawControl(ControlElement element, const QStyleOption *op
bool lastTab = tab->position == QStyleOptionTab::End;
bool firstTab = tab->position == QStyleOptionTab::Beginning;
bool onlyOne = tab->position == QStyleOptionTab::OnlyOneTab;
- bool leftAligned = styleHint(SH_TabBar_Alignment, tab, widget) == Qt::AlignLeft;
- bool centerAligned = styleHint(SH_TabBar_Alignment, tab, widget) == Qt::AlignCenter;
- int borderThickness = pixelMetric(PM_DefaultFrameWidth, option, widget);
- int tabOverlap = pixelMetric(PM_TabBarTabOverlap, option, widget);
+ bool leftAligned = proxy()->styleHint(SH_TabBar_Alignment, tab, widget) == Qt::AlignLeft;
+ bool centerAligned = proxy()->styleHint(SH_TabBar_Alignment, tab, widget) == Qt::AlignCenter;
+ int borderThickness = proxy()->pixelMetric(PM_DefaultFrameWidth, option, widget);
+ int tabOverlap = proxy()->pixelMetric(PM_TabBarTabOverlap, option, widget);
if (isDisabled)
stateId = TIS_DISABLED;
@@ -2120,8 +2131,8 @@ void QWindowsXPStyle::drawControl(ControlElement element, const QStyleOption *op
if (act && !dis)
mode = QIcon::Active;
QPixmap pixmap = checked ?
- menuitem->icon.pixmap(pixelMetric(PM_SmallIconSize, option, widget), mode, QIcon::On) :
- menuitem->icon.pixmap(pixelMetric(PM_SmallIconSize, option, widget), mode);
+ menuitem->icon.pixmap(proxy()->pixelMetric(PM_SmallIconSize, option, widget), mode, QIcon::On) :
+ menuitem->icon.pixmap(proxy()->pixelMetric(PM_SmallIconSize, option, widget), mode);
int pixw = pixmap.width();
int pixh = pixmap.height();
QRect iconRect(0, 0, pixw, pixh);
@@ -2147,7 +2158,7 @@ void QWindowsXPStyle::drawControl(ControlElement element, const QStyleOption *op
checkcol - 2 * windowsItemFrame,
menuitem->rect.height() - 2*windowsItemFrame);
newMi.rect = visualRect(option->direction, option->rect, checkMarkRect);
- drawPrimitive(PE_IndicatorMenuCheckMark, &newMi, p, widget);
+ proxy()->drawPrimitive(PE_IndicatorMenuCheckMark, &newMi, p, widget);
}
QColor textColor = dis ? menuitem->palette.text().color() :
@@ -2164,12 +2175,12 @@ void QWindowsXPStyle::drawControl(ControlElement element, const QStyleOption *op
p->save();
int t = s.indexOf(QLatin1Char('\t'));
int text_flags = Qt::AlignVCenter|Qt::TextShowMnemonic | Qt::TextDontClip | Qt::TextSingleLine | Qt::AlignLeft;
- if (!styleHint(SH_UnderlineShortcut, menuitem, widget))
+ if (!proxy()->styleHint(SH_UnderlineShortcut, menuitem, widget))
text_flags |= Qt::TextHideMnemonic;
// draw tab text ----------------
if (t >= 0) {
QRect vShortcutRect = visualRect(option->direction, option->rect, QRect(textRect.topRight(), menuitem->rect.bottomRight()));
- if (dis && !act && styleHint(SH_EtchDisabledText, option, widget)) {
+ if (dis && !act && proxy()->styleHint(SH_EtchDisabledText, option, widget)) {
p->setPen(menuitem->palette.light().color());
p->drawText(vShortcutRect.adjusted(1,1,1,1), text_flags, s.mid(t + 1));
p->setPen(textColor);
@@ -2181,7 +2192,7 @@ void QWindowsXPStyle::drawControl(ControlElement element, const QStyleOption *op
if (menuitem->menuItemType == QStyleOptionMenuItem::DefaultItem)
font.setBold(true);
p->setFont(font);
- if (dis && !act && styleHint(SH_EtchDisabledText, option, widget)) {
+ if (dis && !act && proxy()->styleHint(SH_EtchDisabledText, option, widget)) {
p->setPen(menuitem->palette.light().color());
p->drawText(vTextRect.adjusted(1,1,1,1), text_flags, s.left(t));
p->setPen(textColor);
@@ -2202,7 +2213,7 @@ void QWindowsXPStyle::drawControl(ControlElement element, const QStyleOption *op
newMI.state = dis ? State_None : State_Enabled;
if (act)
newMI.palette.setColor(QPalette::ButtonText, newMI.palette.highlightedText().color());
- drawPrimitive(arrow, &newMI, p, widget);
+ proxy()->drawPrimitive(arrow, &newMI, p, widget);
}
}
return;
@@ -2219,10 +2230,10 @@ void QWindowsXPStyle::drawControl(ControlElement element, const QStyleOption *op
QBrush fill = mbi->palette.brush(act ? QPalette::Highlight : QPalette::Button);
QPalette::ColorRole textRole = dis ? QPalette::Text:
act ? QPalette::HighlightedText : QPalette::ButtonText;
- QPixmap pix = mbi->icon.pixmap(pixelMetric(PM_SmallIconSize, option, widget), QIcon::Normal);
+ QPixmap pix = mbi->icon.pixmap(proxy()->pixelMetric(PM_SmallIconSize, option, widget), QIcon::Normal);
uint alignment = Qt::AlignCenter | Qt::TextShowMnemonic | Qt::TextDontClip | Qt::TextSingleLine;
- if (!styleHint(SH_UnderlineShortcut, mbi, widget))
+ if (!proxy()->styleHint(SH_UnderlineShortcut, mbi, widget))
alignment |= Qt::TextHideMnemonic;
p->fillRect(rect, fill);
@@ -2237,8 +2248,8 @@ void QWindowsXPStyle::drawControl(ControlElement element, const QStyleOption *op
if (const QStyleOptionDockWidget *dwOpt = qstyleoption_cast<const QStyleOptionDockWidget *>(option))
{
int buttonMargin = 4;
- int mw = pixelMetric(QStyle::PM_DockWidgetTitleMargin, dwOpt, widget);
- int fw = pixelMetric(PM_DockWidgetFrameWidth, dwOpt, widget);
+ int mw = proxy()->pixelMetric(QStyle::PM_DockWidgetTitleMargin, dwOpt, widget);
+ int fw = proxy()->pixelMetric(PM_DockWidgetFrameWidth, dwOpt, widget);
bool isFloating = widget && widget->isWindow();
bool isActive = dwOpt->state & State_Active;
@@ -2259,18 +2270,18 @@ void QWindowsXPStyle::drawControl(ControlElement element, const QStyleOption *op
QRect titleRect = r;
if (dwOpt->closable) {
- QSize sz = standardIcon(QStyle::SP_TitleBarCloseButton, dwOpt, widget).actualSize(QSize(10, 10));
+ QSize sz = proxy()->standardIcon(QStyle::SP_TitleBarCloseButton, dwOpt, widget).actualSize(QSize(10, 10));
titleRect.adjust(0, 0, -sz.width() - mw - buttonMargin, 0);
}
if (dwOpt->floatable) {
- QSize sz = standardIcon(QStyle::SP_TitleBarMaxButton, dwOpt, widget).actualSize(QSize(10, 10));
+ QSize sz = proxy()->standardIcon(QStyle::SP_TitleBarMaxButton, dwOpt, widget).actualSize(QSize(10, 10));
titleRect.adjust(0, 0, -sz.width() - mw - buttonMargin, 0);
}
if (isFloating) {
titleRect.adjust(0, -fw, 0, 0);
- if (widget != 0 && widget->windowIcon().cacheKey() != qApp->windowIcon().cacheKey())
+ if (widget != 0 && widget->windowIcon().cacheKey() != QApplication::windowIcon().cacheKey())
titleRect.adjust(titleRect.height() + mw, 0, 0, 0);
} else {
titleRect.adjust(mw, 0, 0, 0);
@@ -2317,10 +2328,10 @@ void QWindowsXPStyle::drawControl(ControlElement element, const QStyleOption *op
// Figure out maximal button space on title bar
QIcon ico = widget->windowIcon();
- bool hasIcon = (ico.cacheKey() != qApp->windowIcon().cacheKey());
+ bool hasIcon = (ico.cacheKey() != QApplication::windowIcon().cacheKey());
if (hasIcon) {
QPixmap pxIco = ico.pixmap(titleHeight);
- if (!verticalTitleBar && QApplication::layoutDirection() == Qt::RightToLeft)
+ if (!verticalTitleBar && dwOpt->direction == Qt::RightToLeft)
p->drawPixmap(rect.width() - titleHeight - pxIco.width(), rect.bottom() - titleHeight - 2, pxIco);
else
p->drawPixmap(fw, rect.bottom() - titleHeight - 2, pxIco);
@@ -2450,7 +2461,7 @@ void QWindowsXPStyle::drawComplexControl(ComplexControl cc, const QStyleOptionCo
d->drawBackground(ftheme);
}
if (sub & SC_SpinBoxUp) {
- theme.rect = subControlRect(CC_SpinBox, option, SC_SpinBoxUp, widget);
+ theme.rect = proxy()->subControlRect(CC_SpinBox, option, SC_SpinBoxUp, widget);
partId = SPNP_UP;
if (!(sb->stepEnabled & QAbstractSpinBox::StepUpEnabled) || !(flags & State_Enabled))
stateId = UPS_DISABLED;
@@ -2465,7 +2476,7 @@ void QWindowsXPStyle::drawComplexControl(ComplexControl cc, const QStyleOptionCo
d->drawBackground(theme);
}
if (sub & SC_SpinBoxDown) {
- theme.rect = subControlRect(CC_SpinBox, option, SC_SpinBoxDown, widget);
+ theme.rect = proxy()->subControlRect(CC_SpinBox, option, SC_SpinBoxDown, widget);
partId = SPNP_DOWN;
if (!(sb->stepEnabled & QAbstractSpinBox::StepDownEnabled) || !(flags & State_Enabled))
stateId = DNS_DISABLED;
@@ -2502,7 +2513,7 @@ void QWindowsXPStyle::drawComplexControl(ComplexControl cc, const QStyleOptionCo
p->fillRect(option->rect, editBrush);
}
if (!cmb->editable) {
- QRect re = subControlRect(CC_ComboBox, option, SC_ComboBoxEditField, widget);
+ QRect re = proxy()->subControlRect(CC_ComboBox, option, SC_ComboBoxEditField, widget);
if (option->state & State_HasFocus) {
p->fillRect(re, option->palette.highlight());
p->setPen(option->palette.highlightedText().color());
@@ -2517,7 +2528,7 @@ void QWindowsXPStyle::drawComplexControl(ComplexControl cc, const QStyleOptionCo
if (sub & SC_ComboBoxArrow) {
XPThemeData theme(widget, p, QLatin1String("COMBOBOX"));
- theme.rect = subControlRect(CC_ComboBox, option, SC_ComboBoxArrow, widget);
+ theme.rect = proxy()->subControlRect(CC_ComboBox, option, SC_ComboBoxArrow, widget);
partId = CP_DROPDOWNBUTTON;
if (!(flags & State_Enabled))
stateId = CBXS_DISABLED;
@@ -2545,7 +2556,7 @@ void QWindowsXPStyle::drawComplexControl(ComplexControl cc, const QStyleOptionCo
bool isHorz = flags & State_Horizontal;
bool isRTL = option->direction == Qt::RightToLeft;
if (sub & SC_ScrollBarAddLine) {
- theme.rect = subControlRect(CC_ScrollBar, option, SC_ScrollBarAddLine, widget);
+ theme.rect = proxy()->subControlRect(CC_ScrollBar, option, SC_ScrollBarAddLine, widget);
partId = SBP_ARROWBTN;
if (!(flags & State_Enabled))
stateId = (isHorz ? (isRTL ? ABS_LEFTDISABLED : ABS_RIGHTDISABLED) : ABS_DOWNDISABLED);
@@ -2560,7 +2571,7 @@ void QWindowsXPStyle::drawComplexControl(ComplexControl cc, const QStyleOptionCo
d->drawBackground(theme);
}
if (sub & SC_ScrollBarSubLine) {
- theme.rect = subControlRect(CC_ScrollBar, option, SC_ScrollBarSubLine, widget);
+ theme.rect = proxy()->subControlRect(CC_ScrollBar, option, SC_ScrollBarSubLine, widget);
partId = SBP_ARROWBTN;
if (!(flags & State_Enabled))
stateId = (isHorz ? (isRTL ? ABS_RIGHTDISABLED : ABS_LEFTDISABLED) : ABS_UPDISABLED);
@@ -2575,9 +2586,9 @@ void QWindowsXPStyle::drawComplexControl(ComplexControl cc, const QStyleOptionCo
d->drawBackground(theme);
}
if (maxedOut) {
- theme.rect = subControlRect(CC_ScrollBar, option, SC_ScrollBarSlider, widget);
- theme.rect = theme.rect.united(subControlRect(CC_ScrollBar, option, SC_ScrollBarSubPage, widget));
- theme.rect = theme.rect.united(subControlRect(CC_ScrollBar, option, SC_ScrollBarAddPage, widget));
+ theme.rect = proxy()->subControlRect(CC_ScrollBar, option, SC_ScrollBarSlider, widget);
+ theme.rect = theme.rect.united(proxy()->subControlRect(CC_ScrollBar, option, SC_ScrollBarSubPage, widget));
+ theme.rect = theme.rect.united(proxy()->subControlRect(CC_ScrollBar, option, SC_ScrollBarAddPage, widget));
partId = scrollbar->orientation == Qt::Horizontal ? SBP_LOWERTRACKHORZ : SBP_LOWERTRACKVERT;
stateId = SCRBS_DISABLED;
theme.partId = partId;
@@ -2585,7 +2596,7 @@ void QWindowsXPStyle::drawComplexControl(ComplexControl cc, const QStyleOptionCo
d->drawBackground(theme);
} else {
if (sub & SC_ScrollBarSubPage) {
- theme.rect = subControlRect(CC_ScrollBar, option, SC_ScrollBarSubPage, widget);
+ theme.rect = proxy()->subControlRect(CC_ScrollBar, option, SC_ScrollBarSubPage, widget);
partId = flags & State_Horizontal ? SBP_UPPERTRACKHORZ : SBP_UPPERTRACKVERT;
if (!(flags & State_Enabled))
stateId = SCRBS_DISABLED;
@@ -2600,7 +2611,7 @@ void QWindowsXPStyle::drawComplexControl(ComplexControl cc, const QStyleOptionCo
d->drawBackground(theme);
}
if (sub & SC_ScrollBarAddPage) {
- theme.rect = subControlRect(CC_ScrollBar, option, SC_ScrollBarAddPage, widget);
+ theme.rect = proxy()->subControlRect(CC_ScrollBar, option, SC_ScrollBarAddPage, widget);
partId = flags & State_Horizontal ? SBP_LOWERTRACKHORZ : SBP_LOWERTRACKVERT;
if (!(flags & State_Enabled))
stateId = SCRBS_DISABLED;
@@ -2615,7 +2626,7 @@ void QWindowsXPStyle::drawComplexControl(ComplexControl cc, const QStyleOptionCo
d->drawBackground(theme);
}
if (sub & SC_ScrollBarSlider) {
- theme.rect = subControlRect(CC_ScrollBar, option, SC_ScrollBarSlider, widget);
+ theme.rect = proxy()->subControlRect(CC_ScrollBar, option, SC_ScrollBarSlider, widget);
if (!(flags & State_Enabled))
stateId = SCRBS_DISABLED;
else if (scrollbar->activeSubControls & SC_ScrollBarSlider && (scrollbar->state & State_Sunken))
@@ -2626,7 +2637,7 @@ void QWindowsXPStyle::drawComplexControl(ComplexControl cc, const QStyleOptionCo
stateId = SCRBS_NORMAL;
// Draw handle
- theme.rect = subControlRect(CC_ScrollBar, option, SC_ScrollBarSlider, widget);
+ theme.rect = proxy()->subControlRect(CC_ScrollBar, option, SC_ScrollBarSlider, widget);
theme.partId = flags & State_Horizontal ? SBP_THUMBBTNHORZ : SBP_THUMBBTNVERT;
theme.stateId = stateId;
d->drawBackground(theme);
@@ -2661,11 +2672,8 @@ void QWindowsXPStyle::drawComplexControl(ComplexControl cc, const QStyleOptionCo
// Draw gripper if there is enough space
if (!gripperBounds.isEmpty()) {
p->save();
- XPThemeData grippBackground = theme;
- grippBackground.partId = flags & State_Horizontal ? SBP_LOWERTRACKHORZ : SBP_LOWERTRACKVERT;
theme.rect = gripperBounds;
p->setClipRegion(d->region(theme));// Only change inside the region of the gripper
- d->drawBackground(grippBackground);// The gutter is the grippers background
d->drawBackground(theme); // Transparent gripper ontop of background
p->restore();
}
@@ -2682,7 +2690,7 @@ void QWindowsXPStyle::drawComplexControl(ComplexControl cc, const QStyleOptionCo
QRect slrect = slider->rect;
QRegion tickreg = slrect;
if (sub & SC_SliderGroove) {
- theme.rect = subControlRect(CC_Slider, option, SC_SliderGroove, widget);
+ theme.rect = proxy()->subControlRect(CC_Slider, option, SC_SliderGroove, widget);
if (slider->orientation == Qt::Horizontal) {
partId = TKP_TRACK;
stateId = TRS_NORMAL;
@@ -2698,11 +2706,11 @@ void QWindowsXPStyle::drawComplexControl(ComplexControl cc, const QStyleOptionCo
tickreg -= theme.rect;
}
if (sub & SC_SliderTickmarks) {
- int tickOffset = pixelMetric(PM_SliderTickmarkOffset, slider, widget);
+ int tickOffset = proxy()->pixelMetric(PM_SliderTickmarkOffset, slider, widget);
int ticks = slider->tickPosition;
- int thickness = pixelMetric(PM_SliderControlThickness, slider, widget);
- int len = pixelMetric(PM_SliderLength, slider, widget);
- int available = pixelMetric(PM_SliderSpaceAvailable, slider, widget);
+ int thickness = proxy()->pixelMetric(PM_SliderControlThickness, slider, widget);
+ int len = proxy()->pixelMetric(PM_SliderLength, slider, widget);
+ int available = proxy()->pixelMetric(PM_SliderSpaceAvailable, slider, widget);
int interval = slider->tickInterval;
if (interval <= 0) {
interval = slider->singleStep;
@@ -2758,7 +2766,7 @@ void QWindowsXPStyle::drawComplexControl(ComplexControl cc, const QStyleOptionCo
}
}
if (sub & SC_SliderHandle) {
- theme.rect = subControlRect(CC_Slider, option, SC_SliderHandle, widget);
+ theme.rect = proxy()->subControlRect(CC_Slider, option, SC_SliderHandle, widget);
if (slider->orientation == Qt::Horizontal) {
if (slider->tickPosition == QSlider::TicksAbove)
partId = TKP_THUMBTOP;
@@ -2804,7 +2812,7 @@ void QWindowsXPStyle::drawComplexControl(ComplexControl cc, const QStyleOptionCo
QStyleOptionFocusRect fropt;
fropt.QStyleOption::operator=(*slider);
fropt.rect = subElementRect(SE_SliderFocusRect, slider, widget);
- drawPrimitive(PE_FrameFocusRect, &fropt, p, widget);
+ proxy()->drawPrimitive(PE_FrameFocusRect, &fropt, p, widget);
}
}
break;
@@ -2814,8 +2822,8 @@ void QWindowsXPStyle::drawComplexControl(ComplexControl cc, const QStyleOptionCo
if (const QStyleOptionToolButton *toolbutton
= qstyleoption_cast<const QStyleOptionToolButton *>(option)) {
QRect button, menuarea;
- button = subControlRect(cc, toolbutton, SC_ToolButton, widget);
- menuarea = subControlRect(cc, toolbutton, SC_ToolButtonMenu, widget);
+ button = proxy()->subControlRect(cc, toolbutton, SC_ToolButton, widget);
+ menuarea = proxy()->subControlRect(cc, toolbutton, SC_ToolButtonMenu, widget);
State bflags = toolbutton->state & ~State_Sunken;
State mflags = bflags;
@@ -2863,9 +2871,9 @@ void QWindowsXPStyle::drawComplexControl(ComplexControl cc, const QStyleOptionCo
tool.state = bflags;
if (widget && !qobject_cast<QToolBar*>(widget->parentWidget())
&& !(bflags & State_AutoRaise))
- drawPrimitive(PE_PanelButtonBevel, &tool, p, widget);
+ proxy()->drawPrimitive(PE_PanelButtonBevel, &tool, p, widget);
else
- drawPrimitive(PE_PanelButtonTool, &tool, p, widget);
+ proxy()->drawPrimitive(PE_PanelButtonTool, &tool, p, widget);
}
}
}
@@ -2875,26 +2883,26 @@ void QWindowsXPStyle::drawComplexControl(ComplexControl cc, const QStyleOptionCo
fr.QStyleOption::operator=(*toolbutton);
fr.rect.adjust(3, 3, -3, -3);
if (toolbutton->features & QStyleOptionToolButton::MenuButtonPopup)
- fr.rect.adjust(0, 0, -pixelMetric(QStyle::PM_MenuButtonIndicator,
+ fr.rect.adjust(0, 0, -proxy()->pixelMetric(QStyle::PM_MenuButtonIndicator,
toolbutton, widget), 0);
- drawPrimitive(PE_FrameFocusRect, &fr, p, widget);
+ proxy()->drawPrimitive(PE_FrameFocusRect, &fr, p, widget);
}
QStyleOptionToolButton label = *toolbutton;
label.state = bflags;
int fw = 2;
label.rect = button.adjusted(fw, fw, -fw, -fw);
- drawControl(CE_ToolButtonLabel, &label, p, widget);
+ proxy()->drawControl(CE_ToolButtonLabel, &label, p, widget);
if (toolbutton->subControls & SC_ToolButtonMenu) {
tool.rect = menuarea;
tool.state = mflags;
- drawPrimitive(PE_IndicatorButtonDropDown, &tool, p, widget);
+ proxy()->drawPrimitive(PE_IndicatorButtonDropDown, &tool, p, widget);
} else if (toolbutton->features & QStyleOptionToolButton::HasMenu) {
- int mbi = pixelMetric(PM_MenuButtonIndicator, toolbutton, widget);
+ int mbi = proxy()->pixelMetric(PM_MenuButtonIndicator, toolbutton, widget);
QRect ir = toolbutton->rect;
QStyleOptionToolButton newBtn = *toolbutton;
newBtn.rect = QRect(ir.right() + 4 - mbi, ir.height() - mbi + 4, mbi - 5, mbi - 5);
- drawPrimitive(PE_IndicatorArrowDown, &newBtn, p, widget);
+ proxy()->drawPrimitive(PE_IndicatorArrowDown, &newBtn, p, widget);
}
}
break;
@@ -2926,7 +2934,7 @@ void QWindowsXPStyle::drawComplexControl(ComplexControl cc, const QStyleOptionCo
theme.stateId = stateId;
d->drawBackground(theme);
- QRect ir = subControlRect(CC_TitleBar, tb, SC_TitleBarLabel, widget);
+ QRect ir = proxy()->subControlRect(CC_TitleBar, tb, SC_TitleBarLabel, widget);
int result = TST_NONE;
pGetThemeEnumValue(theme.handle(), WP_CAPTION, isActive ? CS_ACTIVE : CS_INACTIVE, TMT_TEXTSHADOWTYPE, &result);
@@ -2945,7 +2953,7 @@ void QWindowsXPStyle::drawComplexControl(ComplexControl cc, const QStyleOptionCo
Qt::AlignLeft | Qt::AlignVCenter | Qt::TextSingleLine, tb->text);
}
if (sub & SC_TitleBarSysMenu && tb->titleBarFlags & Qt::WindowSystemMenuHint) {
- theme.rect = subControlRect(CC_TitleBar, option, SC_TitleBarSysMenu, widget);
+ theme.rect = proxy()->subControlRect(CC_TitleBar, option, SC_TitleBarSysMenu, widget);
partId = WP_SYSBUTTON;
if ((widget && !widget->isEnabled()) || !isActive)
stateId = SBS_DISABLED;
@@ -2963,8 +2971,8 @@ void QWindowsXPStyle::drawComplexControl(ComplexControl cc, const QStyleOptionCo
SIZE sz;
pGetThemePartSize(theme.handle(), qt_win_display_dc(), theme.partId, theme.stateId, 0, TS_TRUE, &sz);
if (sz.cx == 0 || sz.cy == 0) {
- int iconSize = pixelMetric(PM_SmallIconSize, tb, widget);
- QPixmap pm = standardIcon(SP_TitleBarMenuButton, tb, widget).pixmap(iconSize, iconSize);
+ int iconSize = proxy()->pixelMetric(PM_SmallIconSize, tb, widget);
+ QPixmap pm = proxy()->standardIcon(SP_TitleBarMenuButton, tb, widget).pixmap(iconSize, iconSize);
p->save();
drawItemPixmap(p, theme.rect, Qt::AlignCenter, pm);
p->restore();
@@ -2976,7 +2984,7 @@ void QWindowsXPStyle::drawComplexControl(ComplexControl cc, const QStyleOptionCo
if (sub & SC_TitleBarMinButton && tb->titleBarFlags & Qt::WindowMinimizeButtonHint
&& !(tb->titleBarState & Qt::WindowMinimized)) {
- theme.rect = subControlRect(CC_TitleBar, option, SC_TitleBarMinButton, widget);
+ theme.rect = proxy()->subControlRect(CC_TitleBar, option, SC_TitleBarMinButton, widget);
partId = WP_MINBUTTON;
if (widget && !widget->isEnabled())
stateId = MINBS_DISABLED;
@@ -2994,7 +3002,7 @@ void QWindowsXPStyle::drawComplexControl(ComplexControl cc, const QStyleOptionCo
}
if (sub & SC_TitleBarMaxButton && tb->titleBarFlags & Qt::WindowMaximizeButtonHint
&& !(tb->titleBarState & Qt::WindowMaximized)) {
- theme.rect = subControlRect(CC_TitleBar, option, SC_TitleBarMaxButton, widget);
+ theme.rect = proxy()->subControlRect(CC_TitleBar, option, SC_TitleBarMaxButton, widget);
partId = WP_MAXBUTTON;
if (widget && !widget->isEnabled())
stateId = MAXBS_DISABLED;
@@ -3012,7 +3020,7 @@ void QWindowsXPStyle::drawComplexControl(ComplexControl cc, const QStyleOptionCo
}
if (sub & SC_TitleBarContextHelpButton
&& tb->titleBarFlags & Qt::WindowContextHelpButtonHint) {
- theme.rect = subControlRect(CC_TitleBar, option, SC_TitleBarContextHelpButton, widget);
+ theme.rect = proxy()->subControlRect(CC_TitleBar, option, SC_TitleBarContextHelpButton, widget);
partId = WP_HELPBUTTON;
if (widget && !widget->isEnabled())
stateId = MINBS_DISABLED;
@@ -3034,7 +3042,7 @@ void QWindowsXPStyle::drawComplexControl(ComplexControl cc, const QStyleOptionCo
|| ((tb->titleBarFlags & Qt::WindowMaximizeButtonHint)
&& (tb->titleBarState & Qt::WindowMaximized)));
if (drawNormalButton) {
- theme.rect = subControlRect(CC_TitleBar, option, SC_TitleBarNormalButton, widget);
+ theme.rect = proxy()->subControlRect(CC_TitleBar, option, SC_TitleBarNormalButton, widget);
partId = WP_RESTOREBUTTON;
if (widget && !widget->isEnabled())
stateId = RBS_DISABLED;
@@ -3052,7 +3060,7 @@ void QWindowsXPStyle::drawComplexControl(ComplexControl cc, const QStyleOptionCo
}
if (sub & SC_TitleBarShadeButton && tb->titleBarFlags & Qt::WindowShadeButtonHint
&& !(tb->titleBarState & Qt::WindowMinimized)) {
- theme.rect = subControlRect(CC_TitleBar, option, SC_TitleBarShadeButton, widget);
+ theme.rect = proxy()->subControlRect(CC_TitleBar, option, SC_TitleBarShadeButton, widget);
partId = WP_MINBUTTON;
if (widget && !widget->isEnabled())
stateId = MINBS_DISABLED;
@@ -3070,7 +3078,7 @@ void QWindowsXPStyle::drawComplexControl(ComplexControl cc, const QStyleOptionCo
}
if (sub & SC_TitleBarUnshadeButton && tb->titleBarFlags & Qt::WindowShadeButtonHint
&& tb->titleBarState & Qt::WindowMinimized) {
- theme.rect = subControlRect(CC_TitleBar, option, SC_TitleBarUnshadeButton, widget);
+ theme.rect = proxy()->subControlRect(CC_TitleBar, option, SC_TitleBarUnshadeButton, widget);
partId = WP_RESTOREBUTTON;
if (widget && !widget->isEnabled())
stateId = RBS_DISABLED;
@@ -3087,7 +3095,7 @@ void QWindowsXPStyle::drawComplexControl(ComplexControl cc, const QStyleOptionCo
d->drawBackground(theme);
}
if (sub & SC_TitleBarCloseButton && tb->titleBarFlags & Qt::WindowSystemMenuHint) {
- theme.rect = subControlRect(CC_TitleBar, option, SC_TitleBarCloseButton, widget);
+ theme.rect = proxy()->subControlRect(CC_TitleBar, option, SC_TitleBarCloseButton, widget);
//partId = titlebar->testWFlags(Qt::WA_WState_Tool) ? WP_SMALLCLOSEBUTTON : WP_CLOSEBUTTON;
partId = WP_CLOSEBUTTON;
if (widget && !widget->isEnabled())
@@ -3115,7 +3123,7 @@ void QWindowsXPStyle::drawComplexControl(ComplexControl cc, const QStyleOptionCo
XPThemeData theme(widget, p, QLatin1String("WINDOW"), WP_MDICLOSEBUTTON, CBS_NORMAL);
if (option->subControls & SC_MdiCloseButton) {
- buttonRect = subControlRect(CC_MdiControls, option, SC_MdiCloseButton, widget);
+ buttonRect = proxy()->subControlRect(CC_MdiControls, option, SC_MdiCloseButton, widget);
if (theme.isValid()) {
theme.partId = WP_MDICLOSEBUTTON;
theme.rect = buttonRect;
@@ -3131,7 +3139,7 @@ void QWindowsXPStyle::drawComplexControl(ComplexControl cc, const QStyleOptionCo
}
}
if (option->subControls & SC_MdiNormalButton) {
- buttonRect = subControlRect(CC_MdiControls, option, SC_MdiNormalButton, widget);
+ buttonRect = proxy()->subControlRect(CC_MdiControls, option, SC_MdiNormalButton, widget);
if (theme.isValid()) {
theme.partId = WP_MDIRESTOREBUTTON;
theme.rect = buttonRect;
@@ -3147,7 +3155,7 @@ void QWindowsXPStyle::drawComplexControl(ComplexControl cc, const QStyleOptionCo
}
}
if (option->subControls & QStyle::SC_MdiMinButton) {
- buttonRect = subControlRect(CC_MdiControls, option, SC_MdiMinButton, widget);
+ buttonRect = proxy()->subControlRect(CC_MdiControls, option, SC_MdiMinButton, widget);
if (theme.isValid()) {
theme.partId = WP_MDIMINBUTTON;
theme.rect = buttonRect;
@@ -3165,6 +3173,12 @@ void QWindowsXPStyle::drawComplexControl(ComplexControl cc, const QStyleOptionCo
}
break;
#endif //QT_NO_WORKSPACE
+#ifndef QT_NO_DIAL
+ case CC_Dial:
+ if (const QStyleOptionSlider *dial = qstyleoption_cast<const QStyleOptionSlider *>(option))
+ QStyleHelper::drawDial(dial, p);
+ break;
+#endif // QT_NO_DIAL
default:
QWindowsStyle::drawComplexControl(cc, option, p, widget);
break;
@@ -3224,7 +3238,7 @@ int QWindowsXPStyle::pixelMetric(PixelMetric pm, const QStyleOption *option, con
break;
case PM_SplitterWidth:
- res = qMax(5, QApplication::globalStrut().width());
+ res = qMax(int(QStyleHelper::dpiScaled(5.)), QApplication::globalStrut().width());
break;
case PM_IndicatorWidth:
@@ -3234,7 +3248,7 @@ int QWindowsXPStyle::pixelMetric(PixelMetric pm, const QStyleOption *option, con
if (theme.isValid()) {
SIZE size;
pGetThemePartSize(theme.handle(), 0, theme.partId, theme.stateId, 0, TS_TRUE, &size);
- res = (pm == PM_IndicatorWidth ? size.cx+2 : res = size.cy+2);
+ res = (pm == PM_IndicatorWidth) ? size.cx : size.cy;
}
}
break;
@@ -3246,7 +3260,7 @@ int QWindowsXPStyle::pixelMetric(PixelMetric pm, const QStyleOption *option, con
if (theme.isValid()) {
SIZE size;
pGetThemePartSize(theme.handle(), 0, theme.partId, theme.stateId, 0, TS_TRUE, &size);
- res = (pm == PM_ExclusiveIndicatorWidth ? size.cx+2 : res = size.cy+2);
+ res = (pm == PM_ExclusiveIndicatorWidth) ? size.cx : size.cy;
}
}
break;
@@ -3318,7 +3332,7 @@ int QWindowsXPStyle::pixelMetric(PixelMetric pm, const QStyleOption *option, con
#ifndef QT_NO_TOOLBAR
case PM_ToolBarHandleExtent:
- res = 8;
+ res = int(QStyleHelper::dpiScaled(8.));
break;
#endif // QT_NO_TOOLBAR
@@ -3333,10 +3347,10 @@ int QWindowsXPStyle::pixelMetric(PixelMetric pm, const QStyleOption *option, con
}
break;
case PM_DockWidgetSeparatorExtent:
- res = 4;
+ res = int(QStyleHelper::dpiScaled(4.));
break;
case PM_DockWidgetTitleMargin:
- res = 4;
+ res = int(QStyleHelper::dpiScaled(4.));
break;
case PM_ButtonShiftHorizontal:
@@ -3347,6 +3361,10 @@ int QWindowsXPStyle::pixelMetric(PixelMetric pm, const QStyleOption *option, con
res = 0;
break;
+ case PM_ButtonDefaultIndicator:
+ res = 0;
+ break;
+
default:
res = QWindowsStyle::pixelMetric(pm, option, widget);
}
@@ -3428,7 +3446,7 @@ QRect QWindowsXPStyle::subControlRect(ComplexControl cc, const QStyleOptionCompl
int buttonWidth = GetSystemMetrics(SM_CXSIZE) - 4;
const int delta = buttonWidth + 2;
int controlTop = option->rect.bottom() - buttonHeight - 2;
- const int frameWidth = pixelMetric(PM_MdiSubWindowFrameWidth, option, widget);
+ const int frameWidth = proxy()->pixelMetric(PM_MdiSubWindowFrameWidth, option, widget);
const bool sysmenuHint = (tb->titleBarFlags & Qt::WindowSystemMenuHint) != 0;
const bool minimizeHint = (tb->titleBarFlags & Qt::WindowMinimizeButtonHint) != 0;
const bool maximizeHint = (tb->titleBarFlags & Qt::WindowMaximizeButtonHint) != 0;
@@ -3513,7 +3531,7 @@ QRect QWindowsXPStyle::subControlRect(ComplexControl cc, const QStyleOptionCompl
{
const int controlTop = 6;
const int controlHeight = height - controlTop - 3;
- const int iconExtent = pixelMetric(PM_SmallIconSize);
+ const int iconExtent = proxy()->pixelMetric(PM_SmallIconSize);
QSize iconSize = tb->icon.actualSize(QSize(iconExtent, iconExtent));
if (tb->icon.isNull())
iconSize = QSize(controlHeight, controlHeight);
@@ -3522,6 +3540,8 @@ QRect QWindowsXPStyle::subControlRect(ComplexControl cc, const QStyleOptionCompl
rect = QRect(frameWidth + hPad, controlTop + vPad, iconSize.width(), iconSize.height());
}
break;
+ default:
+ break;
}
}
break;
@@ -3548,6 +3568,9 @@ QRect QWindowsXPStyle::subControlRect(ComplexControl cc, const QStyleOptionCompl
case SC_ComboBoxListBoxPopup:
rect = cmb->rect;
break;
+
+ default:
+ break;
}
}
break;
@@ -3635,7 +3658,7 @@ QSize QWindowsXPStyle::sizeFromContents(ContentsType ct, const QStyleOption *opt
{
//Spinbox adds frame twice
sz = QWindowsStyle::sizeFromContents(ct, option, contentsSize, widget);
- int border = pixelMetric(PM_SpinBoxFrameWidth, option, widget);
+ int border = proxy()->pixelMetric(PM_SpinBoxFrameWidth, option, widget);
sz -= QSize(2*border, 2*border);
}
break;
@@ -3789,6 +3812,8 @@ QPixmap QWindowsXPStyle::standardPixmap(StandardPixmap standardPixmap, const QSt
}
}
break;
+ default:
+ break;
}
return QWindowsStyle::standardPixmap(standardPixmap, option, widget);
}
@@ -3910,6 +3935,8 @@ QIcon QWindowsXPStyle::standardIconImplementation(StandardPixmap standardIcon,
}
break;
+ default:
+ break;
}
return QWindowsStyle::standardIconImplementation(standardIcon, option, widget);
diff --git a/src/gui/styles/qwindowsxpstyle.h b/src/gui/styles/qwindowsxpstyle.h
index b4c87ed..6448f02 100644
--- a/src/gui/styles/qwindowsxpstyle.h
+++ b/src/gui/styles/qwindowsxpstyle.h
@@ -1,7 +1,6 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the QtGui module of the Qt Toolkit.
@@ -21,9 +20,10 @@
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.1, included in the file LGPL_EXCEPTION.txt in this
+** package.
**
** If you have questions regarding the use of this file, please contact
** Nokia at qt-info@nokia.com.
diff --git a/src/gui/styles/qwindowsxpstyle_p.h b/src/gui/styles/qwindowsxpstyle_p.h
index 652d0e1..efbedb8 100644
--- a/src/gui/styles/qwindowsxpstyle_p.h
+++ b/src/gui/styles/qwindowsxpstyle_p.h
@@ -1,7 +1,6 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the QtGui module of the Qt Toolkit.
@@ -21,9 +20,10 @@
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.1, included in the file LGPL_EXCEPTION.txt in this
+** package.
**
** If you have questions regarding the use of this file, please contact
** Nokia at qt-info@nokia.com.
diff --git a/src/gui/styles/styles.pri b/src/gui/styles/styles.pri
index 376f834..767ade0 100644
--- a/src/gui/styles/styles.pri
+++ b/src/gui/styles/styles.pri
@@ -7,13 +7,19 @@ HEADERS += \
styles/qstyleplugin.h \
styles/qcommonstylepixmaps_p.h \
styles/qcommonstyle.h \
+ styles/qstylehelper_p.h \
+ styles/qproxystyle.h \
+ styles/qproxystyle_p.h \
styles/qstylesheetstyle_p.h
+
SOURCES += \
styles/qstyle.cpp \
styles/qstylefactory.cpp \
styles/qstyleoption.cpp \
styles/qstyleplugin.cpp \
+ styles/qstylehelper.cpp \
styles/qcommonstyle.cpp \
+ styles/qproxystyle.cpp \
styles/qstylesheetstyle.cpp \
styles/qstylesheetstyle_default.cpp
@@ -31,7 +37,7 @@ x11|embedded|!macx-*:styles -= mac
x11{
QMAKE_CXXFLAGS += $$QT_CFLAGS_QGTKSTYLE
- LIBS += $$QT_LIBS_QGTKSTYLE
+ LIBS_PRIVATE += $$QT_LIBS_QGTKSTYLE
styles += gtk
}
@@ -155,3 +161,18 @@ contains( styles, windowsmobile ) {
DEFINES += QT_NO_STYLE_WINDOWSMOBILE
}
+contains( styles, s60 ):contains(QT_CONFIG, s60) {
+ HEADERS += \
+ styles/qs60style.h \
+ styles/qs60style_p.h
+ SOURCES += styles/qs60style.cpp
+ symbian {
+ SOURCES += styles/qs60style_s60.cpp
+ LIBS += -laknicon -laknskins -laknskinsrv -lfontutils
+ } else {
+ SOURCES += styles/qs60style_simulated.cpp
+ RESOURCES += styles/qstyle_s60_simulated.qrc
+ }
+} else {
+ DEFINES += QT_NO_STYLE_S60
+}