123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502 |
- class IUP_FORMATTING
- inherit
- IUP_USER
- rename
- user as formatting
- select
- clear_attributes
- end
- IUP_WIDGET_TEXT_SELECTION
- create {ANY}
- formatting
- feature {ANY}
-
- set_bulk (state: BOOLEAN)
-
-
- do
- iup_open.set_attribute(Current, "BULK", boolean_to_yesno(state))
- end
- set_clean_out (state: BOOLEAN)
-
-
- do
- iup_open.set_attribute(Current, "CLEANOUT", boolean_to_yesno(state))
- end
- set_multiline_selection (lin1, col1, lin2, col2: INTEGER)
-
-
-
-
-
-
-
- local
- str: STRING
- do
- str := lin1.out
- str.append_string(",")
- str.append_string(col1.out)
- str.append_string(":")
- str.append_string(lin2.out)
- str.append_string(",")
- str.append_string(col2.out)
-
- iup_open.set_attribute(Current, "SELECTION", str)
- end
- get_multiline_selection: TUPLE[INTEGER, INTEGER, INTEGER, INTEGER]
-
-
-
- local
- str: STRING
- i, c: INTEGER
- pos1, pos2: STRING
- tup1, tup2: TUPLE[INTEGER, INTEGER]
- tup: TUPLE[INTEGER, INTEGER, INTEGER, INTEGER]
- do
- str := iup_open.get_attribute(Current, "SELECTION")
- if str.has(':') then
- i := str.index_of(':', 1)
- c := str.count
-
- if not i.is_equal(1) then
- pos1 := str.substring(1, i - 1)
- else
- pos1 := "0,0"
- end
-
- if not i.is_equal(c) then
- pos2 := str.substring(i + 1, c)
- else
- pos2 := "0,0"
- end
- tup1 := components_of_position(pos1)
- tup2 := components_of_position(pos2)
- tup := [tup1.integer_32_item(1), tup1.integer_32_item(2), tup2.integer_32_item(1), tup2.integer_32_item(2)]
- Result := tup
- else
- io.put_string("Unable to get the components %N")
- Result := [0, 0, 0, 0]
- end
- end
- set_units (value: STRING)
-
-
-
- require
- are_valid_units(value)
- do
- iup_open.set_attribute(Current, "UNITS", value)
- end
-
- set_alignment (value: STRING)
-
- require
- is_valid_alignment(value)
- do
- iup_open.set_attribute(Current, "ALIGNMENT", value)
- end
- set_indent (value: INTEGER)
-
-
-
-
-
- require
- value >= 0
- do
- iup_open.set_attribute(Current, "INDENT", value.out)
- end
- set_indent_right (value: INTEGER)
-
- require
- value >= 0
- do
- iup_open.set_attribute(Current, "INDENTRIGHT", value.out)
- end
- set_indent_offset (value: INTEGER)
-
-
- require
- value >= 0
- do
- iup_open.set_attribute(Current, "INDENTOFFSET", value.out)
- end
- set_line_spacing (value: INTEGER)
-
- do
- iup_open.set_attribute(Current, "LINESPACING", value.out)
- end
- set_single_line_spacing
-
-
- do
- iup_open.set_attribute(Current, "LINESPACING", "SINGLE")
- end
- set_onehalf_line_spacing
-
-
- do
- iup_open.set_attribute(Current, "LINESPACING", "ONEHALF")
- end
- set_double_line_spacing
-
-
- do
- iup_open.set_attribute(Current, "LINESPACING", "DOUBLE")
- end
- set_numbering (value: STRING)
-
-
-
-
-
- require
- is_valid_numbering(value)
- do
- iup_open.set_attribute(Current, "NUMBERING", value)
- end
- set_numbering_style (value: STRING)
-
-
-
- require
- is_valid_numbering_style(value)
- do
- iup_open.set_attribute(Current, "NUMBERINGSTYLE", value)
- end
- set_numbering_tab (value: INTEGER)
-
-
- require
- value >= 0
- do
- iup_open.set_attribute(Current, "NUMBERINGTAB", value.out)
- end
- set_space_after (value: INTEGER)
-
- require
- value >= 0
- do
- iup_open.set_attribute(Current, "SPACEAFTER", value.out)
- end
- set_space_before (value: INTEGER)
-
- require
- value >= 0
- do
- iup_open.set_attribute(Current, "SPACEBEFORE", value.out)
- end
- set_tabs_array (value: STRING)
-
-
-
-
-
-
- do
- iup_open.set_attribute(Current, "TABSARRAY", value)
- end
-
- set_rgb_background_color (red: INTEGER; green: INTEGER; blue: INTEGER)
-
- do
- iup_open.set_attribute(Current, "BGCOLOR",
- rgb_to_string(red, green, blue))
- end
- set_disabled (state: BOOLEAN)
-
-
- do
- iup_open.set_attribute(Current, "DISABLED", boolean_to_yesno(state))
- end
- set_rgb_foreground_color (red: INTEGER; green: INTEGER; blue: INTEGER)
-
- do
- iup_open.set_attribute(Current, "FGCOLOR",
- rgb_to_string(red, green, blue))
- end
- set_font_scale (value: REAL_32)
-
-
-
- require
- value >= ((0).to_real)
- do
- iup_open.set_attribute(Current, "FONTSCALE", value.out)
- end
- set_string_font_scale (value: STRING)
-
-
-
- require
- is_valid_font_scale(value)
- do
- iup_open.set_attribute(Current, "FONTSCALE", value)
- end
- set_fontface (fontface: STRING)
-
- do
- iup_open.set_attribute(Current, "FONTFACE", fontface)
- end
- set_fontsize (fontsize: INTEGER)
-
-
- do
- iup_open.set_attribute(Current, "FONTSIZE", fontsize.out)
- end
- set_italic (state: BOOLEAN)
-
- do
- iup_open.set_attribute(Current, "ITALIC", boolean_to_yesno(state))
- end
- set_language (value: STRING)
-
-
- do
- iup_open.set_attribute(Current, "LANGUAGE", value)
- end
- set_rise (value: INTEGER)
-
- do
- iup_open.set_attribute(Current, "RISE", value.out)
- end
- set_superscript
- do
- iup_open.set_attribute(Current, "RISE", "SUPERSCRIPT")
- end
- set_subscript
- do
- iup_open.set_attribute(Current, "RISE", "SUBSCRIPT")
- end
- set_smallcaps (state: BOOLEAN)
-
- do
- iup_open.set_attribute(Current, "SMALLCAPS", boolean_to_yesno(state))
- end
- set_protected (state: BOOLEAN)
-
- do
- iup_open.set_attribute(Current, "PROTECTED", boolean_to_yesno(state))
- end
- set_stretch (value: STRING)
-
-
-
- require
- is_valid_stretch(value)
- do
- iup_open.set_attribute(Current, "STRETCH", value)
- end
- set_strikeout (state: BOOLEAN)
-
- do
- iup_open.set_attribute(Current, "STRIKEOUT", boolean_to_yesno(state))
- end
- set_underline (value: STRING)
-
-
- require
- is_valid_underline(value)
- do
- iup_open.set_attribute(Current, "UNDERLINE", value)
- end
- set_weight (value: STRING)
-
-
- require
- is_valid_weight(value)
- do
- iup_open.set_attribute(Current, "WEIGHT", value)
- end
-
- is_valid_alignment (value: STRING): BOOLEAN
- do
- if value.is_equal("JUSTIFY") or
- value.is_equal("RIGHT") or
- value.is_equal("CENTER") or
- value.is_equal("LEFT") then
- Result := True
- else
- Result := False
- end
- end
- is_valid_numbering (value: STRING): BOOLEAN
- do
- if value.is_equal("BULLET") or
- value.is_equal("ARABIC") or
- value.is_equal("LCLETTER") or
- value.is_equal("UCLETTER") or
- value.is_equal("LCROMAN") or
- value.is_equal("UCROMAN") or
- value.is_equal("NONE") then
- Result := True
- else
- Result := False
- end
- end
- is_valid_numbering_style (value: STRING): BOOLEAN
- do
- if value.is_equal("RIGHTPARENTESES") or
- value.is_equal("PARENTESES") or
- value.is_equal("PERIOD") or
- value.is_equal("NONUMBER") or
- value.is_equal("NONE") then
- Result := True
- else
- Result := False
- end
- end
- are_valid_units (value: STRING): BOOLEAN
- do
- if value.is_equal("TWIP") or
- value.is_equal("PIXELS") then
- Result := True
- else
- Result := False
- end
- end
- is_valid_font_scale (value: STRING): BOOLEAN
- do
- if value.is_equal("XX-SMALL") or
- value.is_equal("X-SMALL") or
- value.is_equal("SMALL") or
- value.is_equal("MEDIUM") or
- value.is_equal("LARGE") or
- value.is_equal("X-LARGE") or
- value.is_equal("XX-LARGE") then
- Result := True
- else
- Result := False
- end
- end
- is_valid_stretch (value: STRING): BOOLEAN
- do
- if value.is_equal("EXTRA_CONDENSED") or
- value.is_equal("CONDENSED") or
- value.is_equal("SEMI_CONDENSED") or
- value.is_equal("NORMAL") or
- value.is_equal("SEMI_EXPANDED") or
- value.is_equal("EXPANDED") or
- value.is_equal("EXTRA_EXPANDED") then
- Result := True
- else
- Result := False
- end
- end
- is_valid_underline (value: STRING): BOOLEAN
- do
- if value.is_equal("SINGLE") or
- value.is_equal("DOUBLE") or
- value.is_equal("DOTTED") or
- value.is_equal("NONE") then
- Result := True
- else
- Result := False
- end
- end
- is_valid_weight (value: STRING): BOOLEAN
- do
- if value.is_equal("EXTRALIGHT") or
- value.is_equal("LIGHT") or
- value.is_equal("NORMAL") or
- value.is_equal("SEMIBOLD") or
- value.is_equal("BOLD") or
- value.is_equal("EXTRABOLD") or
- value.is_equal("HEAVY") then
- Result := True
- else
- Result := False
- end
- end
- end
|