当前位置: 技术问答>linux和unix
求问LINUX 界面问题
来源: 互联网 发布时间:2016-06-07
本文导语: 通过这串代码可以实现一个 浮动窗口在LINUX下面 ,请问怎么加入2个输入框,输入 横坐标 和众坐标 后 控制窗口的移动? 本人是 LINUX 菜鸟 希望兄弟们帮忙 写一下咯。 如果可以发到邮箱34727498@qq.com 完事再加200分 #i...
通过这串代码可以实现一个 浮动窗口在LINUX下面 ,请问怎么加入2个输入框,输入 横坐标 和众坐标 后
控制窗口的移动?
本人是 LINUX 菜鸟 希望兄弟们帮忙 写一下咯。
如果可以发到邮箱34727498@qq.com
完事再加200分
#include
#include
#include
print the enty_text*/
void entry_callback(GtkWidget *widget,
GtkWidget *entry)
{
const gchar *entry_text;
entry_text = gtk_entry_get_text(GTK_ENTRY(entry));
printf("Entry contents: %sn",entry_text);
}
void entry_toggle_editable(GtkWidget *checkbutton,
GtkWidget *entry)
{
gtk_editable_set_editable(GTK_EDITABLE(entry),
GTK_TOGGLE_BUTTON(checkbutton)->active);
}
void entry_toggle_visibility(GtkWidget *checkbutton,
GtkWidget *entry)
{
gtk_entry_set_visibility(GTK_ENTRY(entry),
GTK_TOGGLE_BUTTON(checkbutton)->active);
}
int main(int argc,
char *argv[])
{
GtkWidget *window;
GtkWidget *button;
GtkWidget *vbox,*hbox;
GtkWidget *check;
GtkWidget *entry;
gint tmp_pos;
gtk_init(&argc,&argv);
window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
gtk_widget_set_size_request(GTK_WIDGET(window),200,100);
gtk_window_set_title(GTK_WINDOW(window),"GTK ENTRY");
g_signal_connect(G_OBJECT(window),"destroy",
G_CALLBACK(gtk_main_quit),NULL);
g_signal_connect(G_OBJECT(window),"delete_event",
G_CALLBACK(gtk_widget_destroy),window);
vbox = gtk_vbox_new(FALSE,0);
gtk_container_add(GTK_CONTAINER(window),vbox);
gtk_widget_show(vbox);
/*creat a entry*/
entry = gtk_entry_new();
gtk_entry_set_max_length(GTK_ENTRY(entry),50);
g_signal_connect(G_OBJECT(entry),"activate",
G_CALLBACK(entry_callback),entry);
gtk_entry_set_text(GTK_ENTRY(entry),"Hello");
tmp_pos = GTK_ENTRY(entry)->text_length;
gtk_editable_insert_text(GTK_EDITABLE(entry),"World",-1,&tmp_pos);
gtk_box_pack_start(GTK_BOX(vbox),entry,
TRUE,TRUE,0);
gtk_widget_show(entry);
check = gtk_check_button_new_with_label("Editable");
g_signal_connect(G_OBJECT(check),"toggled",
G_CALLBACK(entry_toggle_editable),entry);
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(check),TRUE);
gtk_box_pack_start(GTK_BOX(vbox),check,
TRUE,TRUE,0);
gtk_widget_show(check);
check = gtk_check_button_new_with_label("Visible");
g_signal_connect(G_OBJECT(check),"toggled",
G_CALLBACK(entry_toggle_visibility),entry);
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(check),TRUE);
gtk_box_pack_start(GTK_BOX(vbox),check,
TRUE,TRUE,0);
gtk_widget_show(check);
gtk_widget_show(window);
gtk_main();
return 0;
}
|
gtk,爱莫能助啊,QT还能帮分析下