diff options
Diffstat (limited to 'app/wlib/gtklib/message.c')
-rw-r--r-- | app/wlib/gtklib/message.c | 224 |
1 files changed, 112 insertions, 112 deletions
diff --git a/app/wlib/gtklib/message.c b/app/wlib/gtklib/message.c index af37d22..6a63434 100644 --- a/app/wlib/gtklib/message.c +++ b/app/wlib/gtklib/message.c @@ -17,7 +17,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ #include <stdlib.h> @@ -42,10 +42,10 @@ */ struct wMessage_t { - WOBJ_COMMON - GtkWidget * labelWidget; - const char * message; - wPos_t labelWidth; + WOBJ_COMMON + GtkWidget * labelWidget; + const char * message; + wWinPix_t labelWidth; }; /** @@ -57,14 +57,14 @@ struct wMessage_t { */ void wMessageSetValue( - wMessage_p b, - const char * arg) + wMessage_p b, + const char * arg) { - if (b->widget == 0) { - abort(); - } + if (b->widget == 0) { + abort(); + } - gtk_label_set_text(GTK_LABEL(b->labelWidget), wlibConvertInput(arg)); + gtk_label_set_text(GTK_LABEL(b->labelWidget), wlibConvertInput(arg)); } /** @@ -76,11 +76,11 @@ void wMessageSetValue( */ void wMessageSetWidth( - wMessage_p b, - wPos_t width) + wMessage_p b, + wWinPix_t width) { - b->labelWidth = width; - gtk_widget_set_size_request(b->widget, width, -1); + b->labelWidth = width; + gtk_widget_set_size_request(b->widget, width, -1); } /** @@ -90,48 +90,48 @@ void wMessageSetWidth( * \return text height */ -wPos_t wMessageGetHeight( - long flags) +wWinPix_t wMessageGetHeight( + long flags) { - GtkWidget * temp; + GtkWidget * temp; - if (!(flags&COMBOBOX)) { + if (!(flags&COMBOBOX)) { temp = gtk_label_new("Test"); //To get size of text itself - } else { - temp = gtk_combo_box_text_new(); //to get max size of an object in infoBar - } - - if (wMessageSetFont(flags)) { - GtkStyle *style; - PangoFontDescription *fontDesc; - int fontSize; - /* get the current font descriptor */ - style = gtk_widget_get_style(temp); - fontDesc = style->font_desc; - /* get the current font size */ - fontSize = PANGO_PIXELS(pango_font_description_get_size(fontDesc)); - - /* calculate the new font size */ - if (flags & BM_LARGE) { - pango_font_description_set_size(fontDesc, fontSize * 1.4 * PANGO_SCALE); - } else { - pango_font_description_set_size(fontDesc, fontSize * 0.7 * PANGO_SCALE); - } - - /* set the new font size */ - gtk_widget_modify_font(temp, fontDesc); - } - - if (flags&1L) { - gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(temp),"Test"); - } - - GtkRequisition temp_requisition; - gtk_widget_size_request(temp,&temp_requisition); - g_object_ref_sink(temp); - gtk_widget_destroy(temp); - g_object_unref(temp); - return temp_requisition.height; + } else { + temp = gtk_combo_box_text_new(); //to get max size of an object in infoBar + } + + if (wMessageSetFont(flags)) { + GtkStyle *style; + PangoFontDescription *fontDesc; + int fontSize; + /* get the current font descriptor */ + style = gtk_widget_get_style(temp); + fontDesc = style->font_desc; + /* get the current font size */ + fontSize = PANGO_PIXELS(pango_font_description_get_size(fontDesc)); + + /* calculate the new font size */ + if (flags & BM_LARGE) { + pango_font_description_set_size(fontDesc, fontSize * 1.4 * PANGO_SCALE); + } else { + pango_font_description_set_size(fontDesc, fontSize * 0.7 * PANGO_SCALE); + } + + /* set the new font size */ + gtk_widget_modify_font(temp, fontDesc); + } + + if (flags&1L) { + gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(temp),"Test"); + } + + GtkRequisition temp_requisition; + gtk_widget_size_request(temp,&temp_requisition); + g_object_ref_sink(temp); + gtk_widget_destroy(temp); + g_object_unref(temp); + return temp_requisition.height; } /** @@ -148,61 +148,61 @@ wPos_t wMessageGetHeight( */ wMessage_p wMessageCreateEx( - wWin_p parent, - wPos_t x, - wPos_t y, - const char * labelStr, - wPos_t width, - const char *message, - long flags) + wWin_p parent, + wWinPix_t x, + wWinPix_t y, + const char * labelStr, + wWinPix_t width, + const char *message, + long flags) { - wMessage_p b; - GtkRequisition requisition; - GtkStyle *style; - PangoFontDescription *fontDesc; - int fontSize; - b = (wMessage_p)wlibAlloc(parent, B_MESSAGE, x, y, NULL, sizeof *b, NULL); - wlibComputePos((wControl_p)b); - b->message = message; - b->labelWidth = width; - b->labelWidget = gtk_label_new(message?wlibConvertInput(message):""); - - /* do we need to set a special font? */ - if (wMessageSetFont(flags)) { - /* get the current font descriptor */ - style = gtk_widget_get_style(GTK_WIDGET(b->labelWidget)); - fontDesc = style->font_desc; - /* get the current font size */ - fontSize = PANGO_PIXELS(pango_font_description_get_size(fontDesc)); - - /* calculate the new font size */ - if (flags & BM_LARGE) { - pango_font_description_set_size(fontDesc, fontSize * 1.4 * PANGO_SCALE); - } else { - pango_font_description_set_size(fontDesc, fontSize * 0.7 * PANGO_SCALE); - } - - /* set the new font size */ - gtk_widget_modify_font((GtkWidget *)b->labelWidget, fontDesc); - } - - b->widget = gtk_fixed_new(); - gtk_widget_size_request(GTK_WIDGET(b->labelWidget), &requisition); - gtk_container_add(GTK_CONTAINER(b->widget), b->labelWidget); - gtk_widget_set_size_request(b->widget, width?width:requisition.width, - requisition.height); - wlibControlGetSize((wControl_p)b); - gtk_fixed_put(GTK_FIXED(parent->widget), b->widget, b->realX, b->realY); - gtk_widget_show(b->widget); - gtk_widget_show(b->labelWidget); - wlibAddButton((wControl_p)b); - - /* Reset font size to normal */ - if (wMessageSetFont(flags)) { - pango_font_description_set_size(fontDesc, fontSize * PANGO_SCALE); - } - - return b; + wMessage_p b; + GtkRequisition requisition; + GtkStyle *style; + PangoFontDescription *fontDesc; + int fontSize; + b = (wMessage_p)wlibAlloc(parent, B_MESSAGE, x, y, NULL, sizeof *b, NULL); + wlibComputePos((wControl_p)b); + b->message = message; + b->labelWidth = width; + b->labelWidget = gtk_label_new(message?wlibConvertInput(message):""); + + /* do we need to set a special font? */ + if (wMessageSetFont(flags)) { + /* get the current font descriptor */ + style = gtk_widget_get_style(GTK_WIDGET(b->labelWidget)); + fontDesc = style->font_desc; + /* get the current font size */ + fontSize = PANGO_PIXELS(pango_font_description_get_size(fontDesc)); + + /* calculate the new font size */ + if (flags & BM_LARGE) { + pango_font_description_set_size(fontDesc, fontSize * 1.4 * PANGO_SCALE); + } else { + pango_font_description_set_size(fontDesc, fontSize * 0.7 * PANGO_SCALE); + } + + /* set the new font size */ + gtk_widget_modify_font((GtkWidget *)b->labelWidget, fontDesc); + } + + b->widget = gtk_fixed_new(); + gtk_widget_size_request(GTK_WIDGET(b->labelWidget), &requisition); + gtk_container_add(GTK_CONTAINER(b->widget), b->labelWidget); + gtk_widget_set_size_request(b->widget, width?width:requisition.width, + requisition.height); + wlibControlGetSize((wControl_p)b); + gtk_fixed_put(GTK_FIXED(parent->widget), b->widget, b->realX, b->realY); + gtk_widget_show(b->widget); + gtk_widget_show(b->labelWidget); + wlibAddButton((wControl_p)b); + + /* Reset font size to normal */ + if (wMessageSetFont(flags)) { + pango_font_description_set_size(fontDesc, fontSize * PANGO_SCALE); + } + + return b; } /** @@ -212,13 +212,13 @@ wMessage_p wMessageCreateEx( * \return expected width of message box */ -wPos_t +wWinPix_t wMessageGetWidth(const char *testString) { - GtkWidget *entry; - GtkRequisition requisition; +// GtkWidget *entry; +// GtkRequisition requisition; - return( wLabelWidth(testString)); + return( wLabelWidth(testString)); // entry = gtk_entry_new(); // g_object_ref_sink(entry); // |