diff options
author | Pierre Ossman <ossman@cendio.se> | 2011-05-16 12:04:43 +0000 |
---|---|---|
committer | Pierre Ossman <ossman@cendio.se> | 2011-05-16 12:04:43 +0000 |
commit | d463b57681c875f096e32250919e5a23f58a439a (patch) | |
tree | a2d94e3b5f45c75f3d52222edc65b9b7a3cc15ab /vncviewer/fltk_layout.h | |
parent | 2b006fd93177653cdb4ae87220265f52a34a0d65 (diff) | |
download | tigervnc-d463b57681c875f096e32250919e5a23f58a439a.tar.gz tigervnc-d463b57681c875f096e32250919e5a23f58a439a.zip |
Initial options dialog (read-only) loosly based on the Unix vncviewer.
git-svn-id: svn://svn.code.sf.net/p/tigervnc/code/trunk@4416 3789f03b-4d11-0410-bbf8-ca57d06f2519
Diffstat (limited to 'vncviewer/fltk_layout.h')
-rw-r--r-- | vncviewer/fltk_layout.h | 86 |
1 files changed, 86 insertions, 0 deletions
diff --git a/vncviewer/fltk_layout.h b/vncviewer/fltk_layout.h new file mode 100644 index 00000000..5119188c --- /dev/null +++ b/vncviewer/fltk_layout.h @@ -0,0 +1,86 @@ +/* Copyright 2011 Pierre Ossman <ossman@cendio.se> for Cendio AB + * + * This is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This software is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this software; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, + * USA. + */ + +#ifndef __FLTK_LAYOUT_H__ +#define __FLTK_LAYOUT_H__ + +#include <FL/fl_draw.H> + +/* Calculates the width of a string as printed by FLTK (pixels) */ +static inline int gui_str_len(const char *str) +{ + float len; + + fl_font(FL_HELVETICA, FL_NORMAL_SIZE); + + len = fl_width(str); + + return (int)(len + 0.5f); +} + +/**** MARGINS ****/ + +#define OUTER_MARGIN 10 +#define INNER_MARGIN 10 + +/* Tighter grouping of related fields */ +#define TIGHT_MARGIN 5 + +/**** ADJUSTMENTS ****/ +#define INDENT 20 + +/**** FLTK WIDGETS ****/ + +/* Fl_Tabs */ +#define TABS_HEIGHT 30 + +/* Fl_Input */ +#define INPUT_LABEL_OFFSET FL_NORMAL_SIZE +#define INPUT_HEIGHT 25 + +/* Fl_Button */ +#define BUTTON_WIDTH 115 +#define BUTTON_HEIGHT 27 + +/* Fl_Round_Button */ +#define RADIO_MIN_WIDTH (FL_NORMAL_SIZE + 5) +#define RADIO_HEIGHT (FL_NORMAL_SIZE + 7) + +/* Fl_Check_Button */ +#define CHECK_MIN_WIDTH RADIO_MIN_WIDTH +#define CHECK_HEIGHT RADIO_HEIGHT + +/* Fl_Group */ +#define GROUP_LABEL_OFFSET FL_NORMAL_SIZE +#define GROUP_MARGIN 12 + +/**** HELPERS FOR DYNAMIC TEXT ****/ + +/* Extra space to add after any text line */ +#define TEXT_PADDING 2 + +/* Use this when the text extends to the right (e.g. checkboxes) */ +#define LBLRIGHT(x, y, w, h, str) \ + (x), (y), (w) + gui_str_len(str) + TEXT_PADDING, (h), (str) + +/* Use this when the space for the label is taken from the left (e.g. input) */ +#define LBLLEFT(x, y, w, h, str) \ + (x) + (gui_str_len(str) + TEXT_PADDING), (y), \ + (w) - (gui_str_len(str) + TEXT_PADDING), (h), (str) + +#endif |