| 1 |
|
|---|
| 2 | /*
|
|---|
| 3 | *@@sourcefile cnrh.h:
|
|---|
| 4 | * header file for cnrh.c (container helper functions).
|
|---|
| 5 | * See remarks there.
|
|---|
| 6 | *
|
|---|
| 7 | * Note: Version numbering in this file relates to XWorkplace version
|
|---|
| 8 | * numbering.
|
|---|
| 9 | *
|
|---|
| 10 | *@@include #define INCL_WINSTDCNR
|
|---|
| 11 | *@@include #define INCL_WINSTDDRAG
|
|---|
| 12 | *@@include #include <os2.h>
|
|---|
| 13 | *@@include #include "helpers\cnrh.h"
|
|---|
| 14 | */
|
|---|
| 15 |
|
|---|
| 16 | /* Copyright (C) 1997-2000 Ulrich Mller.
|
|---|
| 17 | * This file is part of the "XWorkplace helpers" source package.
|
|---|
| 18 | * This is free software; you can redistribute it and/or modify
|
|---|
| 19 | * it under the terms of the GNU General Public License as published
|
|---|
| 20 | * by the Free Software Foundation, in version 2 as it comes in the
|
|---|
| 21 | * "COPYING" file of the XWorkplace main distribution.
|
|---|
| 22 | * This program is distributed in the hope that it will be useful,
|
|---|
| 23 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|---|
| 24 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|---|
| 25 | * GNU General Public License for more details.
|
|---|
| 26 | */
|
|---|
| 27 |
|
|---|
| 28 | #if __cplusplus
|
|---|
| 29 | extern "C" {
|
|---|
| 30 | #endif
|
|---|
| 31 |
|
|---|
| 32 | #ifndef CNRH_HEADER_INCLUDED
|
|---|
| 33 | #define CNRH_HEADER_INCLUDED
|
|---|
| 34 |
|
|---|
| 35 | #ifndef INCL_WINSTDCNR
|
|---|
| 36 | #error cnrh.h requires INCL_WINSTDCNR to be defined.
|
|---|
| 37 | #endif
|
|---|
| 38 |
|
|---|
| 39 | /*
|
|---|
| 40 | *@@category: Helpers\PM helpers\Container helpers\Details view helpers
|
|---|
| 41 | */
|
|---|
| 42 |
|
|---|
| 43 | /* ******************************************************************
|
|---|
| 44 | *
|
|---|
| 45 | * Details view field infos
|
|---|
| 46 | *
|
|---|
| 47 | ********************************************************************/
|
|---|
| 48 |
|
|---|
| 49 | // redefine the FIELDOFFSET macro; the one
|
|---|
| 50 | // in the OS/2 header files doesn't work with C++
|
|---|
| 51 | #undef FIELDOFFSET
|
|---|
| 52 | #define FIELDOFFSET(type, field) ((ULONG)&(((type *)0)->field))
|
|---|
| 53 |
|
|---|
| 54 | ULONG cnrhClearFieldInfos(HWND hwndCnr,
|
|---|
| 55 | BOOL fInvalidate);
|
|---|
| 56 |
|
|---|
| 57 | /*
|
|---|
| 58 | *@@ cnrhAllocFieldInfos:
|
|---|
| 59 | * this allocates sColumnCount field infos
|
|---|
| 60 | * for Details view in hwndCnr.
|
|---|
| 61 | * Returns the first PFIELDINFO, which is
|
|---|
| 62 | * the root of a linked list. Follow
|
|---|
| 63 | * FIELDINFO.pNextFieldInfo to get to the
|
|---|
| 64 | * next field info, the last of which is
|
|---|
| 65 | * NULL.
|
|---|
| 66 | *
|
|---|
| 67 | *@@added V0.9.0
|
|---|
| 68 | */
|
|---|
| 69 |
|
|---|
| 70 | #define cnrhAllocFieldInfos(hwndCnr, sColumnCount) \
|
|---|
| 71 | (PFIELDINFO)WinSendMsg(hwndCnr, \
|
|---|
| 72 | CM_ALLOCDETAILFIELDINFO, \
|
|---|
| 73 | MPFROMSHORT(sColumnCount), \
|
|---|
| 74 | NULL)
|
|---|
| 75 |
|
|---|
| 76 | /*
|
|---|
| 77 | *@@ XFIELDINFO:
|
|---|
| 78 | * input structure for cnrhSetFieldInfos.
|
|---|
| 79 | * See cnrhSetFieldInfo for a description
|
|---|
| 80 | * of the fields.
|
|---|
| 81 | *
|
|---|
| 82 | *@@added V0.9.0
|
|---|
| 83 | */
|
|---|
| 84 |
|
|---|
| 85 | typedef struct _XFIELDINFO
|
|---|
| 86 | {
|
|---|
| 87 | ULONG ulFieldOffset;
|
|---|
| 88 | PCSZ pszColumnTitle;
|
|---|
| 89 | ULONG ulDataType;
|
|---|
| 90 | ULONG ulOrientation;
|
|---|
| 91 | } XFIELDINFO, *PXFIELDINFO;
|
|---|
| 92 |
|
|---|
| 93 | VOID cnrhSetFieldInfo(PFIELDINFO *ppFieldInfo2,
|
|---|
| 94 | ULONG ulFieldOffset,
|
|---|
| 95 | PSZ pszColumnTitle,
|
|---|
| 96 | ULONG ulDataType,
|
|---|
| 97 | ULONG ulOrientation,
|
|---|
| 98 | BOOL fDrawLines);
|
|---|
| 99 |
|
|---|
| 100 | ULONG cnrhInsertFieldInfos(HWND hwndCnr,
|
|---|
| 101 | PFIELDINFO pFieldInfoFirst,
|
|---|
| 102 |
|
|---|
| 103 | ULONG ulFieldCount);
|
|---|
| 104 |
|
|---|
| 105 | PFIELDINFO cnrhSetFieldInfos(HWND hwndCnr,
|
|---|
| 106 | PXFIELDINFO paxfi,
|
|---|
| 107 | ULONG ulFieldCount,
|
|---|
| 108 | BOOL fDrawLines,
|
|---|
| 109 | ULONG ulFieldReturn);
|
|---|
| 110 |
|
|---|
| 111 | /*
|
|---|
| 112 | *@@category: Helpers\PM helpers\Container helpers\Record core helpers
|
|---|
| 113 | */
|
|---|
| 114 |
|
|---|
| 115 | /* ******************************************************************
|
|---|
| 116 | *
|
|---|
| 117 | * Record core management
|
|---|
| 118 | *
|
|---|
| 119 | ********************************************************************/
|
|---|
| 120 |
|
|---|
| 121 | /*
|
|---|
| 122 | *@@ FNCNRSORT:
|
|---|
| 123 | * container sort function as used in
|
|---|
| 124 | * CM_SORTRECORD and CNRINFO.pSortRecord
|
|---|
| 125 | */
|
|---|
| 126 |
|
|---|
| 127 | typedef SHORT EXPENTRY FNCNRSORT(PVOID, // record core 1
|
|---|
| 128 | PVOID, // record core 2
|
|---|
| 129 | PVOID); // pStorage (== NULL)
|
|---|
| 130 | typedef FNCNRSORT *PFNCNRSORT;
|
|---|
| 131 |
|
|---|
| 132 | PRECORDCORE cnrhAllocRecords(HWND hwndCnr,
|
|---|
| 133 | ULONG cbrecc,
|
|---|
| 134 | ULONG ulCount);
|
|---|
| 135 |
|
|---|
| 136 | ULONG cnrhInsertRecords(HWND hwndCnr,
|
|---|
| 137 | PRECORDCORE preccParent,
|
|---|
| 138 | PRECORDCORE precc,
|
|---|
| 139 | BOOL fInvalidate,
|
|---|
| 140 | const char *pcszText,
|
|---|
| 141 | ULONG flRecordAttr,
|
|---|
| 142 | ULONG ulCount);
|
|---|
| 143 |
|
|---|
| 144 | ULONG cnrhInsertRecordAfter(HWND hwndCnr,
|
|---|
| 145 | PRECORDCORE precc,
|
|---|
| 146 | PSZ pszText,
|
|---|
| 147 | ULONG flRecordAttr,
|
|---|
| 148 | PRECORDCORE preccAfter,
|
|---|
| 149 | BOOL fInvalidate);
|
|---|
| 150 |
|
|---|
| 151 | BOOL cnrhMoveRecord(HWND hwndCnr,
|
|---|
| 152 | PRECORDCORE preccMove,
|
|---|
| 153 | PRECORDCORE preccInsertAfter);
|
|---|
| 154 |
|
|---|
| 155 | BOOL cnrhMoveTree(HWND hwndCnr,
|
|---|
| 156 | PRECORDCORE preccMove,
|
|---|
| 157 | PRECORDCORE preccNewParent,
|
|---|
| 158 | PFNCNRSORT pfnCnrSort);
|
|---|
| 159 |
|
|---|
| 160 | /*
|
|---|
| 161 | *@@ cnrhRemoveAll:
|
|---|
| 162 | * this helper removes all records from the container
|
|---|
| 163 | * and frees them (CM_REMOVERECORD with NULL
|
|---|
| 164 | * and CMA_FREE | CMA_INVALIDATE specified).
|
|---|
| 165 | *
|
|---|
| 166 | *@@added V0.9.0 (99-10-22) [umoeller]
|
|---|
| 167 | */
|
|---|
| 168 |
|
|---|
| 169 | #define cnrhRemoveAll(hwndCnr) \
|
|---|
| 170 | WinSendMsg(hwndCnr, CM_REMOVERECORD, NULL, MPFROM2SHORT(0, CMA_FREE | CMA_INVALIDATE))
|
|---|
| 171 |
|
|---|
| 172 | /*
|
|---|
| 173 | *@@ cnrhInvalidateAll:
|
|---|
| 174 | * invalidates all records in the container.
|
|---|
| 175 | *
|
|---|
| 176 | *@@added V0.9.2 (2000-02-19) [umoeller]
|
|---|
| 177 | */
|
|---|
| 178 |
|
|---|
| 179 | #define cnrhInvalidateAll(hwndCnr) \
|
|---|
| 180 | WinSendMsg(hwndCnr, CM_INVALIDATERECORD, NULL, MPFROM2SHORT(0, CMA_ERASE | CMA_REPOSITION | CMA_TEXTCHANGED))
|
|---|
| 181 |
|
|---|
| 182 | /*
|
|---|
| 183 | *@@category: Helpers\PM helpers\Container helpers\View management
|
|---|
| 184 | */
|
|---|
| 185 |
|
|---|
| 186 | /* ******************************************************************
|
|---|
| 187 | *
|
|---|
| 188 | * CNRINFO management
|
|---|
| 189 | *
|
|---|
| 190 | ********************************************************************/
|
|---|
| 191 |
|
|---|
| 192 | /*
|
|---|
| 193 | *@@ cnrhQueryCnrInfo:
|
|---|
| 194 | * this stores the CNRINFO for hwndCnr
|
|---|
| 195 | * in the specified variable, which must
|
|---|
| 196 | * be a PCNRINFO.
|
|---|
| 197 | * Example:
|
|---|
| 198 | *
|
|---|
| 199 | + CNRINFO CnrInfo;
|
|---|
| 200 | + cnrhQueryCnrInfo(&CnrInfo);
|
|---|
| 201 | *
|
|---|
| 202 | *@@changed V0.9.0
|
|---|
| 203 | */
|
|---|
| 204 |
|
|---|
| 205 | #define cnrhQueryCnrInfo(hwndCnr, pCnrInfo) \
|
|---|
| 206 | WinSendMsg(hwndCnr, CM_QUERYCNRINFO, \
|
|---|
| 207 | (MPARAM)(pCnrInfo), \
|
|---|
| 208 | (MPARAM)(sizeof(*pCnrInfo)))
|
|---|
| 209 |
|
|---|
| 210 | /*
|
|---|
| 211 | *@@ BEGIN_CNRINFO:
|
|---|
| 212 | * this macro starts a "container info" block. In such
|
|---|
| 213 | * a block, you may use the following macros:
|
|---|
| 214 | *
|
|---|
| 215 | * -- cnrhSetTitle
|
|---|
| 216 | *
|
|---|
| 217 | * -- cnrhSetSplitBarAfter
|
|---|
| 218 | *
|
|---|
| 219 | * -- cnrhSetSplitBarPos
|
|---|
| 220 | *
|
|---|
| 221 | * -- cnrhSetTreeBmpOrIconSize
|
|---|
| 222 | *
|
|---|
| 223 | * -- cnrhSetBmpOrIconSize
|
|---|
| 224 | *
|
|---|
| 225 | * -- cnrhSetView (most frequently)
|
|---|
| 226 | *
|
|---|
| 227 | * -- cnrhSetTreeIndent
|
|---|
| 228 | *
|
|---|
| 229 | * -- cnrhSetSortFunc
|
|---|
| 230 | *
|
|---|
| 231 | * Typical usage is like this:
|
|---|
| 232 | *
|
|---|
| 233 | + BEGIN_CNRINFO()
|
|---|
| 234 | + {
|
|---|
| 235 | + cnrhSetTreeIndent(20);
|
|---|
| 236 | + cnrhSetView(CV_TREE | CV_ICON | CA_TREELINE);
|
|---|
| 237 | + } END_CNRINFO(hwndCnr);
|
|---|
| 238 | *
|
|---|
| 239 | * This must always be followed by END_CNRINFO(),
|
|---|
| 240 | * or you'll get funny compilation errors.
|
|---|
| 241 | *
|
|---|
| 242 | *@@added V0.9.0
|
|---|
| 243 | */
|
|---|
| 244 |
|
|---|
| 245 | #define BEGIN_CNRINFO() \
|
|---|
| 246 | { \
|
|---|
| 247 | CNRINFO CnrInfo_ = {0}; \
|
|---|
| 248 | ULONG ulSendFlags_ = 0; \
|
|---|
| 249 | CnrInfo_.cb = sizeof(CnrInfo_);
|
|---|
| 250 |
|
|---|
| 251 | /*
|
|---|
| 252 | *@@ END_CNRINFO:
|
|---|
| 253 | * this macro ends a "container info" block.
|
|---|
| 254 | * See BEGIN_CNRINFO.
|
|---|
| 255 | *
|
|---|
| 256 | *@@added V0.9.0
|
|---|
| 257 | */
|
|---|
| 258 |
|
|---|
| 259 | #define END_CNRINFO(hwndCnr) \
|
|---|
| 260 | WinSendMsg((hwndCnr), CM_SETCNRINFO, (MPARAM)&CnrInfo_, \
|
|---|
| 261 | (MPARAM)ulSendFlags_); \
|
|---|
| 262 | }
|
|---|
| 263 |
|
|---|
| 264 | /*
|
|---|
| 265 | *@@ cnrhSetTitle:
|
|---|
| 266 | * this macro sets the container title to the specified
|
|---|
| 267 | * text. You must specify CA_CONTAINERTITLE with
|
|---|
| 268 | * cnrhSetView then.
|
|---|
| 269 | *
|
|---|
| 270 | * This can only be used after BEGIN_CNRINFO().
|
|---|
| 271 | *
|
|---|
| 272 | *@@added V0.9.1 (99-12-18) [umoeller]
|
|---|
| 273 | */
|
|---|
| 274 |
|
|---|
| 275 | #define cnrhSetTitle(pszTitle) \
|
|---|
| 276 | CnrInfo_.pszCnrTitle = (pszTitle); \
|
|---|
| 277 | ulSendFlags_ |= CMA_CNRTITLE;
|
|---|
| 278 |
|
|---|
| 279 | /*
|
|---|
| 280 | *@@ cnrhSetSplitBarAfter:
|
|---|
| 281 | * this macro sets the field info after which
|
|---|
| 282 | * the split bar should be shown.
|
|---|
| 283 | * If (pFieldInfo == NULL), the split bar is hidden.
|
|---|
| 284 | *
|
|---|
| 285 | * This can be used directly with the return value
|
|---|
| 286 | * of cnrhSetFieldInfos. With that function, specify
|
|---|
| 287 | * the field info to be returned with ulFieldReturn.
|
|---|
| 288 | *
|
|---|
| 289 | * This can only be used after BEGIN_CNRINFO().
|
|---|
| 290 | *
|
|---|
| 291 | *@@added V0.9.0
|
|---|
| 292 | */
|
|---|
| 293 |
|
|---|
| 294 | #define cnrhSetSplitBarAfter(pFieldInfo) \
|
|---|
| 295 | CnrInfo_.pFieldInfoLast = (pFieldInfo); \
|
|---|
| 296 | ulSendFlags_ |= CMA_PFIELDINFOLAST;
|
|---|
| 297 |
|
|---|
| 298 | /*
|
|---|
| 299 | *@@ cnrhSetSplitBarPos:
|
|---|
| 300 | * this macro sets the vertical split bar
|
|---|
| 301 | * position (in window coordinates).
|
|---|
| 302 | *
|
|---|
| 303 | * This can only be used after BEGIN_CNRINFO().
|
|---|
| 304 | *
|
|---|
| 305 | *@@added V0.9.0
|
|---|
| 306 | */
|
|---|
| 307 |
|
|---|
| 308 | #define cnrhSetSplitBarPos(xPos) \
|
|---|
| 309 | CnrInfo_.xVertSplitbar = (xPos); \
|
|---|
| 310 | ulSendFlags_ |= CMA_XVERTSPLITBAR;
|
|---|
| 311 |
|
|---|
| 312 | /*
|
|---|
| 313 | *@@ cnrhSetTreeBmpOrIconSize:
|
|---|
| 314 | * this macro sets the size used for the bitmaps
|
|---|
| 315 | * or icons used for the "+" and "-" signs in
|
|---|
| 316 | * tree views.
|
|---|
| 317 | * The default is the system icon size (32 or 40).
|
|---|
| 318 | *
|
|---|
| 319 | * This can only be used after BEGIN_CNRINFO().
|
|---|
| 320 | */
|
|---|
| 321 |
|
|---|
| 322 | #define cnrhSetTreeBmpOrIconSize(cxNew, cyNew) \
|
|---|
| 323 | CnrInfo_.slTreeBitmapOrIcon.cx = cxNew; \
|
|---|
| 324 | CnrInfo_.slTreeBitmapOrIcon.cy = cyNew; \
|
|---|
| 325 | ulSendFlags_ |= CMA_SLTREEBITMAPORICON;
|
|---|
| 326 |
|
|---|
| 327 | /*
|
|---|
| 328 | *@@ cnrhSetBmpOrIconSize:
|
|---|
| 329 | * this macro sets the size used for bitmaps
|
|---|
| 330 | * or icons (depending on whether CA_DRAWBITMAP
|
|---|
| 331 | * or the default CA_DRAWICON is set in flWindowAttr).
|
|---|
| 332 | * The default is the system icon size (32 or 40).
|
|---|
| 333 | *
|
|---|
| 334 | * This can only be used after BEGIN_CNRINFO().
|
|---|
| 335 | *
|
|---|
| 336 | *@@added V0.9.0
|
|---|
| 337 | */
|
|---|
| 338 |
|
|---|
| 339 | #define cnrhSetBmpOrIconSize(cxNew, cyNew) \
|
|---|
| 340 | CnrInfo_.slBitmapOrIcon.cx = cxNew; \
|
|---|
| 341 | CnrInfo_.slBitmapOrIcon.cy = cyNew; \
|
|---|
| 342 | ulSendFlags_ |= CMA_SLBITMAPORICON;
|
|---|
| 343 |
|
|---|
| 344 | /*
|
|---|
| 345 | *@@ cnrhSetView:
|
|---|
| 346 | * this macro sets the container view attributes (CNRINFO.flWindowAttr).
|
|---|
| 347 | *
|
|---|
| 348 | * This can only be used after BEGIN_CNRINFO(), like this:
|
|---|
| 349 | *
|
|---|
| 350 | + BEGIN_CNRINFO()
|
|---|
| 351 | + {
|
|---|
| 352 | + cnrhSetView(CV_TEXT | CV_FLOW);
|
|---|
| 353 | + } END_CNRINFO(hwndCnr);
|
|---|
| 354 | *
|
|---|
| 355 | * The following combinations are useful for flWindowAttr.
|
|---|
| 356 | *
|
|---|
| 357 | * <B>Icon view:</B>
|
|---|
| 358 | * -- CV_ICON: icon view
|
|---|
| 359 | * RECORDCORE.pszIcon is used for record titles;
|
|---|
| 360 | * add CV_MINI for mini-icons view
|
|---|
| 361 | *
|
|---|
| 362 | * <B>Tree view:</B>
|
|---|
| 363 | * -- CV_TREE | CV_ICON: tree icon view (icon plus name;
|
|---|
| 364 | * RECORDCORE.pszIcon is used for record titles)
|
|---|
| 365 | * -- CV_TREE | CV_NAME: tree name view (icon plus name;
|
|---|
| 366 | * RECORDCORE.pszName is used for record titles,
|
|---|
| 367 | * and this does _not_ use a separate icon/bitmap for
|
|---|
| 368 | * "collapsed" and "expanded"
|
|---|
| 369 | * -- CV_TREE | CV_TEXT: tree text view (no icons;
|
|---|
| 370 | * RECORDCORE.pszText is used for record titles)
|
|---|
| 371 | * Add CA_TREELINE to have lines drawn between tree items.
|
|---|
| 372 | *
|
|---|
| 373 | * <B>Name view:</B>
|
|---|
| 374 | * -- CV_NAME: non-flowed name view (icon plus name;
|
|---|
| 375 | * RECORDCORE.pszName is used for record titles;
|
|---|
| 376 | * display a single column
|
|---|
| 377 | * -- CV_NAME | CV_FLOW: flowed name view (icon plus name;
|
|---|
| 378 | * RECORDCORE.pszName is used for record titles;
|
|---|
| 379 | * display multiple columns
|
|---|
| 380 | *
|
|---|
| 381 | * <B>Text view:</B>
|
|---|
| 382 | * -- CV_TEXT: non-flowed name view (name WITHOUT icons;
|
|---|
| 383 | * RECORDCORE.pszText is used for record titles;
|
|---|
| 384 | * display a single column
|
|---|
| 385 | * -- CV_TEXT | CV_FLOW: flowed name view (name WITHOUT icons;
|
|---|
| 386 | * RECORDCORE.pszText is used for record titles;
|
|---|
| 387 | * display multiple columns
|
|---|
| 388 | *
|
|---|
| 389 | * <B>Details view:</B>
|
|---|
| 390 | * -- CV_DETAIL: details view without column headers
|
|---|
| 391 | * -- CV_DETAIL | CA_DETAILSVIEWTITLES: details view _with_ column headers
|
|---|
| 392 | *
|
|---|
| 393 | * <B>Mini icons:</B>
|
|---|
| 394 | *
|
|---|
| 395 | * This is especially sick. The CV_MINI style in CNRINFO is only
|
|---|
| 396 | * supported for "pure" icon view. For details and tree views,
|
|---|
| 397 | * in addition, you must set the (half-documented) CCS_MINICONS style
|
|---|
| 398 | * as a _window_ style on the container. Whoever came up with this.
|
|---|
| 399 | *
|
|---|
| 400 | * <B>Target emphasis:</B>
|
|---|
| 401 | *
|
|---|
| 402 | * For Name, Text, and Details view, per default target emphasis
|
|---|
| 403 | * during d'n'd is only displayed _around_ the record core.
|
|---|
| 404 | * This allows users to drop records onto each other.
|
|---|
| 405 | * If you add CA_ORDEREDTARGETEMPH, target emphasis is only
|
|---|
| 406 | * displayed _between_ records (to reorder records).
|
|---|
| 407 | * If you add CA_MIXEDTARGETEMPH, both emphasis types are possible.
|
|---|
| 408 | *
|
|---|
| 409 | * Additional flags for _all_ views:
|
|---|
| 410 | * -- CA_DRAWICON: RECORDCORE.hptrIcon and hptrMiniIcon
|
|---|
| 411 | * are to be used to draw icons
|
|---|
| 412 | * -- CA_DRAWBITMAP: RECORDCORE.hbmBitmap and hbmMiniBitmap
|
|---|
| 413 | * are to be used to draw bitmaps
|
|---|
| 414 | * (CA_DRAWICON takes precedence)
|
|---|
| 415 | * -- CA_OWNERDRAW: all record cores are to be owner-drawn.
|
|---|
| 416 | * -- CA_OWNERPAINTBACKGROUND: container sends CM_PAINTBACKGROUND
|
|---|
| 417 | * to itself. By subclassing the container,
|
|---|
| 418 | * this can be intercepted.
|
|---|
| 419 | * -- CA_CONTAINERTITLE: add container title. If this is
|
|---|
| 420 | * specified, you may also specify
|
|---|
| 421 | * CA_TITLEREADONLY, CA_TITLESEPARATOR,
|
|---|
| 422 | * and one out of (CA_TITLECENTER, CA_TITLELEFT,
|
|---|
| 423 | * CA_TITLERIGHT).
|
|---|
| 424 | *
|
|---|
| 425 | *@@added V0.9.0
|
|---|
| 426 | */
|
|---|
| 427 |
|
|---|
| 428 | #define cnrhSetView(flNewAttr) \
|
|---|
| 429 | CnrInfo_.flWindowAttr = (flNewAttr); \
|
|---|
| 430 | ulSendFlags_ |= CMA_FLWINDOWATTR;
|
|---|
| 431 |
|
|---|
| 432 | /*
|
|---|
| 433 | *@@ cnrhSetTreeIndent:
|
|---|
| 434 | * this macro sets the horizontal spacing between levels
|
|---|
| 435 | * in Tree views.
|
|---|
| 436 | *
|
|---|
| 437 | * This can only be used after BEGIN_CNRINFO().
|
|---|
| 438 | *
|
|---|
| 439 | *@@added V0.9.0
|
|---|
| 440 | */
|
|---|
| 441 |
|
|---|
| 442 | #define cnrhSetTreeIndent(ulNewIndent) \
|
|---|
| 443 | CnrInfo_.cxTreeIndent = (ulNewIndent); \
|
|---|
| 444 | ulSendFlags_ |= CMA_CXTREEINDENT;
|
|---|
| 445 |
|
|---|
| 446 | /*
|
|---|
| 447 | *@@ cnrhSetSortFunc:
|
|---|
| 448 | * this macro sets the sort function for a container.
|
|---|
| 449 | *
|
|---|
| 450 | * This can only be used after BEGIN_CNRINFO().
|
|---|
| 451 | *
|
|---|
| 452 | * Container sort funcs must have this prototype:
|
|---|
| 453 | +
|
|---|
| 454 | + SHORT EXPENTRY fnCompare(PRECORDCORE p1, PRECORDCORE p2, PVOID pStorage)
|
|---|
| 455 | *
|
|---|
| 456 | *@@added V0.9.0
|
|---|
| 457 | */
|
|---|
| 458 |
|
|---|
| 459 | #define cnrhSetSortFunc(fnCompareName) \
|
|---|
| 460 | CnrInfo_.pSortRecord = (PVOID)(fnCompareName); \
|
|---|
| 461 | ulSendFlags_ |= CMA_PSORTRECORD;
|
|---|
| 462 |
|
|---|
| 463 | /* ******************************************************************
|
|---|
| 464 | *
|
|---|
| 465 | * View management
|
|---|
| 466 | *
|
|---|
| 467 | ********************************************************************/
|
|---|
| 468 |
|
|---|
| 469 | /*
|
|---|
| 470 | *@@ cnrhSelectRecord:
|
|---|
| 471 | * this selects/deselects a container RECORDCORE
|
|---|
| 472 | * (precc), depending on fSelect.
|
|---|
| 473 | *
|
|---|
| 474 | *@@changed V0.9.0
|
|---|
| 475 | */
|
|---|
| 476 |
|
|---|
| 477 | #define cnrhSelectRecord(hwndCnr, precc, fSelect) \
|
|---|
| 478 | WinSendMsg(hwndCnr, CM_SETRECORDEMPHASIS, \
|
|---|
| 479 | (MPARAM)(precc), \
|
|---|
| 480 | MPFROM2SHORT(fSelect, CRA_SELECTED))
|
|---|
| 481 |
|
|---|
| 482 | /*
|
|---|
| 483 | *@@ cnrhSetSourceEmphasis:
|
|---|
| 484 | * this gives a container RECORDCORE (precc)
|
|---|
| 485 | * source emphasis or removes it, depending
|
|---|
| 486 | * on fSelect.
|
|---|
| 487 | * precc may be NULL to give the whole container
|
|---|
| 488 | * source emphasis.
|
|---|
| 489 | */
|
|---|
| 490 |
|
|---|
| 491 | #define cnrhSetSourceEmphasis(hwndCnr, precc, fSelect) \
|
|---|
| 492 | WinSendMsg(hwndCnr, CM_SETRECORDEMPHASIS, \
|
|---|
| 493 | (MPARAM)(precc), \
|
|---|
| 494 | MPFROM2SHORT(fSelect, CRA_SOURCE))
|
|---|
| 495 |
|
|---|
| 496 | ULONG cnrhSelectAll(HWND hwndCnr,
|
|---|
| 497 | BOOL fSelect);
|
|---|
| 498 |
|
|---|
| 499 | #define FRFP_RIGHTSPLITWINDOW 0x0001
|
|---|
| 500 | #define FRFP_SCREENCOORDS 0x0002
|
|---|
| 501 |
|
|---|
| 502 | PRECORDCORE cnrhFindRecordFromPoint(HWND hwndCnr,
|
|---|
| 503 | PPOINTL pptl,
|
|---|
| 504 | PRECTL prclFoundRecord,
|
|---|
| 505 | ULONG fsExtent,
|
|---|
| 506 | ULONG fl);
|
|---|
| 507 |
|
|---|
| 508 | ULONG cnrhExpandFromRoot(HWND hwndCnr,
|
|---|
| 509 | PRECORDCORE prec);
|
|---|
| 510 |
|
|---|
| 511 | ULONG cnrhScrollToRecord(HWND hwndCnr,
|
|---|
| 512 | PRECORDCORE pRec,
|
|---|
| 513 | ULONG fsExtent,
|
|---|
| 514 | BOOL KeepParent);
|
|---|
| 515 |
|
|---|
| 516 | BOOL cnrhShowContextMenu(HWND hwndCnr,
|
|---|
| 517 | PRECORDCORE preccSource,
|
|---|
| 518 | HWND hMenu,
|
|---|
| 519 | HWND hwndMenuOwner);
|
|---|
| 520 |
|
|---|
| 521 | // flags for cnrhQuerySourceRecord
|
|---|
| 522 | #define SEL_WHITESPACE 1
|
|---|
| 523 | #define SEL_SINGLESEL 2
|
|---|
| 524 | #define SEL_MULTISEL 3
|
|---|
| 525 | #define SEL_SINGLEOTHER 4
|
|---|
| 526 | #define SEL_NONEATALL 5
|
|---|
| 527 |
|
|---|
| 528 | PRECORDCORE cnrhQuerySourceRecord(HWND hwndCnr,
|
|---|
| 529 | PRECORDCORE preccSource,
|
|---|
| 530 | PULONG pulSelection);
|
|---|
| 531 |
|
|---|
| 532 | PRECORDCORE cnrhQueryNextSelectedRecord(HWND hwndCnr,
|
|---|
| 533 | PRECORDCORE preccCurrent);
|
|---|
| 534 |
|
|---|
| 535 | /*
|
|---|
| 536 | *@@category: Helpers\PM helpers\Container helpers\Record relations/iteration
|
|---|
| 537 | */
|
|---|
| 538 |
|
|---|
| 539 | /* ******************************************************************
|
|---|
| 540 | *
|
|---|
| 541 | * Record relations/iteration
|
|---|
| 542 | *
|
|---|
| 543 | ********************************************************************/
|
|---|
| 544 |
|
|---|
| 545 | LONG cnrhQueryRecordIndex(HWND hwndCnr,
|
|---|
| 546 | PRECORDCORE precc);
|
|---|
| 547 |
|
|---|
| 548 | BOOL cnrhIsChildOf(HWND hwndCnr,
|
|---|
| 549 | PRECORDCORE precTest,
|
|---|
| 550 | PRECORDCORE precParent);
|
|---|
| 551 |
|
|---|
| 552 | /*
|
|---|
| 553 | *@@ cnrhQueryParentRecord:
|
|---|
| 554 | * this returns the parent record of precc.
|
|---|
| 555 | *
|
|---|
| 556 | * This returns a PRECORDCORE or NULL if no
|
|---|
| 557 | * parent record could be found or -1 if
|
|---|
| 558 | * the container found an error.
|
|---|
| 559 | *
|
|---|
| 560 | *@@added V0.9.0
|
|---|
| 561 | */
|
|---|
| 562 |
|
|---|
| 563 | #define cnrhQueryParentRecord(hwndCnr, precc) \
|
|---|
| 564 | (PRECORDCORE)WinSendMsg(hwndCnr, CM_QUERYRECORD, \
|
|---|
| 565 | (MPARAM)precc, \
|
|---|
| 566 | MPFROM2SHORT(CMA_PARENT, CMA_ITEMORDER))
|
|---|
| 567 |
|
|---|
| 568 | /*
|
|---|
| 569 | *@@ cnrhQueryFirstChildRecord:
|
|---|
| 570 | * this returns the first child record of precc.
|
|---|
| 571 | *
|
|---|
| 572 | * This returns a PRECORDCORE or NULL if no
|
|---|
| 573 | * parent record could be found or -1 if
|
|---|
| 574 | * the container found an error.
|
|---|
| 575 | *
|
|---|
| 576 | *@@added V0.9.0
|
|---|
| 577 | */
|
|---|
| 578 |
|
|---|
| 579 | #define cnrhQueryFirstChildRecord(hwndCnr, precc) \
|
|---|
| 580 | (PRECORDCORE)WinSendMsg(hwndCnr, CM_QUERYRECORD, \
|
|---|
| 581 | (MPARAM)precc, \
|
|---|
| 582 | MPFROM2SHORT(CMA_FIRSTCHILD, CMA_ITEMORDER))
|
|---|
| 583 |
|
|---|
| 584 | typedef ULONG XWPENTRY FNCBRECC(HWND, PRECORDCORE, ULONG);
|
|---|
| 585 | typedef FNCBRECC *PFNCBRECC;
|
|---|
| 586 |
|
|---|
| 587 | ULONG cnrhForAllRecords(HWND hwndCnr,
|
|---|
| 588 | PRECORDCORE preccParent,
|
|---|
| 589 | PFNCBRECC pfncbRecc,
|
|---|
| 590 | ULONG ulUser);
|
|---|
| 591 |
|
|---|
| 592 | /* ******************************************************************
|
|---|
| 593 | *
|
|---|
| 594 | * Miscellaneous
|
|---|
| 595 | *
|
|---|
| 596 | ********************************************************************/
|
|---|
| 597 |
|
|---|
| 598 | HWND cnrhQueryCnrFromFrame(HWND hwndFrame);
|
|---|
| 599 |
|
|---|
| 600 | BOOL cnrhOpenEdit(HWND hwndCnr);
|
|---|
| 601 |
|
|---|
| 602 | PDRAGINFO cnrhInitDrag(HWND hwndCnr,
|
|---|
| 603 | PRECORDCORE preccDrag,
|
|---|
| 604 | USHORT usNotifyCode,
|
|---|
| 605 | PSZ pszRMF,
|
|---|
| 606 | USHORT usSupportedOps);
|
|---|
| 607 |
|
|---|
| 608 | #define CODFL_DISABLEDTEXT 0x0001
|
|---|
| 609 | #define CODFL_MINIICON 0x0002
|
|---|
| 610 |
|
|---|
| 611 | MRESULT cnrhOwnerDrawRecord(MPARAM mp2,
|
|---|
| 612 | ULONG flFlags);
|
|---|
| 613 |
|
|---|
| 614 | BOOL cnrhDateTimeDos2Win(DATETIME* pdt,
|
|---|
| 615 | CDATE* pcdate,
|
|---|
| 616 | CTIME* pctime);
|
|---|
| 617 |
|
|---|
| 618 | BOOL cnrhDateDos2Win(FDATE* pfd,
|
|---|
| 619 | CDATE* pcd);
|
|---|
| 620 |
|
|---|
| 621 | BOOL cnrhTimeDos2Win(FTIME* pft,
|
|---|
| 622 | CTIME* pct);
|
|---|
| 623 |
|
|---|
| 624 | #endif
|
|---|
| 625 |
|
|---|
| 626 | #if __cplusplus
|
|---|
| 627 | }
|
|---|
| 628 | #endif
|
|---|
| 629 |
|
|---|