Merging NList MCC 0.119 into the main branch.
[AROS.git] / workbench / classes / zune / nlist / nlist_mcc / NList_func.h
blob5dfc8dcd75e4b27b6a41ef48bb57b6e94d2ab017
1 /***************************************************************************
3 NList.mcc - New List MUI Custom Class
4 Registered MUI class, Serial Number: 1d51 0x9d510030 to 0x9d5100A0
5 0x9d5100C0 to 0x9d5100FF
7 Copyright (C) 1996-2001 by Gilles Masson
8 Copyright (C) 2001-2014 NList Open Source Team
10 This library is free software; you can redistribute it and/or
11 modify it under the terms of the GNU Lesser General Public
12 License as published by the Free Software Foundation; either
13 version 2.1 of the License, or (at your option) any later version.
15 This library is distributed in the hope that it will be useful,
16 but WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 Lesser General Public License for more details.
20 NList classes Support Site: http://www.sf.net/projects/nlist-classes
22 $Id$
24 ***************************************************************************/
26 #define PMIN -30000
27 #define PMAX 30000
29 #define NTF_SB ((LONG) (1<<0))
30 #define NTF_VSB ((LONG) (1<<1))
31 #define NTF_HSB ((LONG) (1<<2))
32 #define NTF_First ((LONG) (1<<3))
33 #define NTF_Entries ((LONG) (1<<4))
34 #define NTF_Active ((LONG) (1<<5))
35 #define NTF_L_Active ((LONG) (1<<6))
36 #define NTF_Select ((LONG) (1<<7))
37 #define NTF_LV_Select ((LONG) (1<<8))
38 #define NTF_Multiclick ((LONG) (1<<9))
39 #define NTF_Doubleclick ((LONG) (1<<10))
40 #define NTF_LV_Doubleclick ((LONG) (1<<11))
41 #define NTF_TitleClick ((LONG) (1<<12))
42 #define NTF_EntryClick ((LONG) (1<<13))
43 #define NTF_MinMax ((LONG) (1<<14))
44 #define NTF_MinMaxNoDraw ((LONG) (1<<15))
45 #define NTF_ButtonClick ((LONG) (1<<16))
46 #define NTF_LineHeight ((LONG) (1<<17))
47 #define NTF_Insert ((LONG) (1<<18))
48 #define NTF_DragSortInsert ((LONG) (1<<19))
49 #define NTF_Columns ((LONG) (1<<20))
50 #define NTF_MulticlickAlone ((LONG) (1<<21))
51 #define NTF_TitleClick2 ((LONG) (1<<22))
53 #define NTF_DragWait ((LONG) (1<<31))
55 #define NTF_AllChanges (NTF_First|NTF_Entries|NTF_Active|NTF_L_Active|NTF_Select|NTF_LV_Select|NTF_LineHeight|NTF_Insert|NTF_DragSortInsert|NTF_Columns)
56 #define NTF_AllClick (NTF_Multiclick|NTF_MulticlickAlone|NTF_Doubleclick|NTF_LV_Doubleclick|NTF_TitleClick|NTF_TitleClick2|NTF_EntryClick|NTF_ButtonClick)
57 #define NTF_All (NTF_AllChanges|NTF_AllClick)
59 #define NTF_AlwaysDoNotify (NTF_SB|NTF_VSB|NTF_HSB|NTF_MinMax|NTF_MinMaxNoDraw|NTF_LineHeight|NTF_DragSortInsert)
61 #define WANT_NOTIFY(ntf) data->Notify |= (ntf)
62 #define NOWANT_NOTIFY(ntf) data->Notify &= ~(ntf)
63 #define WANTED_NOTIFY(ntf) (data->Notify & (ntf))
64 #define DO_NOTIFY(ntf) if(data->NList_Quiet < 900) data->DoNotify |= (ntf); else data->DoNotify |= ((ntf) & NTF_AlwaysDoNotify)
65 #define ASKED_NOTIFY(ntf) (data->DoNotify & (ntf))
66 #define NEED_NOTIFY(ntf) (data->Notify & data->DoNotify & (ntf))
67 #define DONE_NOTIFY(ntf) data->DoNotify &= ~(ntf)
68 #define NOTIFY_START(ntf) data->Notifying |= (ntf)
69 #define NOTIFYING(ntf) (data->Notifying & (ntf))
70 #define NOTIFY_END(ntf) data->Notifying &= ~(ntf)
72 /* mad_Flags |= 0x00004000 to make it think it's visible even if in a virtgroup */
74 #define REDRAW_IF NL_DrawQuietBG(data,0,0)
75 #define REDRAW_ALL_FORCE NL_DrawQuietBG(data,1,0)
76 #define REDRAW_ALL NL_DrawQuietBG(data,2,0)
77 #define REDRAW_FORCE NL_DrawQuietBG(data,3,0)
78 #define REDRAW NL_DrawQuietBG(data,4,0)
80 #define MOREQUIET data->NList_Quiet++
81 #define FULLQUIET data->NList_Quiet |= 0x1000
82 #define FULLQUIET_END data->NList_Quiet &= 0x0FFF
83 #define VISUALQUIET data->NList_Quiet = (data->NList_Quiet & 0x0FFF) + 1
84 #define ENDQUIET NL_DrawQuietBG(data,5,0)
85 #define LESSQUIET NL_DrawQuietBG(data,6,0)
87 #define SetBackGround(bg) if((bg) != (ULONG)data->actbackground) NL_DrawQuietBG(data, 7, (bg));
89 #define Make_Active_Visible NL_DrawQuietBG(data,8,0)
91 #define ForceMinMax NL_DrawQuietBG(data,9,0)
93 #define do_notifies(which) NL_DoNotifies(data,(which))
96 #define SELECT(ent,sel) NL_Select(data,0,(ent),(sel))
97 #define SELECT2(ent,sel) NL_Select(data,1,(ent),(sel))
98 #define SELECT_CHGE(ent,sel) NL_Select(data,2,(ent),(sel))
99 #define SELECT2_CHGE(ent,sel) NL_Select(data,3,(ent),(sel))
100 #define set_Active(new_act) NL_Select(data,4,(new_act),0)
105 #define ReSetFont if(data->rp->Font!=data->font) SetFont(data->rp,data->font);
107 #define notdoset(obj,attr,value) SetAttrs(obj,MUIA_Group_Forward,FALSE,MUIA_NList_Visible,0,attr,value,TAG_DONE)
110 #define STYLE_MASK (FSF_UNDERLINED|FSF_BOLD|FSF_ITALIC)
111 #define SET_STYLE_NORMAL(s) ((s) = (s) & ~STYLE_MASK)
112 #define SET_STYLE_UNDERLINE(s) ((s) = (s) | FSF_UNDERLINED)
113 #define SET_STYLE_BOLD(s) ((s) = (s) | FSF_BOLD)
114 #define SET_STYLE_ITALIC(s) ((s) = (s) | FSF_ITALIC)
115 #define IS_STYLE_NORMAL(s) (((s) & STYLE_MASK) == FS_NORMAL)
116 #define IS_STYLE_UNDERLINE(s) ((s) & FSF_UNDERLINED)
117 #define IS_STYLE_BOLD(s) ((s) & FSF_BOLD)
118 #define IS_STYLE_ITALIC(s) ((s) & FSF_ITALIC)
119 #define GET_STYLE(s) ((s) & STYLE_MASK)
121 #define STYLE_STRMASK (0x00F0)
122 #define STYLE_IMAGE (0x0010)
123 #define STYLE_IMAGE2 (0x0020)
124 #define STYLE_TAB (0x0040)
125 #define STYLE_SPACE (0x0050)
126 #define STYLE_FIXSPACE (0x0060)
128 #define ALIGN_MASK (0x0700)
129 /* already defined in NList_mcc.h
130 #define ALIGN_LEFT (0x0000)
131 #define ALIGN_CENTER (0x0100)
132 #define ALIGN_RIGHT (0x0200)
133 #define ALIGN_JUSTIFY (0x0400)
135 #define SET_ALIGN_LEFT(a) ((a) = ((a) & ~ALIGN_MASK) | ALIGN_LEFT)
136 #define SET_ALIGN_CENTER(a) ((a) = ((a) & ~ALIGN_MASK) | ALIGN_CENTER)
137 #define SET_ALIGN_RIGHT(a) ((a) = ((a) & ~ALIGN_MASK) | ALIGN_RIGHT)
138 #define SET_ALIGN_JUSTIFY(a) ((a) = ((a) & ~ALIGN_MASK) | ALIGN_JUSTIFY)
139 #define IS_ALIGN_LEFT(a) (((a) & ALIGN_MASK) == ALIGN_LEFT)
140 #define IS_ALIGN_CENTER(a) (((a) & ALIGN_MASK) == ALIGN_CENTER)
141 #define IS_ALIGN_RIGHT(a) (((a) & ALIGN_MASK) == ALIGN_RIGHT)
142 #define IS_ALIGN_JUSTIFY(a) (((a) & ALIGN_MASK) == ALIGN_JUSTIFY)
144 #define HLINE_MASK (0x7000)
145 #define HLINE_T (0x1000)
146 #define HLINE_C (0x2000)
147 #define HLINE_B (0x3000)
148 #define HLINE_E (0x4000)
149 #define SET_HLINE_T(a) ((a) = ((a) & ~HLINE_MASK) | HLINE_T)
150 #define SET_HLINE_C(a) ((a) = ((a) & ~HLINE_MASK) | HLINE_C)
151 #define SET_HLINE_B(a) ((a) = ((a) & ~HLINE_MASK) | HLINE_B)
152 #define SET_HLINE_E(a) ((a) = ((a) & ~HLINE_MASK) | HLINE_E)
153 #define IS_HLINE(a) ((a) & HLINE_MASK)
154 #define IS_HLINE_T(a) (((a) & HLINE_MASK) == HLINE_T)
155 #define IS_HLINE_C(a) (((a) & HLINE_MASK) == HLINE_C)
156 #define IS_HLINE_B(a) (((a) & HLINE_MASK) == HLINE_B)
157 #define IS_HLINE_E(a) (((a) & HLINE_MASK) == HLINE_E)
159 #define HLINE_thick_MASK (0x8800)
160 #define HLINE_thick (0x8000)
161 #define HLINE_nothick (0x0800)
162 #define SET_HLINE_thick(a) ((a) = ((a) & ~HLINE_thick_MASK) | HLINE_thick)
163 #define SET_HLINE_nothick(a) ((a) = ((a) & ~HLINE_thick_MASK) | HLINE_nothick)
164 #define IS_HLINE_thick(a) (((a) & HLINE_thick_MASK) == HLINE_thick)
165 #define IS_HLINE_nothick(a) (((a) & HLINE_thick_MASK) == HLINE_nothick)
167 #define FIXPEN_MASK (0x0008)
168 #define SET_FIXPEN(a) ((a) |= FIXPEN_MASK)
169 #define SET_NOFIXPEN(a) ((a) &= ~FIXPEN_MASK)
170 #define IS_FIXPEN(a) ((a) & FIXPEN_MASK)
171 /*data->cols[column].style*/
174 #if !defined(__amigaos4__) && !defined(__MORPHOS__) && !defined(__AROS__)
175 // AllocVecPooled.c
176 APTR AllocVecPooled(APTR, ULONG);
177 // FreeVecPooled.c
178 void FreeVecPooled(APTR, APTR);
179 #endif
181 #if defined(__amigaos4__)
182 #define AllocTypeEntry() ItemPoolAlloc(data->EntryPool)
183 #define FreeTypeEntry(entry) ItemPoolFree(data->EntryPool, entry)
184 #else
185 #define AllocTypeEntry() AllocPooled(data->EntryPool, sizeof(struct TypeEntry))
186 #define FreeTypeEntry(entry) FreePooled(data->EntryPool, entry, sizeof(struct TypeEntry))
187 #endif
189 #define IS_BAR(c,ci) \
190 (((c) < data->numcols-1) ||\
191 (((c) > 0) &&\
192 (((ci)->width < 0) || ((ci)->width_type != CI_PERCENT) || ((ci)->userwidth > 0))))