fdf5a0f0f6
* NEW: New code snippet to define a startup Main procedure. * NEW: In the open project dialog, selecting a project directory now displays the project contents inside a treeview, like the IDE does. [GB.QT4] * NEW: Some changes in the Font class: Font.Height is now a property that returns the font height, and Font.Width has been removed. Now, to compute the size of a text fragment, you must use Font.TextWidth() and Font.TextHeight(). Moreover, two new methods, Font.RichTextWidth() and Font.RichTextHeight() allow to compute the size of a rich text fragment. * BUG: When showing a form, the initial focus should be correctly set in all cases now. [GB.GTK] * NEW: Some changes in the Font class: Font.Height is now a property that returns the font height, and Font.Width has been removed. Now, to compute the size of a text fragment, you must use Font.TextWidth() and Font.TextHeight(). Moreover, two new methods, Font.RichTextWidth() and Font.RichTextHeight() allow to compute the size of a rich text fragment. git-svn-id: svn://localhost/gambas/trunk@3024 867c0c6c-44f3-4631-809d-bfa615b0a4ec
100 lines
2.5 KiB
C++
100 lines
2.5 KiB
C++
/***************************************************************************
|
|
|
|
gfont.h
|
|
|
|
(c) 2000-2009 Benoît Minisini <gambas@users.sourceforge.net>
|
|
|
|
This program 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, or (at your option)
|
|
any later version.
|
|
|
|
This program 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 program; if not, write to the Free Software
|
|
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
|
|
|
***************************************************************************/
|
|
#ifndef __GFONT_H
|
|
#define __GFONT_H
|
|
|
|
#include "gshare.h"
|
|
|
|
class gFont : public gShare
|
|
{
|
|
public:
|
|
gFont();
|
|
gFont(const char *name);
|
|
virtual ~gFont();
|
|
|
|
static void assign(gFont **dst, gFont *src = 0) { gShare::assign((gShare **)dst, src); }
|
|
static void set(gFont **dst, gFont *src = 0) { gShare::assign((gShare **)dst, src); src->unref(); }
|
|
|
|
static void init();
|
|
static void exit();
|
|
static int count();
|
|
static const char *familyItem(int pos);
|
|
|
|
gFont *copy();
|
|
void copyTo(gFont *dst);
|
|
void mergeFrom(gFont *src);
|
|
int ascent();
|
|
float ascentF();
|
|
int descent();
|
|
bool fixed();
|
|
bool scalable();
|
|
char **styles();
|
|
|
|
bool bold();
|
|
bool italic();
|
|
char* name();
|
|
int resolution();
|
|
double size();
|
|
bool strikeOut();
|
|
bool underline();
|
|
int grade();
|
|
|
|
void setBold(bool vl);
|
|
void setItalic(bool vl);
|
|
void setName(char *nm);
|
|
void setResolution(int vl);
|
|
void setSize(double sz);
|
|
void setGrade(int grade);
|
|
void setStrikeOut(bool vl);
|
|
void setUnderline(bool vl);
|
|
|
|
const char *toString();
|
|
const char *toFullString();
|
|
int width(const char *text, int len = -1);
|
|
int height(const char *text, int len = -1);
|
|
int height();
|
|
void richTextSize(char *txt, int len, int sw, int *w, int *h);
|
|
|
|
//"Private"
|
|
gFont(GtkWidget *wg);
|
|
gFont(PangoFontDescription *fd);
|
|
PangoContext* ct;
|
|
PangoFontDescription *desc() { return pango_context_get_font_description(ct); }
|
|
bool isAllSet();
|
|
void reset();
|
|
|
|
unsigned _bold_set : 1;
|
|
unsigned _italic_set : 1;
|
|
unsigned _name_set : 1;
|
|
unsigned _size_set : 1;
|
|
unsigned _strikeout_set : 1;
|
|
unsigned _underline_set : 1;
|
|
|
|
private:
|
|
|
|
bool uline;
|
|
bool strike;
|
|
void realize();
|
|
int _height;
|
|
};
|
|
|
|
#endif
|