};
-GtkType gtk_pixmap_menu_item_get_type (void);
+GtkType gtk_pixmap_menu_item_get_type (void);
GtkWidget* gtk_pixmap_menu_item_new (void);
void gtk_pixmap_menu_item_set_pixmap (GtkPixmapMenuItem *menu_item,
- GtkWidget *pixmap);
+ GtkWidget *pixmap);
#endif // USE_MENU_BITMAPS
guint accel_key = gtk_label_parse_uline (GTK_LABEL(label), wxGTK_CONV( text ) );
gtk_accel_label_set_accel_widget (GTK_ACCEL_LABEL (label), menuItem);
if (accel_key != GDK_VoidSymbol)
- {
+ {
gtk_widget_add_accelerator (menuItem,
- "activate_item",
- gtk_menu_ensure_uline_accel_group (GTK_MENU (m_menu)),
- accel_key, 0,
- GTK_ACCEL_LOCKED);
+ "activate_item",
+ gtk_menu_ensure_uline_accel_group (GTK_MENU (m_menu)),
+ accel_key, 0,
+ GTK_ACCEL_LOCKED);
}
gtk_widget_show (label);
// text has "_" instead of "&" after mitem->SetText() so don't use it
wxString text( mitem->GetText() );
- // buffer containing the menu text in multibyte form
- char buf[200];
- strcpy( buf, "/" );
- strncat( buf, wxGTK_CONV(text), WXSIZEOF(buf) - 2 );
- buf[WXSIZEOF(buf) - 1] = '\0';
+ // buffers containing the menu item path and type in multibyte form
+ char bufPath[256],
+ bufType[256];
+
+ strcpy( bufPath, "/" );
+ strncat( bufPath, wxGTK_CONV(text), WXSIZEOF(bufPath) - 2 );
+ bufPath[WXSIZEOF(bufPath) - 1] = '\0';
GtkItemFactoryEntry entry;
- entry.path = buf;
+ entry.path = bufPath;
entry.callback = (GtkItemFactoryCallback) gtk_menu_clicked_callback;
entry.callback_action = 0;
{
// start of a new radio group
item_type = "<RadioItem>";
- m_pathLastRadio = buf + 1;
+ m_pathLastRadio = bufPath + 1;
}
else // continue the radio group
{
pathRadio.Replace(wxT("_"), wxT(""));
pathRadio.Prepend(wxT("<main>/"));
- char buf2[200];
- strncpy(buf2, wxGTK_CONV(pathRadio), WXSIZEOF(buf2));
- buf2[WXSIZEOF(buf2) - 1] = '\0';
- item_type = buf2;
+ strncpy(bufType, wxGTK_CONV(pathRadio), WXSIZEOF(bufType));
+ bufType[WXSIZEOF(bufType) - 1] = '\0';
+ item_type = bufType;
}
// continue the existing radio group, if any
static void gtk_pixmap_menu_item_class_init (GtkPixmapMenuItemClass *klass);
static void gtk_pixmap_menu_item_init (GtkPixmapMenuItem *menu_item);
static void gtk_pixmap_menu_item_draw (GtkWidget *widget,
- GdkRectangle *area);
+ GdkRectangle *area);
static gint gtk_pixmap_menu_item_expose (GtkWidget *widget,
- GdkEventExpose *event);
+ GdkEventExpose *event);
/* we must override the following functions */
static void gtk_pixmap_menu_item_map (GtkWidget *widget);
static void gtk_pixmap_menu_item_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation);
+ GtkAllocation *allocation);
static void gtk_pixmap_menu_item_forall (GtkContainer *container,
- gboolean include_internals,
- GtkCallback callback,
- gpointer callback_data);
+ gboolean include_internals,
+ GtkCallback callback,
+ gpointer callback_data);
static void gtk_pixmap_menu_item_size_request (GtkWidget *widget,
- GtkRequisition *requisition);
+ GtkRequisition *requisition);
static void gtk_pixmap_menu_item_remove (GtkContainer *container,
- GtkWidget *child);
+ GtkWidget *child);
static void changed_have_pixmap_status (GtkPixmapMenuItem *menu_item);
};
pixmap_menu_item_type = gtk_type_unique (gtk_menu_item_get_type (),
- &pixmap_menu_item_info);
+ &pixmap_menu_item_info);
}
return pixmap_menu_item_type;
static void
gtk_pixmap_menu_item_draw (GtkWidget *widget,
- GdkRectangle *area)
+ GdkRectangle *area)
{
g_return_if_fail (widget != NULL);
g_return_if_fail (GTK_IS_PIXMAP_MENU_ITEM (widget));
static gint
gtk_pixmap_menu_item_expose (GtkWidget *widget,
- GdkEventExpose *event)
+ GdkEventExpose *event)
{
g_return_val_if_fail (widget != NULL, FALSE);
g_return_val_if_fail (GTK_IS_PIXMAP_MENU_ITEM (widget), FALSE);
void
gtk_pixmap_menu_item_set_pixmap (GtkPixmapMenuItem *menu_item,
- GtkWidget *pixmap)
+ GtkWidget *pixmap)
{
g_return_if_fail (menu_item != NULL);
g_return_if_fail (pixmap != NULL);
if (GTK_WIDGET_VISIBLE (pixmap->parent)) {
if (GTK_WIDGET_MAPPED (pixmap->parent) &&
- GTK_WIDGET_VISIBLE(pixmap) &&
+ GTK_WIDGET_VISIBLE(pixmap) &&
!GTK_WIDGET_MAPPED (pixmap))
gtk_widget_map (pixmap);
}
static void
gtk_pixmap_menu_item_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation)
+ GtkAllocation *allocation)
{
GtkPixmapMenuItem *pmenu_item;
child_allocation.height = pmenu_item->pixmap->requisition.height;
child_allocation.x = border_width + BORDER_SPACING;
child_allocation.y = (border_width + BORDER_SPACING
- + (((allocation->height - child_allocation.height) - child_allocation.x)
- / 2)); /* center pixmaps vertically */
+ + (((allocation->height - child_allocation.height) - child_allocation.x)
+ / 2)); /* center pixmaps vertically */
gtk_widget_size_allocate (pmenu_item->pixmap, &child_allocation);
}
static void
gtk_pixmap_menu_item_forall (GtkContainer *container,
- gboolean include_internals,
- GtkCallback callback,
- gpointer callback_data)
+ gboolean include_internals,
+ GtkCallback callback,
+ gpointer callback_data)
{
GtkPixmapMenuItem *menu_item;
(* callback) (menu_item->pixmap, callback_data);
GTK_CONTAINER_CLASS(parent_class)->forall(container,include_internals,
- callback,callback_data);
+ callback,callback_data);
}
static void
gtk_pixmap_menu_item_size_request (GtkWidget *widget,
- GtkRequisition *requisition)
+ GtkRequisition *requisition)
{
GtkPixmapMenuItem *menu_item;
GtkRequisition req = {0, 0};
static void
gtk_pixmap_menu_item_remove (GtkContainer *container,
- GtkWidget *child)
+ GtkWidget *child)
{
GtkBin *bin;
gboolean widget_was_visible;
bin = GTK_BIN (container);
g_return_if_fail ((bin->child == child ||
- (GTK_PIXMAP_MENU_ITEM(container)->pixmap == child)));
+ (GTK_PIXMAP_MENU_ITEM(container)->pixmap == child)));
widget_was_visible = GTK_WIDGET_VISIBLE (child);