Theme engine using TQt for GTK+ 3.x
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

tdegtk-support.c 2.4KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. /* The TdeGtk Theming Engine for Gtk+.
  2. * Copyright (C) 2011 Canonical Ltd
  3. *
  4. * This library is free software; you can redistribute it and/or
  5. * modify it under the terms of the GNU Lesser General Public
  6. * License as published by the Free Software Foundation; either
  7. * version 2 of the License, or (at your option) any later version.
  8. *
  9. * This library is distributed in the hope that it will be useful,
  10. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  12. * Lesser General Public License for more details.
  13. *
  14. * You should have received a copy of the GNU Lesser General Public
  15. * License along with this library; if not, write to the Free
  16. * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
  17. * MA 02110-1301, USA.
  18. *
  19. * Authored by Andrea Cimitan <andrea.cimitan@canonical.com>
  20. *
  21. */
  22. #include <gtk/gtk.h>
  23. #include "tdegtk-engine.h"
  24. #include "tdegtk-support.h"
  25. #include "tdegtk-types.h"
  26. gboolean
  27. tdegtk_gdk_rgba_is_default (GdkRGBA *color)
  28. {
  29. GdkRGBA default_color;
  30. /* pink is default GdkRGBA color set in gtk/gtkstyleproperty.c */
  31. gdk_rgba_parse (&default_color, "pink");
  32. return gdk_rgba_equal (&default_color, color);
  33. }
  34. void
  35. tdegtk_get_line_width (GtkThemingEngine *engine,
  36. gdouble *line_width)
  37. {
  38. GtkBorder border;
  39. GtkStateFlags state;
  40. state = gtk_theming_engine_get_state (engine);
  41. gtk_theming_engine_get_border (engine, state, &border);
  42. *line_width = MIN (MIN (border.top, border.bottom),
  43. MIN (border.left, border.right));
  44. }
  45. gboolean
  46. tdegtk_gtk_border_is_zero (GtkBorder *border)
  47. {
  48. return (border->top == 0) && (border->bottom == 0) && (border->left == 0) && (border->right == 0);
  49. }
  50. void
  51. tdegtk_lookup_functions (TdeGtkEngine *engine,
  52. TdeGtkStyleFunctions **functions)
  53. {
  54. /* only one style is defined now,
  55. * add here a check for a theming engine css property,
  56. * for example -tdegtk-style, and assign new styles */
  57. if (functions)
  58. *functions = &engine->style_functions[TDEGTK_STYLE_DEFAULT];
  59. }
  60. void
  61. tdegtk_trim_scale_allocation (GtkThemingEngine *engine,
  62. gdouble *x,
  63. gdouble *y,
  64. gdouble *width,
  65. gdouble *height)
  66. {
  67. /* Do nothing! */
  68. }