如何防止鼠标图标被更改?

时间:2018-07-17 04:22:02

标签: c gtk3

是否可以防止鼠标光标图标在窗格分隔符上方更改? ->我要禁用平移对象的大小调整功能。

顺便说一句,我已经找到了通过添加“ notify”事件来响应调整大小操作的方法,就像这样:


#include <gtk/gtk.h>
static gboolean motion_notify_event(GtkWidget *widget, GdkEventMotion *event);
int main (int argc, char *argv[]) {
    GtkWidget *toplevel;
    gtk_init (&argc, &argv);
    toplevel = gtk_window_new(GTK_WINDOW_TOPLEVEL);

    GtkWidget *hpaned = gtk_vpaned_new();
    GtkWidget *frame1 = gtk_frame_new(NULL);
    GtkWidget *frame2 = gtk_frame_new(NULL);
    gtk_frame_set_shadow_type(GTK_FRAME(frame1), GTK_SHADOW_NONE);
    gtk_frame_set_shadow_type(GTK_FRAME(frame2), GTK_SHADOW_NONE);
    gtk_paned_pack1(GTK_PANED(hpaned), frame1, FALSE, FALSE);
    gtk_paned_pack2(GTK_PANED(hpaned), frame2, TRUE, TRUE);
    gtk_widget_set_size_request(frame1, 50, 50);

    g_signal_connect(G_OBJECT(hpaned), "notify",  G_CALLBACK(motion_notify_event), NULL);

    gtk_container_add(GTK_CONTAINER(toplevel), hpaned);
    gtk_widget_show_all(toplevel);
    gtk_main();
    return 0;
}

static gboolean motion_notify_event(GtkWidget *widget, GdkEventMotion *event)
{
    gtk_paned_set_position(GTK_PANED(widget), 50);
    return TRUE;
}

mouse icon is showing resizing

1 个答案:

答案 0 :(得分:0)

根据CentOS 7下的Glade,小部件标志属性“敏感”是您的答案。

请尝试gtk_widget_set_sensitive(您的小部件为FALSE)。

enter image description here