diff options
author | XhmikosR <xhmikosr@users.sourceforge.net> | 2010-10-31 17:17:15 +0000 |
---|---|---|
committer | XhmikosR <xhmikosr@users.sourceforge.net> | 2010-10-31 17:17:15 +0000 |
commit | 88a9de8737ca5a2ba239d49e072660fc9c89ab25 (patch) | |
tree | b64f81588eafd28926ffc632c01f6b3c246e218d /scintilla/macosx/QuartzTextStyleAttribute.h | |
parent | e5eb2fe35699c79bef11a870fd4c111c040fc22c (diff) | |
download | notepad2-mod-88a9de8737ca5a2ba239d49e072660fc9c89ab25.zip notepad2-mod-88a9de8737ca5a2ba239d49e072660fc9c89ab25.tar.gz notepad2-mod-88a9de8737ca5a2ba239d49e072660fc9c89ab25.tar.bz2 |
add scintilla v2.12 in the svn
git-svn-id: https://notepad2-mod.googlecode.com/svn/trunk@3 28bd50df-7adb-d945-0439-6e466c6a13cc
Diffstat (limited to 'scintilla/macosx/QuartzTextStyleAttribute.h')
-rw-r--r-- | scintilla/macosx/QuartzTextStyleAttribute.h | 144 |
1 files changed, 144 insertions, 0 deletions
diff --git a/scintilla/macosx/QuartzTextStyleAttribute.h b/scintilla/macosx/QuartzTextStyleAttribute.h new file mode 100644 index 0000000..9ebbe0d --- /dev/null +++ b/scintilla/macosx/QuartzTextStyleAttribute.h @@ -0,0 +1,144 @@ +/*
+ * QuartzTextStyleAttribute.h
+ *
+ * Original Code by Evan Jones on Wed Oct 02 2002.
+ * Contributors:
+ * Shane Caraveo, ActiveState
+ * Bernd Paradies, Adobe
+ *
+ */
+
+
+#include <Carbon/Carbon.h>
+
+#ifndef _QUARTZ_TEXT_STYLE_ATTRIBUTE_H
+#define _QUARTZ_TEXT_STYLE_ATTRIBUTE_H
+
+class QuartzTextStyleAttribute
+{
+public:
+ QuartzTextStyleAttribute() {}
+ virtual ~QuartzTextStyleAttribute() {}
+ virtual ByteCount getSize() const = 0;
+ virtual ATSUAttributeValuePtr getValuePtr() = 0;
+ virtual ATSUAttributeTag getTag() const = 0;
+};
+
+class QuartzTextSize : public QuartzTextStyleAttribute
+{
+public:
+ QuartzTextSize( float points )
+ {
+ size = X2Fix( points );
+ }
+
+ ByteCount getSize() const
+ {
+ return sizeof( size );
+ }
+
+ ATSUAttributeValuePtr getValuePtr()
+ {
+ return &size;
+ }
+
+ ATSUAttributeTag getTag() const
+ {
+ return kATSUSizeTag;
+ }
+
+private:
+ Fixed size;
+};
+
+class QuartzTextStyleAttributeBoolean : public QuartzTextStyleAttribute
+{
+public:
+ QuartzTextStyleAttributeBoolean( bool newVal ) : value( newVal ) {}
+
+ ByteCount getSize() const
+ {
+ return sizeof( value );
+ }
+ ATSUAttributeValuePtr getValuePtr()
+ {
+ return &value;
+ }
+
+ virtual ATSUAttributeTag getTag() const = 0;
+
+private:
+ Boolean value;
+};
+
+class QuartzTextBold : public QuartzTextStyleAttributeBoolean
+{
+public:
+ QuartzTextBold( bool newVal ) : QuartzTextStyleAttributeBoolean( newVal ) {}
+ ATSUAttributeTag getTag() const
+ {
+ return kATSUQDBoldfaceTag;
+ }
+};
+
+class QuartzTextItalic : public QuartzTextStyleAttributeBoolean
+{
+public:
+ QuartzTextItalic( bool newVal ) : QuartzTextStyleAttributeBoolean( newVal ) {}
+ ATSUAttributeTag getTag() const
+ {
+ return kATSUQDItalicTag;
+ }
+};
+
+class QuartzTextUnderline : public QuartzTextStyleAttributeBoolean
+{
+public:
+ QuartzTextUnderline( bool newVal ) : QuartzTextStyleAttributeBoolean( newVal ) {}
+ ATSUAttributeTag getTag() const {
+ return kATSUQDUnderlineTag;
+ }
+};
+
+class QuartzFont : public QuartzTextStyleAttribute
+{
+public:
+ /** Create a font style from a name. */
+ QuartzFont( const char* name, int length )
+ {
+ assert( name != NULL && length > 0 && name[length] == '\0' );
+ // try to create font
+ OSStatus err = ATSUFindFontFromName( const_cast<char*>( name ), length, kFontFullName, (unsigned) kFontNoPlatform, kFontRomanScript, (unsigned) kFontNoLanguage, &fontid );
+
+ // need a fallback if font isn't installed
+ if( err != noErr || fontid == kATSUInvalidFontID )
+ ::ATSUFindFontFromName( "Lucida Grande", 13, kFontFullName, (unsigned) kFontNoPlatform, kFontRomanScript, (unsigned) kFontNoLanguage, &fontid );
+ }
+
+ ByteCount getSize() const
+ {
+ return sizeof( fontid );
+ }
+
+ ATSUAttributeValuePtr getValuePtr()
+ {
+ return &fontid;
+ }
+
+ ATSUAttributeTag getTag() const
+ {
+ return kATSUFontTag;
+ }
+
+ ATSUFontID getFontID() const
+ {
+ return fontid;
+ }
+
+private:
+ ATSUFontID fontid;
+};
+
+
+#endif
+
|