4 /***************************************************************************
6 NListtree.mcc - New Listtree MUI Custom Class
7 Copyright (C) 1999-2001 by Carsten Scholling
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
24 ***************************************************************************/
28 #define MUIA_TI_Spec 0xfedcL
29 #define MUIA_TI_MaxWidth 0xfedbL
30 #define MUIA_TI_MaxHeight 0xfedaL
31 #define MUIA_TI_Style 0xfed9L
32 #define MUIA_TI_Space 0xfed8L
33 #define MUIA_TI_Pen 0xfed7L
35 struct NListtree_HookMessage
42 Object
*Image
; // *** Image objects.
43 Object
*ListImage
; // *** List image objects (created by ...CreateImage).
45 struct NListtree_Data
*nltdata
;
49 struct MyContextMenuChoice
61 ** General object related vars.
63 APTR MemoryPool
; // *** Our global memory pool
64 APTR TreePool
; // *** Our tree memory pool
65 Object
*Obj
; // *** The listtree object itself
66 STRPTR buf
; // *** Multi purpose buffer (most image include)
67 struct MUI_EventHandlerNode EHNode
; // *** Event handler node.
71 ** Image custom class stuff.
73 struct MUI_CustomClass
*CL_TreeImage
;
74 struct MUI_CustomClass
*CL_NodeImage
;
80 struct MUI_NListtree_ListNode RootList
; // *** The head root list.
81 struct MUI_NListtree_ListNode
*ActiveList
; // *** The active list node
82 struct MUI_NListtree_ListNode
*LastInsertedList
; // *** The list node, the last entry was inserted
84 struct MUI_NListtree_TreeNode
*ActiveNode
; // *** Current active tree node
85 struct MUI_NListtree_TreeNode
*OpenCloseEntry
; // *** Entry to open/close in handler.
86 struct MUI_NListtree_TreeNode
*TempActiveNode
; // *** New active node after Remove for example.
88 struct Table SelectedTable
; // *** Table of selected entries.
89 struct MUI_NListtree_TreeNode
*TempSelected
; // *** Temporary selected entry.
91 ULONG ActiveNodeNum
; // *** Number of the active node.
95 ** Rendering information, images etc.
97 struct MUI_RenderInfo
*MRI
; // *** MUI render info structure (got in _Setup())
99 struct MyImage Image
[4]; // *** My special image structure.
101 UWORD MaxImageWidth
, // *** Maximum image width.
102 MaxImageHeight
; // *** Maximum image height.
105 ** Pen specific stuff.
107 LONG Pen
[3]; // *** Obtained pen for lines/shadow/glow drawing.
111 ** Other configuration stuff.
113 ULONG LineType
; // *** The line type used (see private.h)
114 ULONG IndentWidth
; // *** The width of the indent
115 BOOL UseFolderImage
; // *** boolean for selecting if the folder image should be shown or not
117 UBYTE MultiSelect
; // *** Multi selection kind and flags.
118 UWORD MultiSelectFlags
;
120 struct MyContextMenuChoice MenuChoice
;
125 struct Hook
*OpenHook
, // *** Safe place for all hooks the user wants to be called
140 struct Hook IntCompareHook
; /* The internal compare hook, is no pointer to avoid unnecessary allocations */
146 STRPTR Format
; // *** Here the list format is saved
150 ** Input handling stuff (double click etc.)
152 BYTE DoubleClick
; // *** Holds specified double click value
153 UWORD TreeColumn
; // *** Holds specified tree column
155 ULONG LDClickTimeSecs
; // *** Left mouse button click handling
156 ULONG LDClickTimeMicros
; // *** Left mouse button click handling
161 ULONG MDClickTimeSecs
; // *** Middle mouse button click handling
162 ULONG MDClickTimeMicros
; // *** Middle mouse button click handling
168 ** Auto visualization stuff
170 UBYTE AutoVisible
; // *** Holds information about autovisiblization
174 ** Drag'n Drop stuff.
176 struct MUI_NListtree_TreeNode
*DropTarget
; // *** The entry which is currently the drop target.
177 struct MUI_NListtree_TreeNode
*OldDropTarget
; // *** The entry which is currently the drop target.
178 LONG compositingActive
;
180 ULONG DropTargetPos
; // *** Position of target drop entry.
181 ULONG DropType
; // *** The dropping type (above, below, onto...)
182 ULONG OpenDropListSecs
;
183 ULONG OpenDropListMicros
;
186 ** Number of entries total.
188 ULONG NumEntries
; // *** Global number of entries in the whole list tree
192 ** Some flags and error var.
194 ULONG Flags
; // *** Some flags (see below)
195 ULONG QuietCounter
; // *** Quiet nesting count.
196 ULONG ForceActiveNotify
; // *** next MUIA_NListtree_Notify notify will be enforced
197 ULONG IgnoreSelectionChange
; /* *** Ignores the next selection change */
203 ** Flag values for Flags field
205 #define NLTF_EMPTYNODES (1UL<<0) // *** Display empty nodes as leafs.
206 #define NLTF_DUPNODENAMES (1UL<<1) // *** Do not copy "name"-field. Use supplied pointer.
207 #define NLTF_QUIET (1UL<<2) // *** NListtree is in quiet state.
208 #define NLTF_TITLE (1UL<<3) // *** Show title.
209 #define NLTF_REFRESH (1UL<<4) // *** Do an general object refresh.
210 #define NLTF_REMEMBER_STATUS (1UL<<5) // *** Config: Remember open/close status of nodes.
211 #define NLTF_DRAGDROPSORT (1UL<<6) // *** Enabled drag'n drop sort.
212 #define NLTF_REDRAW (1UL<<7) // *** Redraw specified line.
213 #define NLTF_AUTOVISIBLE (1UL<<8) // *** Activated entries will always be shown.
214 #define NLTF_SELECT_METHOD (1UL<<9) // *** Selection through Select method.
215 #define NLTF_OVER_ARROW (1UL<<10) // *** Mouse clicked over arrow. No drag!!
216 #define NLTF_DRAGDROP (1UL<<11) // *** Drag&Drop in in progress.
217 #define NLTF_OPENAUTOSCROLL (1UL<<12) // *** Config: Auto scroll entries when opening a node with a large list.
218 #define NLTF_NO_TREE (1UL<<13) // *** Do not show a tree.
219 #define NLTF_NLIST_NO_SCM_SUPPORT (1UL<<14) // *** NList.mcc has no SelectChange method support implemented!
220 #define NLTF_INT_COMPAREHOOK (1UL<<15) // *** Internal compare hook used!
221 #define NLTF_INT_CONSTRDESTRHOOK (1UL<<16) // *** Internal construct/destruct hooks!
222 #define NLTF_ACTIVENOTIFY (1UL<<17) // *** Active notify activated?
223 #define NLTF_ISMCP (1UL<<18) // *** MCP is here ;-)
224 #define NLTF_NLIST_DIRECT_ENTRY_SUPPORT (1UL<<19) // *** NList version supports direct entry request via backpointer
225 #define NLTF_NO_ROOT_TREE (1UL<<20) // *** Do not display root tree gfx.
226 #define NLTF_SETACTIVE (1UL<<21) // *** Set the active entry.
227 #define NLTF_AUTOSELECT_CHILDS (1UL<<22) // *** Automatically select childs if their parents selected.
228 #define NLTF_SAFE_NOTIFIES (1UL<<23) // *** Is removing MUI notifies safe?
230 #define NLTF_QUALIFIER_LCOMMAND (1UL<<28) // *** Rawkey qualifier information.
231 #define NLTF_QUALIFIER_LALT (1UL<<29)
232 #define NLTF_QUALIFIER_CONTROL (1UL<<30)
233 #define NLTF_QUALIFIER_LSHIFT (1UL<<31)
236 #define INSERT_POS_HEAD -1L
237 #define INSERT_POS_TAIL -2L
240 #define IMAGE_Closed 0L
241 #define IMAGE_Open 1L
242 #define IMAGE_Folder 2L
243 #define IMAGE_Tree 3L
246 #define SPEC_VertT 2L
247 #define SPEC_VertEnd 3L
248 #define SPEC_Space 4L
251 #define PEN_Shadow 0L
256 // Gets an attribute value from a MUI object
257 IPTR
xget(Object
*obj
, const IPTR attr
);
258 #if defined(__GNUC__)
259 // please note that we do not evaluate the return value of GetAttr()
260 // as some attributes (e.g. MUIA_Selected) always return FALSE, even
261 // when they are supported by the object. But setting b=0 right before
262 // the GetAttr() should catch the case when attr doesn't exist at all
263 #define xget(OBJ, ATTR) ({IPTR b=0; GetAttr(ATTR, OBJ, &b); b;})
267 #endif /* NLISTTREE_H */