是否有替代" GtkRuler"在GTK3?

时间:2016-10-05 06:57:36

标签: gtk3 rulers

我想用gtk3在框架上显示水平和垂直标尺。

这是我的框架:enter image description here

我想在框架上显示标尺:

enter image description here

GtkRuler 已从GTK 3中移除,因为它没有维护且太专业!!

这是我的GTK3 / c cpde:

   /* The horizontal ruler goes on top. As the mouse moves across the
    * drawing area, a motion_notify_event is passed to the
    * appropriate event handler for the ruler. */
   hrule = gtk_hruler_new ();
   gtk_ruler_set_metric (GTK_RULER (hrule), GTK_PIXELS);
   gtk_ruler_set_range (GTK_RULER (hrule), 7, 13, 0, 20);
   g_signal_connect_swapped (area, "motion_notify_event",
                      G_CALLBACK (EVENT_METHOD (hrule,        motion_notify_event)),
                      hrule);
   gtk_table_attach (GTK_TABLE (table), hrule, 1, 2, 0, 1,
              GTK_EXPAND|GTK_SHRINK|GTK_FILL, GTK_FILL, 0, 0);

   /* The vertical ruler goes on the left. As the mouse moves across
    * the drawing area, a motion_notify_event is passed to the
    * appropriate event handler for the ruler. */
   vrule = gtk_vruler_new ();
   gtk_ruler_set_metric (GTK_RULER (vrule), GTK_PIXELS);
   gtk_ruler_set_range (GTK_RULER (vrule), 0, YSIZE, 10, YSIZE );
   g_signal_connect_swapped (area, "motion_notify_event",
                      G_CALLBACK (EVENT_METHOD (vrule, motion_notify_event)),
                      vrule);
   gtk_table_attach (GTK_TABLE (table), vrule, 0, 1, 1, 2,
              GTK_FILL, GTK_EXPAND|GTK_SHRINK|GTK_FILL, 0, 0);

您建议如何解决此任务的想法?或者我可以在互联网上的哪些资源上找到帮助?

1 个答案:

答案 0 :(得分:0)

如果您的代码具有兼容的许可证,您只需将GtkRuler从GTK 2复制到您的代码中,进行必要的更改以使其与GTK 3一起使用。