Something went wrong. Try again.
Reactos
Something went wrong. Try again.
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224/* * GdiPlusStringFormat.h * * Windows GDI+ * * This file is part of the w32api package. * * THIS SOFTWARE IS NOT COPYRIGHTED * * This source code is offered for use in the public domain. You may * use, modify or distribute it freely. * * This code is distributed in the hope that it will be useful but * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY * DISCLAIMED. This includes but is not limited to warranties of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. */
#ifndef _GDIPLUSSTRINGFORMAT_H#define _GDIPLUSSTRINGFORMAT_H
class StringFormat : public GdiplusBase{ public: StringFormat(INT formatFlags = 0, LANGID language = LANG_NEUTRAL) : nativeFormat(NULL) { lastStatus = DllExports::GdipCreateStringFormat(formatFlags, language, &nativeFormat); }
StringFormat(const StringFormat *format) : nativeFormat(NULL) { lastStatus = DllExports::GdipCloneStringFormat(format ? format->nativeFormat : NULL, &nativeFormat); }
StringFormat * Clone() const { GpStringFormat *cloneFormat = NULL;
lastStatus = DllExports::GdipCloneStringFormat(nativeFormat, &cloneFormat); if (lastStatus != Ok) return NULL;
StringFormat *newFormat = new StringFormat(cloneFormat, lastStatus); if (!newFormat) DllExports::GdipDeleteStringFormat(cloneFormat); return newFormat; }
~StringFormat() { DllExports::GdipDeleteStringFormat(nativeFormat); }
static const StringFormat * GenericDefault() { return NULL; // FIXME }
static const StringFormat * GenericTypographic() { return NULL; // FIXME }
StringAlignment GetAlignment() const { StringAlignment alignment; SetStatus(DllExports::GdipGetStringFormatAlign(nativeFormat, &alignment)); return alignment; }
LANGID GetDigitSubstitutionLanguage() const { LANGID language; SetStatus(DllExports::GdipGetStringFormatDigitSubstitution(nativeFormat, &language, NULL)); return language; }
StringDigitSubstitute GetDigitSubstitutionMethod() const { StringDigitSubstitute substitute; SetStatus(DllExports::GdipGetStringFormatDigitSubstitution(nativeFormat, NULL, &substitute)); return substitute; }
INT GetFormatFlags() const { INT flags; SetStatus(DllExports::GdipGetStringFormatFlags(nativeFormat, &flags)); return flags; }
HotkeyPrefix GetHotkeyPrefix() const { HotkeyPrefix hotkeyPrefix; SetStatus(DllExports::GdipGetStringFormatHotkeyPrefix(nativeFormat, reinterpret_cast<INT *>(&hotkeyPrefix))); return hotkeyPrefix; }
Status GetLastStatus() const { return lastStatus; }
StringAlignment GetLineAlignment() const { StringAlignment alignment; SetStatus(DllExports::GdipGetStringFormatLineAlign(nativeFormat, &alignment)); return alignment; }
INT GetMeasurableCharacterRangeCount() const { INT count; SetStatus(DllExports::GdipGetStringFormatMeasurableCharacterRangeCount(nativeFormat, &count)); return count; }
INT GetTabStopCount() const { INT count; SetStatus(DllExports::GdipGetStringFormatTabStopCount(nativeFormat, &count)); return count; }
Status GetTabStops(INT count, REAL *firstTabOffset, REAL *tabStops) const { return SetStatus(DllExports::GdipGetStringFormatTabStops(nativeFormat, count, firstTabOffset, tabStops)); }
StringTrimming GetTrimming() const { StringTrimming trimming; SetStatus(DllExports::GdipGetStringFormatTrimming(nativeFormat, &trimming)); return trimming; }
Status SetAlignment(StringAlignment align) { return SetStatus(DllExports::GdipSetStringFormatAlign(nativeFormat, align)); }
Status SetDigitSubstitution(LANGID language, StringDigitSubstitute substitute) { return SetStatus(DllExports::GdipSetStringFormatDigitSubstitution(nativeFormat, language, substitute)); }
Status SetFormatFlags(INT flags) { return SetStatus(DllExports::GdipSetStringFormatFlags(nativeFormat, flags)); }
Status SetHotkeyPrefix(HotkeyPrefix hotkeyPrefix) { return SetStatus(DllExports::GdipSetStringFormatHotkeyPrefix(nativeFormat, INT(hotkeyPrefix))); }
Status SetLineAlignment(StringAlignment align) { return SetStatus(DllExports::GdipSetStringFormatLineAlign(nativeFormat, align)); }
Status SetMeasurableCharacterRanges(INT rangeCount, const CharacterRange *ranges) { return SetStatus(DllExports::GdipSetStringFormatMeasurableCharacterRanges(nativeFormat, rangeCount, ranges)); }
Status SetTabStops(REAL firstTabOffset, INT count, const REAL *tabStops) { return SetStatus(DllExports::GdipSetStringFormatTabStops(nativeFormat, firstTabOffset, count, tabStops)); }
Status SetTrimming(StringTrimming trimming) { return SetStatus(DllExports::GdipSetStringFormatTrimming(nativeFormat, trimming)); }
protected: GpStringFormat *nativeFormat; mutable Status lastStatus;
StringFormat(GpStringFormat *format, Status status) : nativeFormat(format), lastStatus(status) { }
Status SetStatus(Status status) const { if (status != Ok) lastStatus = status; return status; }
// get native friend inline GpStringFormat *& getNat(const StringFormat *sf) { return const_cast<StringFormat *>(sf)->nativeFormat; }};
#endif /* _GDIPLUSSTRINGFORMAT_H */