summaryrefslogtreecommitdiff
path: root/src/ui/listwidget.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/ui/listwidget.h')
-rw-r--r--src/ui/listwidget.h69
1 files changed, 69 insertions, 0 deletions
diff --git a/src/ui/listwidget.h b/src/ui/listwidget.h
new file mode 100644
index 00000000..38bdebc9
--- /dev/null
+++ b/src/ui/listwidget.h
@@ -0,0 +1,69 @@
1/* Copyright 2020 Jaakko Keränen <jaakko.keranen@iki.fi>
2
3Redistribution and use in source and binary forms, with or without
4modification, are permitted provided that the following conditions are met:
5
61. Redistributions of source code must retain the above copyright notice, this
7 list of conditions and the following disclaimer.
82. Redistributions in binary form must reproduce the above copyright notice,
9 this list of conditions and the following disclaimer in the documentation
10 and/or other materials provided with the distribution.
11
12THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
13ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
14WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
15DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
16ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
17(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
18LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
19ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
20(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
21SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */
22
23#pragma once
24
25#include "scrollwidget.h"
26#include "paint.h"
27
28#include <the_Foundation/ptrarray.h>
29
30iDeclareType(ListWidget)
31
32iBeginDeclareClass(ListItem)
33 void (*draw) (const iAnyObject *, iPaint *p, iRect rect, const iListWidget *list);
34iEndDeclareClass(ListItem)
35
36iDeclareType(ListItem)
37
38 struct Impl_ListItem {
39 iObject object;
40 iBool isSeparator;
41 iBool isSelected;
42};
43
44iDeclareObjectConstruction(ListItem)
45
46iDeclareWidgetClass(ListWidget)
47iDeclareObjectConstruction(ListWidget)
48
49void setItemHeight_ListWidget(iListWidget *, int itemHeight);
50
51void invalidate_ListWidget (iListWidget *);
52void clear_ListWidget (iListWidget *);
53void addItem_ListWidget (iListWidget *, iAnyObject *item);
54
55iScrollWidget * scroll_ListWidget (iListWidget *);
56
57int scrollPos_ListWidget (const iListWidget *);
58
59void setScrollPos_ListWidget (iListWidget *, int pos);
60void scrollOffset_ListWidget (iListWidget *, int offset);
61void updateVisible_ListWidget (iListWidget *);
62void updateMouseHover_ListWidget (iListWidget *);
63
64size_t numItems_ListWidget (const iListWidget *);
65size_t itemIndex_ListWidget(const iListWidget *, iInt2 pos);
66const iAnyObject *constHoverItem_ListWidget(const iListWidget *);
67iAnyObject *hoverItem_ListWidget(iListWidget *);
68
69iBool isMouseDown_ListWidget (const iListWidget *);