comparison pidgin/gtkutils.h @ 32692:0f94ec89f0bc

merged from im.pidgin.pidgin
author Yoshiki Yazawa <yaz@honeyplanet.jp>
date Mon, 26 Sep 2011 14:57:21 +0900
parents 9aee8493db7f 02a2e8183b1d
children
comparison
equal deleted inserted replaced
32438:55e678325bda 32692:0f94ec89f0bc
107 * @return The GtkFrame containing the toolbar and imhtml. 107 * @return The GtkFrame containing the toolbar and imhtml.
108 */ 108 */
109 GtkWidget *pidgin_create_imhtml(gboolean editable, GtkWidget **imhtml_ret, GtkWidget **toolbar_ret, GtkWidget **sw_ret); 109 GtkWidget *pidgin_create_imhtml(gboolean editable, GtkWidget **imhtml_ret, GtkWidget **toolbar_ret, GtkWidget **sw_ret);
110 110
111 /** 111 /**
112 * Create an GtkWebView widget and associated GtkIMHtmlToolbar widget. This
113 * function puts both widgets in a nice GtkFrame. They're separated by an
114 * attractive GtkSeparator.
115 * TODO WEBKIT: editable isn't supported yet
116 *
117 * @param editable @c TRUE if this webview should be editable. If this is
118 * @c FALSE, then the toolbar will NOT be created. If this webview
119 * should be read-only at first, but may become editable later, then
120 * pass in @c TRUE here and then manually call gtk_webview_set_editable()
121 * later.
122 * @param webview_ret A pointer to a pointer to a GtkWidget. This pointer
123 * will be set to the webview when this function exits.
124 * @param toolbar_ret A pointer to a pointer to a GtkWidget. If editable is
125 * TRUE then this will be set to the toolbar when this function exits.
126 * Otherwise this will be set to @c NULL.
127 * @param sw_ret This will be filled with a pointer to the scrolled window
128 * widget which contains the webview.
129 *
130 * @return The GtkFrame containing the toolbar and webview.
131 */
132 GtkWidget *pidgin_create_webview(gboolean editable, GtkWidget **webview_ret, GtkWidget **toolbar_ret, GtkWidget **sw_ret);
133
134 /**
112 * Creates a small button 135 * Creates a small button
113 * 136 *
114 * @param image A button image. 137 * @param image A button image.
115 * 138 *
116 * @return A GtkButton created from the image. 139 * @return A GtkButton created from the image.
117 * @since 2.7.0
118 */ 140 */
119 GtkWidget *pidgin_create_small_button(GtkWidget *image); 141 GtkWidget *pidgin_create_small_button(GtkWidget *image);
120 142
121 /** 143 /**
122 * Creates a new window 144 * Creates a new window
123 * 145 *
124 * @param title The window title, or @c NULL 146 * @param title The window title, or @c NULL
125 * @param border_width The window's desired border width 147 * @param border_width The window's desired border width
126 * @param role A string indicating what the window is responsible for doing, or @c NULL 148 * @param role A string indicating what the window is responsible for doing, or @c NULL
127 * @param resizable Whether the window should be resizable (@c TRUE) or not (@c FALSE) 149 * @param resizable Whether the window should be resizable (@c TRUE) or not (@c FALSE)
128 *
129 * @since 2.1.0
130 */ 150 */
131 GtkWidget *pidgin_create_window(const char *title, guint border_width, const char *role, gboolean resizable); 151 GtkWidget *pidgin_create_window(const char *title, guint border_width, const char *role, gboolean resizable);
132 152
133 /** 153 /**
134 * Creates a new dialog window 154 * Creates a new dialog window
135 * 155 *
136 * @param title The window title, or @c NULL 156 * @param title The window title, or @c NULL
137 * @param border_width The window's desired border width 157 * @param border_width The window's desired border width
138 * @param role A string indicating what the window is responsible for doing, or @c NULL 158 * @param role A string indicating what the window is responsible for doing, or @c NULL
139 * @param resizable Whether the window should be resizable (@c TRUE) or not (@c FALSE) 159 * @param resizable Whether the window should be resizable (@c TRUE) or not (@c FALSE)
140 *
141 * @since 2.4.0
142 */ 160 */
143 GtkWidget *pidgin_create_dialog(const char *title, guint border_width, const char *role, gboolean resizable); 161 GtkWidget *pidgin_create_dialog(const char *title, guint border_width, const char *role, gboolean resizable);
144 162
145 /** 163 /**
146 * Retrieves the main content box (vbox) from a pidgin dialog window 164 * Retrieves the main content box (vbox) from a pidgin dialog window
147 * 165 *
148 * @param dialog The dialog window 166 * @param dialog The dialog window
149 * @param homogeneous TRUE if all children are to be given equal space allotments. 167 * @param homogeneous TRUE if all children are to be given equal space allotments.
150 * @param spacing the number of pixels to place by default between children 168 * @param spacing the number of pixels to place by default between children
151 *
152 * @since 2.4.0
153 */ 169 */
154 GtkWidget *pidgin_dialog_get_vbox_with_properties(GtkDialog *dialog, gboolean homogeneous, gint spacing); 170 GtkWidget *pidgin_dialog_get_vbox_with_properties(GtkDialog *dialog, gboolean homogeneous, gint spacing);
155 171
156 /** 172 /**
157 * Retrieves the main content box (vbox) from a pidgin dialog window 173 * Retrieves the main content box (vbox) from a pidgin dialog window
158 * 174 *
159 * @param dialog The dialog window 175 * @param dialog The dialog window
160 *
161 * @since 2.4.0
162 */ 176 */
163 GtkWidget *pidgin_dialog_get_vbox(GtkDialog *dialog); 177 GtkWidget *pidgin_dialog_get_vbox(GtkDialog *dialog);
164 178
165 /** 179 /**
166 * Add a button to a dialog created by #pidgin_create_dialog. 180 * Add a button to a dialog created by #pidgin_create_dialog.
169 * @param label The stock-id or the label for the button 183 * @param label The stock-id or the label for the button
170 * @param callback The callback function for the button 184 * @param callback The callback function for the button
171 * @param callbackdata The user data for the callback function 185 * @param callbackdata The user data for the callback function
172 * 186 *
173 * @return The created button. 187 * @return The created button.
174 * @since 2.4.0
175 */ 188 */
176 GtkWidget *pidgin_dialog_add_button(GtkDialog *dialog, const char *label, 189 GtkWidget *pidgin_dialog_add_button(GtkDialog *dialog, const char *label,
177 GCallback callback, gpointer callbackdata); 190 GCallback callback, gpointer callbackdata);
178 191
179 /** 192 /**
180 * Retrieves the action area (button box) from a pidgin dialog window 193 * Retrieves the action area (button box) from a pidgin dialog window
181 * 194 *
182 * @param dialog The dialog window 195 * @param dialog The dialog window
183 *
184 * @since 2.4.0
185 */ 196 */
186 GtkWidget *pidgin_dialog_get_action_area(GtkDialog *dialog); 197 GtkWidget *pidgin_dialog_get_action_area(GtkDialog *dialog);
187 198
188 /** 199 /**
189 * Toggles the sensitivity of a widget. 200 * Toggles the sensitivity of a widget.
413 /** 424 /**
414 * Get information about a user. Show immediate feedback. 425 * Get information about a user. Show immediate feedback.
415 * 426 *
416 * @param conn The connection to get information from. 427 * @param conn The connection to get information from.
417 * @param name The user to get information about. 428 * @param name The user to get information about.
418 *
419 * @since 2.1.0
420 */ 429 */
421 void pidgin_retrieve_user_info(PurpleConnection *conn, const char *name); 430 void pidgin_retrieve_user_info(PurpleConnection *conn, const char *name);
422 431
423 /** 432 /**
424 * Get information about a user in a chat. Show immediate feedback. 433 * Get information about a user in a chat. Show immediate feedback.
425 * 434 *
426 * @param conn The connection to get information from. 435 * @param conn The connection to get information from.
427 * @param name The user to get information about. 436 * @param name The user to get information about.
428 * @param chatid The chat id. 437 * @param chatid The chat id.
429 *
430 * @since 2.1.0
431 */ 438 */
432 void pidgin_retrieve_user_info_in_chat(PurpleConnection *conn, const char *name, int chatid); 439 void pidgin_retrieve_user_info_in_chat(PurpleConnection *conn, const char *name, int chatid);
433 440
434 /** 441 /**
435 * Parses an application/x-im-contact MIME message and returns the 442 * Parses an application/x-im-contact MIME message and returns the
464 /** 471 /**
465 * Sets the labelled-by and label-for ATK relationships. 472 * Sets the labelled-by and label-for ATK relationships.
466 * 473 *
467 * @param w The widget that we want to label. 474 * @param w The widget that we want to label.
468 * @param l A GtkLabel that we want to use as the label for the widget. 475 * @param l A GtkLabel that we want to use as the label for the widget.
469 *
470 * @since 2.2.0
471 */ 476 */
472 void pidgin_set_accessible_relations(GtkWidget *w, GtkWidget *l); 477 void pidgin_set_accessible_relations(GtkWidget *w, GtkWidget *l);
473 478
474 /** 479 /**
475 * A helper function for GtkMenuPositionFuncs. This ensures the menu will 480 * A helper function for GtkMenuPositionFuncs. This ensures the menu will
480 * where the menu shall be drawn. This is an output parameter. 485 * where the menu shall be drawn. This is an output parameter.
481 * @param y Address of the gint representing the vertical position 486 * @param y Address of the gint representing the vertical position
482 * where the menu shall be drawn. This is an output parameter. 487 * where the menu shall be drawn. This is an output parameter.
483 * @param push_in This is an output parameter? 488 * @param push_in This is an output parameter?
484 * @param data Not used by this particular position function. 489 * @param data Not used by this particular position function.
485 *
486 * @since 2.1.0
487 */ 490 */
488 void pidgin_menu_position_func_helper(GtkMenu *menu, gint *x, gint *y, 491 void pidgin_menu_position_func_helper(GtkMenu *menu, gint *x, gint *y,
489 gboolean *push_in, gpointer data); 492 gboolean *push_in, gpointer data);
490 493
491 /** 494 /**
553 * Returns an appropriate stock-id for a status primitive. 556 * Returns an appropriate stock-id for a status primitive.
554 * 557 *
555 * @param prim The status primitive 558 * @param prim The status primitive
556 * 559 *
557 * @return The stock-id 560 * @return The stock-id
558 *
559 * @since 2.6.0
560 */ 561 */
561 const char *pidgin_stock_id_from_status_primitive(PurpleStatusPrimitive prim); 562 const char *pidgin_stock_id_from_status_primitive(PurpleStatusPrimitive prim);
562 563
563 /** 564 /**
564 * Returns an appropriate stock-id for a PurplePresence. 565 * Returns an appropriate stock-id for a PurplePresence.
565 * 566 *
566 * @param presence The presence. 567 * @param presence The presence.
567 * 568 *
568 * @return The stock-id 569 * @return The stock-id
569 *
570 * @since 2.6.0
571 */ 570 */
572 const char *pidgin_stock_id_from_presence(PurplePresence *presence); 571 const char *pidgin_stock_id_from_presence(PurplePresence *presence);
573 572
574 /** 573 /**
575 * Append a PurpleMenuAction to a menu. 574 * Append a PurpleMenuAction to a menu.
733 * @param default_item Initial contents of GtkEntry 732 * @param default_item Initial contents of GtkEntry
734 * @param items GList containing strings to add to GtkComboBox 733 * @param items GList containing strings to add to GtkComboBox
735 * 734 *
736 * @return A newly created text GtkComboBox containing a GtkEntry 735 * @return A newly created text GtkComboBox containing a GtkEntry
737 * child. 736 * child.
738 *
739 * @since 2.2.0
740 */ 737 */
741 GtkWidget *pidgin_text_combo_box_entry_new(const char *default_item, GList *items); 738 GtkWidget *pidgin_text_combo_box_entry_new(const char *default_item, GList *items);
742 739
743 /** 740 /**
744 * Retrieve the text from the entry of the simple text GtkComboBoxEntry equivalent 741 * Retrieve the text from the entry of the simple text GtkComboBoxEntry equivalent
745 * 742 *
746 * @param widget The simple text GtkComboBoxEntry equivalent widget 743 * @param widget The simple text GtkComboBoxEntry equivalent widget
747 * 744 *
748 * @return The text in the widget's entry. It must not be freed 745 * @return The text in the widget's entry. It must not be freed
749 *
750 * @since 2.2.0
751 */ 746 */
752 const char *pidgin_text_combo_box_entry_get_text(GtkWidget *widget); 747 const char *pidgin_text_combo_box_entry_get_text(GtkWidget *widget);
753 748
754 /** 749 /**
755 * Set the text in the entry of the simple text GtkComboBoxEntry equivalent 750 * Set the text in the entry of the simple text GtkComboBoxEntry equivalent
756 * 751 *
757 * @param widget The simple text GtkComboBoxEntry equivalent widget 752 * @param widget The simple text GtkComboBoxEntry equivalent widget
758 * @param text The text to set 753 * @param text The text to set
759 *
760 * @since 2.2.0
761 */ 754 */
762 void pidgin_text_combo_box_entry_set_text(GtkWidget *widget, const char *text); 755 void pidgin_text_combo_box_entry_set_text(GtkWidget *widget, const char *text);
763 756
764 /** 757 /**
765 * Automatically make a window transient to a suitable parent window. 758 * Automatically make a window transient to a suitable parent window.
766 * 759 *
767 * @param window The window to make transient. 760 * @param window The window to make transient.
768 * 761 *
769 * @return Whether the window was made transient or not. 762 * @return Whether the window was made transient or not.
770 *
771 * @since 2.4.0
772 */ 763 */
773 gboolean pidgin_auto_parent_window(GtkWidget *window); 764 gboolean pidgin_auto_parent_window(GtkWidget *window);
774 765
775 /** 766 /**
776 * Add a labelled widget to a GtkVBox 767 * Add a labelled widget to a GtkVBox
781 * @param widget The GtkWidget to add. 772 * @param widget The GtkWidget to add.
782 * @param expand Whether to expand the widget horizontally. 773 * @param expand Whether to expand the widget horizontally.
783 * @param p_label Place to store a pointer to the GtkLabel, or @c NULL if you don't care. 774 * @param p_label Place to store a pointer to the GtkLabel, or @c NULL if you don't care.
784 * 775 *
785 * @return A GtkHBox already added to the GtkVBox containing the GtkLabel and the GtkWidget. 776 * @return A GtkHBox already added to the GtkVBox containing the GtkLabel and the GtkWidget.
786 * @since 2.4.0
787 */ 777 */
788 GtkWidget *pidgin_add_widget_to_vbox(GtkBox *vbox, const char *widget_label, GtkSizeGroup *sg, GtkWidget *widget, gboolean expand, GtkWidget **p_label); 778 GtkWidget *pidgin_add_widget_to_vbox(GtkBox *vbox, const char *widget_label, GtkSizeGroup *sg, GtkWidget *widget, gboolean expand, GtkWidget **p_label);
789 779
790 /** 780 /**
791 * Create a GdkPixbuf from a chunk of image data. 781 * Create a GdkPixbuf from a chunk of image data.
793 * @param buf The raw binary image data. 783 * @param buf The raw binary image data.
794 * @param count The length of buf in bytes. 784 * @param count The length of buf in bytes.
795 * 785 *
796 * @return A GdkPixbuf created from the image data, or NULL if 786 * @return A GdkPixbuf created from the image data, or NULL if
797 * there was an error parsing the data. 787 * there was an error parsing the data.
798 *
799 * @since 2.9.0
800 */ 788 */
801 GdkPixbuf *pidgin_pixbuf_from_data(const guchar *buf, gsize count); 789 GdkPixbuf *pidgin_pixbuf_from_data(const guchar *buf, gsize count);
802 790
803 /** 791 /**
804 * Create a GdkPixbufAnimation from a chunk of image data. 792 * Create a GdkPixbufAnimation from a chunk of image data.
806 * @param buf The raw binary image data. 794 * @param buf The raw binary image data.
807 * @param count The length of buf in bytes. 795 * @param count The length of buf in bytes.
808 * 796 *
809 * @return A GdkPixbufAnimation created from the image data, or NULL if 797 * @return A GdkPixbufAnimation created from the image data, or NULL if
810 * there was an error parsing the data. 798 * there was an error parsing the data.
811 *
812 * @since 2.9.0
813 */ 799 */
814 GdkPixbufAnimation *pidgin_pixbuf_anim_from_data(const guchar *buf, gsize count); 800 GdkPixbufAnimation *pidgin_pixbuf_anim_from_data(const guchar *buf, gsize count);
815 801
816 /** 802 /**
817 * Create a GdkPixbuf from a PurpleStoredImage. 803 * Create a GdkPixbuf from a PurpleStoredImage.
818 * 804 *
819 * @param image A PurpleStoredImage. 805 * @param image A PurpleStoredImage.
820 * 806 *
821 * @return A GdkPixbuf created from the stored image. 807 * @return A GdkPixbuf created from the stored image.
822 *
823 * @since 2.5.0
824 */ 808 */
825 GdkPixbuf *pidgin_pixbuf_from_imgstore(PurpleStoredImage *image); 809 GdkPixbuf *pidgin_pixbuf_from_imgstore(PurpleStoredImage *image);
826 810
827 /** 811 /**
828 * Helper function that calls gdk_pixbuf_new_from_file() and checks both 812 * Helper function that calls gdk_pixbuf_new_from_file() and checks both
842 * 826 *
843 * @param filename Name of file to load, in the GLib file name encoding 827 * @param filename Name of file to load, in the GLib file name encoding
844 * 828 *
845 * @return The GdkPixbuf if successful. Otherwise NULL is returned and 829 * @return The GdkPixbuf if successful. Otherwise NULL is returned and
846 * a warning is logged. 830 * a warning is logged.
847 *
848 * @since 2.9.0
849 */ 831 */
850 GdkPixbuf *pidgin_pixbuf_new_from_file(const char *filename); 832 GdkPixbuf *pidgin_pixbuf_new_from_file(const char *filename);
851 833
852 /** 834 /**
853 * Helper function that calls gdk_pixbuf_new_from_file_at_size() and checks 835 * Helper function that calls gdk_pixbuf_new_from_file_at_size() and checks
869 * @param width The width the image should have or -1 to not constrain the width 851 * @param width The width the image should have or -1 to not constrain the width
870 * @param height The height the image should have or -1 to not constrain the height 852 * @param height The height the image should have or -1 to not constrain the height
871 * 853 *
872 * @return The GdkPixbuf if successful. Otherwise NULL is returned and 854 * @return The GdkPixbuf if successful. Otherwise NULL is returned and
873 * a warning is logged. 855 * a warning is logged.
874 *
875 * @since 2.9.0
876 */ 856 */
877 GdkPixbuf *pidgin_pixbuf_new_from_file_at_size(const char *filename, int width, int height); 857 GdkPixbuf *pidgin_pixbuf_new_from_file_at_size(const char *filename, int width, int height);
878 858
879 /** 859 /**
880 * Helper function that calls gdk_pixbuf_new_from_file_at_scale() and checks 860 * Helper function that calls gdk_pixbuf_new_from_file_at_scale() and checks
897 * @param height The height the image should have or -1 to not constrain the height 877 * @param height The height the image should have or -1 to not constrain the height
898 * @param preserve_aspect_ratio TRUE to preserve the image's aspect ratio 878 * @param preserve_aspect_ratio TRUE to preserve the image's aspect ratio
899 * 879 *
900 * @return The GdkPixbuf if successful. Otherwise NULL is returned and 880 * @return The GdkPixbuf if successful. Otherwise NULL is returned and
901 * a warning is logged. 881 * a warning is logged.
902 *
903 * @since 2.9.0
904 */ 882 */
905 GdkPixbuf *pidgin_pixbuf_new_from_file_at_scale(const char *filename, int width, int height, gboolean preserve_aspect_ratio); 883 GdkPixbuf *pidgin_pixbuf_new_from_file_at_scale(const char *filename, int width, int height, gboolean preserve_aspect_ratio);
906 884
907 /** 885 /**
908 * Add scrollbars to a widget 886 * Add scrollbars to a widget
909 * @param widget The child widget 887 * @param child The child widget
910 * @hscrollbar_policy Horizontal scrolling policy 888 * @param hscrollbar_policy Horizontal scrolling policy
911 * @vscrollbar_policy Vertical scrolling policy 889 * @param vscrollbar_policy Vertical scrolling policy
912 * @shadow Shadow type 890 * @param shadow_type Shadow type
913 * @width Desired widget width, or -1 for default 891 * @param width Desired widget width, or -1 for default
914 * @height Desired widget height, or -1 for default 892 * @param height Desired widget height, or -1 for default
915 *
916 * @since 2.8.0
917 */ 893 */
918 GtkWidget *pidgin_make_scrollable(GtkWidget *child, GtkPolicyType hscrollbar_policy, GtkPolicyType vscrollbar_policy, GtkShadowType shadow_type, int width, int height); 894 GtkWidget *pidgin_make_scrollable(GtkWidget *child, GtkPolicyType hscrollbar_policy, GtkPolicyType vscrollbar_policy, GtkShadowType shadow_type, int width, int height);
919 895
920 /** 896 /**
921 * Initialize some utility functions. 897 * Initialize some utility functions.
922 *
923 * @since 2.6.0
924 */ 898 */
925 void pidgin_utils_init(void); 899 void pidgin_utils_init(void);
926 900
927 /** 901 /**
928 * Uninitialize some utility functions. 902 * Uninitialize some utility functions.
929 *
930 * @since 2.6.0
931 */ 903 */
932 void pidgin_utils_uninit(void); 904 void pidgin_utils_uninit(void);
933 905
934 gchar *pidgin_gtk_ellipsis_text(GtkWidget *widget, const char *text, gint min_width, gchar *ellipsis); 906 gchar *pidgin_gtk_ellipsis_text(GtkWidget *widget, const char *text, gint min_width, gchar *ellipsis);
935 907