* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
+ * License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
#include "config.h"
+
#include "gtkcombobox.h"
+
+#include "gtkadjustment.h"
#include "gtkcellareabox.h"
#include "gtktreemenu.h"
#include "gtkarrow.h"
#include "gtktogglebutton.h"
#include "gtktreeselection.h"
#include "gtkseparator.h"
+#include "gtkwidgetpath.h"
+#include "gtkwidgetprivate.h"
#include "gtkwindow.h"
#include "gtktypebuiltins.h"
#include "gtkprivate.h"
gint *natural_size);
static GtkWidgetPath *gtk_combo_box_get_path_for_child (GtkContainer *container,
GtkWidget *child);
-static void gtk_combo_box_direction_changed (GtkWidget *widget,
- GtkTextDirection previous_direction);
G_DEFINE_TYPE_WITH_CODE (GtkComboBox, gtk_combo_box, GTK_TYPE_BIN,
G_IMPLEMENT_INTERFACE (GTK_TYPE_CELL_LAYOUT,
widget_class->get_preferred_height_for_width = gtk_combo_box_get_preferred_height_for_width;
widget_class->get_preferred_width_for_height = gtk_combo_box_get_preferred_width_for_height;
widget_class->destroy = gtk_combo_box_destroy;
- widget_class->direction_changed = gtk_combo_box_direction_changed;
object_class = (GObjectClass *)klass;
object_class->constructor = gtk_combo_box_constructor;
gtk_widget_queue_draw (widget);
}
-static void
-gtk_combo_box_invalidate_order (GtkComboBox *combo_box)
-{
- gtk_container_forall (GTK_CONTAINER (combo_box),
- (GtkCallback) gtk_widget_reset_style,
- NULL);
-}
-
-static void
-gtk_combo_box_direction_changed (GtkWidget *widget,
- GtkTextDirection previous_direction)
-{
- gtk_combo_box_invalidate_order (GTK_COMBO_BOX (widget));
-}
-
static GtkWidgetPath *
gtk_combo_box_get_path_for_child (GtkContainer *container,
GtkWidget *child)
GtkWidgetPath *sibling_path;
int pos;
- path = gtk_widget_path_copy (gtk_widget_get_path (GTK_WIDGET (container)));
+ path = _gtk_widget_create_path (GTK_WIDGET (container));
if (gtk_widget_get_visible (child))
{
if (widget && gtk_widget_get_visible (widget))
visible_children = g_list_prepend (visible_children, widget);
- if (gtk_widget_get_direction (GTK_WIDGET (container)) == GTK_TEXT_DIR_RTL)
- visible_children = g_list_reverse (visible_children);
-
pos = 0;
for (l = visible_children; l; l = l->next)
gdk_window_get_root_coords (gtk_widget_get_window (child),
sx, sy, &sx, &sy);
get_widget_padding_and_border (GTK_WIDGET (combo_box), &padding);
- sx -= padding.left;
+
+ if (gtk_widget_get_direction (GTK_WIDGET (combo_box)) == GTK_TEXT_DIR_RTL)
+ sx += padding.left;
+ else
+ sx -= padding.left;
if (combo_box->priv->popup_fixed_width)
gtk_widget_get_preferred_size (GTK_WIDGET (menu), &req, NULL);
{
child.x += req.width;
child.width = allocation->x + allocation->width
- - border_width - child.x;
+ - border_width - child.x - button_padding.right;
}
else
{
priv->arrow = gtk_arrow_new (GTK_ARROW_DOWN, GTK_SHADOW_NONE);
gtk_container_add (GTK_CONTAINER (priv->box), priv->arrow);
+ gtk_widget_add_events (priv->button, GDK_SCROLL_MASK);
gtk_widget_show_all (priv->button);
}
priv->arrow = gtk_arrow_new (GTK_ARROW_DOWN, GTK_SHADOW_NONE);
gtk_container_add (GTK_CONTAINER (priv->button), priv->arrow);
+ gtk_widget_add_events (priv->button, GDK_SCROLL_MASK);
gtk_widget_show_all (priv->button);
}
gint font_size, arrow_size;
PangoContext *context;
PangoFontMetrics *metrics;
- const PangoFontDescription *font_desc;
GtkWidget *child;
gint minimum_width = 0, natural_width = 0;
gint child_min, child_nat;
- GtkStyleContext *style_context;
- GtkStateFlags state;
GtkBorder padding;
gfloat arrow_scaling;
"arrow-scaling", &arrow_scaling,
NULL);
- style_context = gtk_widget_get_style_context (widget);
- state = gtk_widget_get_state_flags (widget);
-
get_widget_padding_and_border (widget, &padding);
- font_desc = gtk_style_context_get_font (style_context, state);
context = gtk_widget_get_pango_context (GTK_WIDGET (widget));
- metrics = pango_context_get_metrics (context, font_desc,
+ metrics = pango_context_get_metrics (context,
+ pango_context_get_font_description (context),
pango_context_get_language (context));
font_size = PANGO_PIXELS (pango_font_metrics_get_ascent (metrics) +
pango_font_metrics_get_descent (metrics));