123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402 |
- class IUP_COLOR_BAR
- inherit
- IUP_CONTROLS
- redefine
- set_size,
- execute_cell,
- execute_extended,
- execute_select,
- execute_switch
- end
- create {ANY}
- color_bar
- feature {ANY}
- color_bar
- local
- a_color_bar: POINTER
- do
- a_color_bar := int_color_bar
- set_widget(a_color_bar)
- end
-
- set_bufferize (state: BOOLEAN)
-
-
-
- do
- iup_open.set_attribute(Current, "BUFFERIZE", boolean_to_yesno(state))
- end
- set_cell_n_color (n, red, green, blue: INTEGER)
-
-
- do
- iup_open.set_attribute_id(Current, "CELL", n, rgb_to_string(red, green, blue))
- end
- get_cell_n_color (n: INTEGER): TUPLE[INTEGER, INTEGER, INTEGER]
-
-
- local
- cl: STRING
- do
- cl := iup_open.get_attribute_id(Current, "CELL", n)
- Result := string_to_rgb(cl)
- end
- set_number_of_cells (n: INTEGER)
-
-
-
- require
- n > 0
- do
- iup_open.set_attribute(Current, "NUM_CELLS", n.out)
- end
- get_count: INTEGER
-
- do
- Result := iup_open.get_int(Current, "COUNT")
- end
- set_number_of_parts (num: INTEGER)
-
- require
- num > 0
- do
- iup_open.set_attribute(Current, "NUM_PARTS", num.out)
- end
- get_number_of_parts: INTEGER
-
- do
- Result := iup_open.get_int(Current, "NUM_PARTS")
- end
- set_horizontal_orientation
- do
- iup_open.set_attribute(Current, "ORIENTATION", "HORIZONTAL")
- end
- set_vertical_orientation
-
- do
- iup_open.set_attribute(Current, "ORIENTATION", "VERTICAL")
- end
- is_horizontal: BOOLEAN
- local
- str: STRING
- do
- str := iup_open.get_attribute(Current, "ORIENTATION")
- if str.is_equal("HORIZONTAL") then
- Result := True
- else
- Result := False
- end
- end
- is_vertical: BOOLEAN
- local
- str: STRING
- do
- str := iup_open.get_attribute(Current, "ORIENTATION")
- if str.is_equal("VERTICAL") then
- Result := True
- else
- Result := False
- end
- end
- set_preview_size (width, height: INTEGER)
-
-
-
-
- require
- width > 0
- height > 0
- local
- size: STRING
- do
- size := width.out
- size.append_string("x")
- size.append_string(height.out)
-
- iup_open.set_attribute(Current, "PREVIEW_SIZE", size)
- end
- set_show_preview (state: BOOLEAN)
-
- do
- iup_open.set_attribute(Current, "SHOW_PREVIEW", boolean_to_yesno(state))
- end
- set_show_secondary (state: BOOLEAN)
-
-
- do
- iup_open.set_attribute(Current, "SHOW_SECONDARY", boolean_to_yesno(state))
- end
- set_size (width, height: INTEGER)
-
-
-
- do
- Precursor (width, height)
- end
- set_primary_cell (index: INTEGER)
-
-
- require
- index >= 0
- do
- iup_open.set_attribute(Current, "PRIMARY_CELL", index.out)
- end
- get_primary_cell: INTEGER
-
- do
- Result := iup_open.get_int(Current, "PRIMARY_CELL")
- end
- set_seconday_cell (index: INTEGER)
-
-
- require
- index >= 0
- do
- iup_open.set_attribute(Current, "SECONDARY_CELL", index.out)
- end
- get_secondary_cell: INTEGER
-
- do
- Result := iup_open.get_int(Current, "SECONDARY_CELL")
- end
- set_squared (state: BOOLEAN)
-
-
- do
- iup_open.set_attribute(Current, "SQUARED", boolean_to_yesno(state))
- end
- set_shadowed (state: BOOLEAN)
-
- do
- iup_open.set_attribute(Current, "SHADOWED", boolean_to_yesno(state))
- end
- set_transparency (red, green, blue: INTEGER)
-
-
-
- do
- iup_open.set_attribute(Current, "TRANSPARENCY", rgb_to_string(red, green, blue))
- end
-
- set_cb_cell (act: detachable FUNCTION[TUPLE[IUP_COLOR_BAR, INTEGER], TUPLE[INTEGER, INTEGER, INTEGER]])
-
-
-
-
-
-
-
-
- local
- operation: INTEGER
- do
- cb_cell := act
- if cb_cell /= Void then
- operation := 1
- else
- operation := 0
- end
-
- iup_open.set_callback (Current, "CELL_CB", "NONEEDED", operation)
- end
- set_cb_extended (act: detachable FUNCTION[TUPLE[IUP_COLOR_BAR, INTEGER], STRING])
-
-
- local
- operation: INTEGER
- do
- cb_extended := act
- if cb_extended /= Void then
- operation := 1
- else
- operation := 0
- end
-
- iup_open.set_callback (Current, "EXTENDED_CB", "NONEEDED", operation)
- end
- set_cb_select (act: detachable FUNCTION[TUPLE[IUP_COLOR_BAR, INTEGER, INTEGER], STRING])
-
-
-
-
-
-
-
-
-
-
-
- local
- operation: INTEGER
- do
- cb_select := act
- if cb_select /= Void then
- operation := 1
- else
- operation := 0
- end
-
- iup_open.set_callback (Current, "SELECT_CB", "NONEEDED", operation)
- end
- set_cb_switch (act: detachable FUNCTION[TUPLE[IUP_COLOR_BAR, INTEGER, INTEGER], STRING])
-
-
-
-
-
-
-
-
-
-
- local
- operation: INTEGER
- do
- cb_switch := act
- if cb_switch /= Void then
- operation := 1
- else
- operation := 0
- end
-
- iup_open.set_callback (Current, "SWITCH_CB", "NONEEDED", operation)
- end
- feature {IUP}
- execute_cell (cell: INTEGER): TUPLE[INTEGER, INTEGER, INTEGER]
- do
- if attached cb_cell as int_cb then
- Result := int_cb.item([Current, cell])
- else
- Result := [0, 0, 0]
- end
- end
- execute_extended (cell: INTEGER): STRING
- do
- if attached cb_extended as int_cb then
- Result := int_cb.item([Current, cell])
- else
- Result := "IUP_DEFAULT"
- end
- end
- execute_select (cell, type: INTEGER): STRING
- local
- i: INTEGER
- do
- if attached cb_select as int_cb then
- i := -1*type
-
- Result := int_cb.item([Current, cell, i])
- else
- Result := "IUP_DEFAULT"
- end
- end
- execute_switch (prim_cell, sec_cell: INTEGER): STRING
- do
- if attached cb_switch as int_cb then
- Result := int_cb.item([Current, prim_cell, sec_cell])
- else
- Result := "IUP_DEFAULT"
- end
- end
- feature {NONE}
- cb_cell: detachable FUNCTION[TUPLE[IUP_COLOR_BAR, INTEGER], TUPLE[INTEGER, INTEGER, INTEGER]]
- cb_extended: detachable FUNCTION[TUPLE[IUP_COLOR_BAR, INTEGER], STRING]
- cb_select: detachable FUNCTION[TUPLE[IUP_COLOR_BAR, INTEGER, INTEGER], STRING]
- cb_switch: detachable FUNCTION[TUPLE[IUP_COLOR_BAR, INTEGER, INTEGER], STRING]
-
- int_color_bar: POINTER
- external
- "C inline use %"eiffel-iup.h%""
- alias
- "return IupColorbar();"
- end
- end
|