Git-Url: 
http://git.frugalware.org/gitweb/gitweb.cgi?p=fwsetup-ng.git;a=commitdiff;h=946f79879a518c899b192ecab5f2ace8dac97475

commit 946f79879a518c899b192ecab5f2ace8dac97475
Author: James Buren <[email protected]>
Date:   Sat Sep 8 07:53:23 2012 -0500

add function for measuring checkbox dimensions

diff --git a/src/local.h b/src/local.h
index 68a21c6..95a69d0 100644
--- a/src/local.h
+++ b/src/local.h
@@ -61,6 +61,7 @@ extern int get_text_screen_width(const char *s);
extern bool get_text_screen_size(const char *text,int *width,int *height);
extern bool get_button_screen_size(const char *text,int *width,int *height);
extern bool get_label_screen_size(const char *text,int *width,int *height);
+extern bool get_checkbox_screen_size(const char *text,int *width,int *height);
static inline long min(long a,long b) { return (a < b) ? a : b; }
static inline long max(long a,long b) { return (a > b) ? a : b; }
static inline long minv(long *v,size_t size)
@@ -87,6 +88,7 @@ extern bool ui_dialog_yesno(const char *title,const char 
*text,bool defaultno);
extern bool ui_dialog_progress(const char *title,const char *text,int percent);
extern bool ui_window_root(struct account *data);
extern bool ui_window_user(struct account *data);
+extern bool ui_window_time(char **data,char **zone,bool *utc);
extern bool ui_window_install(struct install *groups);
extern FILE *logfile;
extern int main(int argc,char **argv);
diff --git a/src/utility.c b/src/utility.c
index 47da87e..828daec 100644
--- a/src/utility.c
+++ b/src/utility.c
@@ -333,3 +333,29 @@ extern bool get_label_screen_size(const char *text,int 
*width,int *height)

return true;
}
+
+extern bool get_checkbox_screen_size(const char *text,int *width,int *height)
+{
+  int w = 0;
+  int h = 0;
+
+  if(text == 0 || width == 0 || height == 0)
+  {
+    errno = EINVAL;
+    fprintf(logfile,"%s: %s\n",__func__,strerror(errno));
+    return false;
+  }
+
+  if((w = get_text_screen_width(text)) == -1)
+    return false;
+
+  w += 4;
+
+  h = 1;
+
+  *width = w;
+
+  *height = h;
+
+  return true;
+}
_______________________________________________
Frugalware-git mailing list
[email protected]
http://frugalware.org/mailman/listinfo/frugalware-git

Reply via email to