here i m showing a program which i ran using MinGW tools.
To do this thing first write a C program using GTK library.
here is a sample C code for creating a button.
#include <stdio.h>
#include
#define COLROW 5
gint Delete(GtkWidget* widget, gpointer* data)
{
g_print("Screw you guys, I'm going home!\n");
gtk_main_quit(); /* stop gtk_main */
return FALSE; /* Kill the window */
}
gint ButtonPressed(GtkWidget* widget, gpointer data)
{
g_print("You pressed the button.\n");
return FALSE;
}
int main(int argc, char* argv[])
{
GtkWidget* window;
GtkWidget* button;
gtk_init(&argc, &argv);
window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
gtk_window_set_title(GTK_WINDOW(window), "test window");
button = gtk_button_new_with_label("hello");
gtk_container_add(GTK_CONTAINER(window), button);
gtk_signal_connect(GTK_OBJECT(window), "delete_event",
GTK_SIGNAL_FUNC(Delete), NULL);
gtk_signal_connect(GTK_OBJECT(button), "clicked",
GTK_SIGNAL_FUNC(ButtonPressed), NULL);
gtk_widget_show(button);
gtk_widget_show(window); /* do this last */
gtk_main();
return 0;
}
the setting up level of a button is done in the line
button = gtk_button_new_with_label("hello");
if you want to write something in Bangla in stead of "hello" it will just show ????.
this is because this .c file is in ANSI format, cannot write any unicode text.
to edit some bangla text in this code you have to open this .c file either in Scite or Notepad++,.
and save the file in UTF-8 without Bom encoding. You can set this encoding from preference inside notepad++. after that you can write bangla text in any where in the file.
now replace the "hello" word with some Bangla word.
Save the file.
so you have to configure your MinGW installation folder to tell GTK which bangla font you want to view in your application.
In order to do this, you need to open
style "bangla"
{
font_name="Sans 9"
}
widget_class "*" style "bangla"
Replace "Sans 9" with our bangla font.
Thats it.
Now you run compile and run our progarm, you can see the Bangla word you set before in your button level.
No comments:
Post a Comment