INDEX CLUSTER FEATURES SHORT FRAMES NO FRAMES

indexing

title: "Contains a list of strings from which the user can select. ", "Common ancestor of WEL_SINGLE_SELECTION_LIST_BOX and ", "WEL_MULTIPLE_SELECTION_LIST_BOX. ", "WEL: library of reusable components for Eiffel. ", "Based on WEL library for ISE Eiffel, used with permission. "
project: "Windows Eiffel Library"
copyright: "(c) 1986-1997 Interactive Software Engineering Inc. ", "Modifications and extensions: ", "(c) 1997-2001 Object Tools ", "All rights reserved. Duplication and distribution prohibited", "May be used only with Visual Eiffel under terms of user ", "license "
cluster: wel
deferred class WEL_LIST_BOX
inherit

WEL_CONTROL
rename
lb_addstring as wb_lb_addstring,
lb_deletestring as wb_lb_deletestring,
lb_dir as wb_lb_dir,
lb_getcount as wb_lb_getcount,
lb_getcursel as wb_lb_getcursel,
lb_getsel as wb_lb_getsel,
lb_gettext as wb_lb_gettext,
lb_gettextlen as wb_lb_gettextlen,
lb_gettopindex as wb_lb_gettopindex,
lb_insertstring as wb_lb_insertstring,
lb_resetcontent as wb_lb_resetcontent,
lb_selectstring as wb_lb_selectstring,
lb_selitemrangeex as wb_lb_selitemrangeex,
lb_setcursel as wb_lb_setcursel,
lb_setsel as wb_lb_setsel
redefine
process_notification
end

WEL_LBN_CONSTANTS
export
{NONE}
all
end

WEL_LB_CONSTANTS
export
{NONE}
all
end
feature -- Access

strings: ARRAY [STRING]
-- Strings contained in the list box
require
exists: exists
ensure
result_not_void: Result /= void
count_ok: Result.count = count

i_th_text (i: INTEGER): STRING
-- Text at the zero-based index `i'
require
exists: exists
i_large_enough: i >= 0
i_small_enough: i < count
ensure
result_exists: Result /= void
same_result_as_strings: Result.is_equal (strings.item (i))

i_th_text_length (i: INTEGER): INTEGER
-- Length text at the zero-based index `i'
require
exists: exists
i_large_enough: i >= 0
i_small_enough: i < count
ensure
positive_result: Result >= 0
same_result_as_strings: Result = strings.item (i).count
feature -- Element change

add_string (a_string: STRING)
-- Add `a_string' in the list box.
-- If the list box does not have the
-- `Lbs_sort' style, `a_string' is added
-- to the end of the list otherwise it is
-- inserted into the list and the list is
-- sorted.
require
exists: exists
a_string_not_void: a_string /= void
ensure
count_increased: count = count + 1

insert_string_at (a_string: STRING; index: INTEGER)
-- Add `a_string' at the zero-based `index'
require
exists: exists
a_string_not_void: a_string /= void
index_large_enough: index >= 0
index_small_enough: index <= count
ensure
count_increased: count = count + 1

delete_string (index: INTEGER)
-- Delete the item at the zero-based `index'
require
exists: exists
index_large_enough: index >= 0
index_small_enough: index < count
ensure
count_decreased: count = count - 1

add_files (attribut: INTEGER; files: STRING)
-- Add `files' to the list box. `files' may contain
-- wildcards (?*). See class WEL_DDL_CONSTANTS for
-- `attribut' values.
require
exists: exists
files_not_void: files /= void

reset_content
-- Reset the content of the list.
require
exists: exists
ensure
empty: count = 0
feature -- Status setting

set_top_index (index: INTEGER)
-- Ensure that the zero-based `index'
-- in the list box is visible.
require
exists: exists
index_large_enough: index >= 0
index_small_enough: index < count
ensure
top_index_set: top_index = index

select_item (index: INTEGER)
-- Select item at the zero-based `index'.
require
exists: exists
index_small_enough: index < count
index_large_enough: index >= 0
ensure
is_selected: is_selected (index)

set_horizontal_extent (a_width: INTEGER)
-- Set the width, in pixels, by which a list box can
-- be scrolled horizontally.
require
exists: exists
positive_width: width >= 0
ensure
horizontal_extent_set: horizontal_extent = a_width
feature -- Status report

selected: BOOLEAN
-- Is an item selected?
require
exists: exists

top_index: INTEGER
-- Index of the first visible item
require
exists: exists
ensure
result_large_enough: Result >= 0
result_small_enough: Result <= count

is_selected (index: INTEGER): BOOLEAN
-- Is item at position `index' selected?
require
exists: exists
index_large_enough: index >= 0
index_small_enough: index < count

item_height: INTEGER
-- Height of an item
require
exists: exists
ensure
positive_result: Result >= 0

horizontal_extent: INTEGER
-- Width, in pixels, by which the list box can be
-- scrolled horizontally
require
exists: exists
has_horizontal_scroll_bar: has_horizontal_scroll_bar
ensure
positive_result: Result >= 0
feature -- Basic operations

find_string (index: INTEGER; a_string: STRING): INTEGER
-- Find the first string that contains the
-- prefix `a_string'. `index' specifies the
-- zero-based index of the item before the first
-- item to be searched.
-- Returns -1 if the search was unsuccessful.
require
exists: exists
index_large_enough: index >= 0
index_small_enough: index < count
a_string_not_void: a_string /= void

find_string_exact (index: INTEGER; a_string: STRING): INTEGER
-- Find the first string that matches `a_string'.
-- `index' specifies the zero-based index of the
-- item before the first item to be searched.
-- Returns -1 if the search was unsuccessful.
require
exists: exists
index_large_enough: index >= 0
index_small_enough: index < count
a_string_not_void: a_string /= void
feature -- Measurement

count: INTEGER
-- Number of lines
require
exists: exists
ensure
positive_result: Result >= 0
feature -- Notifications

on_lbn_selchange
-- The selection is about to change
require
exists: exists

on_lbn_errspace
-- Cannot allocate enough memory
-- to meet a specific request
require
exists: exists

on_lbn_dblclk
-- Double click on a string
require
exists: exists

on_lbn_selcancel
-- Cancel the selection
require
exists: exists

on_lbn_setfocus
-- Receive the keyboard focus
require
exists: exists

on_lbn_killfocus
-- Lose the keyboard focus
require
exists: exists
invariant

consistent_count: exists and then selected implies count > 0
end -- class WEL_LIST_BOX

INDEX CLUSTER FEATURES SHORT FRAMES NO FRAMES