testing-repository/Gtk3/gtk28/gtkwin.h

87 lines
1.9 KiB
C
Raw Normal View History

2020-12-20 11:22:22 +08:00
#include <gtk/gtk.h>
typedef void(*pfun)(GtkWidget *,gpointer);//define a pointer to function
2020-12-23 21:07:43 +08:00
//Convert xpm data to a GtkImage
2020-12-21 12:09:59 +08:00
class Icon{
GdkPixbuf *sized;
public:
GdkPixbuf *pixbuf;
GtkWidget *img1;
void get_image(const gchar **str,int width,int height);
};
2020-12-20 11:22:22 +08:00
//GtkButton class
class GtkBtn{
public:
GtkWidget *button;
void init(const gchar *str,int width,int height);
void signal_clicked(pfun func,gpointer data);
};
//GtkLayout class
class Winlayout{
void put(GtkWidget *child,int x,int y);
public:
GtkWidget *layout=gtk_layout_new(NULL,NULL);
void init();
};
2020-12-23 21:07:43 +08:00
//GtkHeaderbar class
2020-12-20 20:50:10 +08:00
class WinHeader{
public:
GtkWidget *header=gtk_header_bar_new();
GtkHeaderBar *_header=GTK_HEADER_BAR(header);
2020-12-20 22:14:40 +08:00
void init(GtkWidget *window);
void pack_start(GtkWidget *child);
};
2020-12-23 21:07:43 +08:00
//GtkMenuitem class
2020-12-20 22:14:40 +08:00
class Menuitem{
public:
GtkWidget *menuitem;
void menuitem_init(const gchar *str,pfun func,gpointer data);
};
2020-12-23 21:07:43 +08:00
//GtkMenuBar class
2020-12-20 22:14:40 +08:00
class MenuBar{
public:
GtkWidget *menubar=gtk_menu_bar_new();
void menubar_append(Menuitem child);
void menu_init(GtkWidget *window);
};
2020-12-23 21:07:43 +08:00
//GtkMenu class
2020-12-20 22:14:40 +08:00
class Menu{
public:
GtkWidget *menu;
void menu_append(Menuitem child);
void set_submenu(Menuitem menuitem);
2020-12-20 20:50:10 +08:00
};
2020-12-20 11:22:22 +08:00
//GtkWindow class
class GtkWin{
GtkWidget *window;
GtkWindow *_window;
void add(GtkWidget *widget);
public:
2020-12-20 20:50:10 +08:00
void set_titlebar(GtkWidget *title);
2020-12-20 11:22:22 +08:00
void win_init(GtkApplication *app,int width,int height);
void show_all();
};
2020-12-23 21:07:43 +08:00
//GtkHBox class (Not the deprecated GtkHbox)
2020-12-22 19:33:36 +08:00
class HBox{
public:
GtkWidget *hbox=gtk_box_new(GTK_ORIENTATION_HORIZONTAL,5);
void pack_start(GtkWidget *child,gboolean expand,gboolean full,gint padding);
};
2020-12-26 10:54:00 +08:00
2020-12-26 11:11:22 +08:00
//GtkComboBox class
2020-12-26 10:54:00 +08:00
class Combobox{
public:
GtkWidget *combo;
void append_item(const gchar *str);
void init(int width,int height);
};