[242] | 1 | /*
|
---|
| 2 | *@@sourcefile cnr.h.h:
|
---|
| 3 | * private header file for cctl_cnr.c. See remarks there.
|
---|
| 4 | *
|
---|
| 5 | * Note: Version numbering in this file relates to XWorkplace version
|
---|
| 6 | * numbering.
|
---|
| 7 | */
|
---|
| 8 |
|
---|
| 9 | /* Copyright (C) 2003 Ulrich Mller.
|
---|
| 10 | * This file is part of the "XWorkplace helpers" source package.
|
---|
| 11 | * This is free software; you can redistribute it and/or modify
|
---|
| 12 | * it under the terms of the GNU General Public License as published
|
---|
| 13 | * by the Free Software Foundation, in version 2 as it comes in the
|
---|
| 14 | * "COPYING" file of the XWorkplace main distribution.
|
---|
| 15 | * This program 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
|
---|
| 18 | * GNU General Public License for more details.
|
---|
| 19 | *
|
---|
| 20 | */
|
---|
| 21 |
|
---|
| 22 | #if __cplusplus
|
---|
| 23 | extern "C" {
|
---|
| 24 | #endif
|
---|
| 25 |
|
---|
| 26 | #ifndef PRIVATE_CNR_HEADER_INCLUDED
|
---|
| 27 | #define PRIVATE_CNR_HEADER_INCLUDED
|
---|
| 28 |
|
---|
| 29 | /* ******************************************************************
|
---|
| 30 | *
|
---|
| 31 | * Global stuff
|
---|
| 32 | *
|
---|
| 33 | ********************************************************************/
|
---|
| 34 |
|
---|
| 35 | #define WC_CCTL_CNR_DETAILS "ComctlCnrDtls"
|
---|
| 36 |
|
---|
[243] | 37 | extern const CCTLCOLOR G_scsCnr[];
|
---|
[242] | 38 |
|
---|
[243] | 39 | #define CNRCOL_HILITEBGND 2
|
---|
| 40 | #define CNRCOL_HILITEFGND 3
|
---|
| 41 | #define CNRCOL_BORDER 4
|
---|
| 42 | #define CNRCOL_EDITBGND 5
|
---|
| 43 | #define CNRCOL_EDITFGND 6
|
---|
| 44 | #define CNRCOL_SIZINGBOX 7
|
---|
| 45 |
|
---|
[242] | 46 | #define COLUMN_PADDING_X 7
|
---|
| 47 | #define COLUMN_PADDING_Y 3
|
---|
| 48 | // padding to apply between column border and column data
|
---|
| 49 |
|
---|
| 50 | #define DEFAULT_BORDER_WIDTH 1
|
---|
| 51 | // default width of lines used for details and tree view lines
|
---|
| 52 |
|
---|
| 53 | /*
|
---|
| 54 | *@@ DETAILCOLUMN:
|
---|
| 55 | * private wrapper data around FIELDINFO.
|
---|
| 56 | */
|
---|
| 57 |
|
---|
| 58 | typedef struct _DETAILCOLUMN
|
---|
| 59 | {
|
---|
| 60 | const FIELDINFO *pfi; // ptr to fieldinfo for this column
|
---|
| 61 |
|
---|
[243] | 62 | LONG cxContent; // current width of the column (excluding padding);
|
---|
[242] | 63 | // -- if pfi->cxWidth == 0, this is the computed auto-size;
|
---|
| 64 | // -- otherwise this is a copy of the pfi->cxWidth value
|
---|
| 65 |
|
---|
| 66 | LONG cxWidestRecord; // width of widest record data in this column (excluding padding)
|
---|
| 67 |
|
---|
| 68 | SIZEL szlTitleData; // dimensions of title data (excluding padding)
|
---|
| 69 |
|
---|
[243] | 70 | LONG xLeft; // left border of column in cnr workspace coordinates;
|
---|
| 71 | // this includes spacing, i.e. is 0 for the leftmost column
|
---|
[242] | 72 |
|
---|
| 73 | } DETAILCOLUMN, *PDETAILCOLUMN;
|
---|
| 74 |
|
---|
| 75 | /*
|
---|
| 76 | *@@ RECORDLISTITEM:
|
---|
| 77 | * private wrapper data around an app's RECORDCORE
|
---|
| 78 | * that is currently inserted somewhere.
|
---|
| 79 | *
|
---|
| 80 | * We create both a list node and a tree node for
|
---|
| 81 | * each record that is currently inserted.
|
---|
| 82 | */
|
---|
| 83 |
|
---|
| 84 | typedef struct _RECORDLISTITEM
|
---|
| 85 | {
|
---|
| 86 | const RECORDCORE
|
---|
| 87 | *precc, // ptr to app's RECORDCORE buffer
|
---|
| 88 | *preccParent; // parent of record or NULL if root
|
---|
| 89 |
|
---|
[243] | 90 | ULONG flRecordAttr; // private copy of record's attributes
|
---|
| 91 |
|
---|
| 92 | ULONG flInvalidate; // CMA_TEXTCHANGED et al flags from
|
---|
| 93 | // CM_INVALIDATERECORD or 0 if record is fresh
|
---|
| 94 |
|
---|
| 95 | POINTL ptl; // position of record as calculated by us (in
|
---|
| 96 | // workspace coordinates)
|
---|
| 97 |
|
---|
[242] | 98 | SIZEL szlContent; // space that records needs in current cnr view
|
---|
| 99 | // (excluding padding)
|
---|
| 100 | SIZEL szlBox; // space that records needs in current cnr view
|
---|
| 101 | // (including padding)
|
---|
[243] | 102 | // LONG yOfs; // y offset of the top of this record's rectangle
|
---|
[242] | 103 | // from the top of the cnr workspace. Positive
|
---|
| 104 | // values mean the record is further down.
|
---|
| 105 | // In Details view, the topmost record has an
|
---|
| 106 | // offset of 0.
|
---|
| 107 |
|
---|
| 108 | } RECORDLISTITEM, *PRECORDLISTITEM;
|
---|
| 109 |
|
---|
| 110 | /*
|
---|
| 111 | *@@ RECORDTREEITEM:
|
---|
| 112 | * second private wrapper data around a
|
---|
| 113 | * RECORDCORE that is currently inserted somewhere.
|
---|
| 114 | *
|
---|
| 115 | * We create both a list node and a tree node for
|
---|
| 116 | * each record that is currently inserted.
|
---|
| 117 | */
|
---|
| 118 |
|
---|
| 119 | typedef struct _RECORDTREEITEM
|
---|
| 120 | {
|
---|
| 121 | TREE Tree; // ulKey is app's PRECORDCORE
|
---|
| 122 | PLISTNODE pListNode; // points to the LISTNODE corresponding to record
|
---|
| 123 | } RECORDTREEITEM, *PRECORDTREEITEM;
|
---|
| 124 |
|
---|
| 125 | /*
|
---|
| 126 | *@@ CNRDATA:
|
---|
[243] | 127 | * private container data, allocated on WM_CREATE and
|
---|
| 128 | * stored at QWL_USER + 1 in the container main and
|
---|
| 129 | * subwindows.
|
---|
[242] | 130 | */
|
---|
| 131 |
|
---|
| 132 | typedef struct _CNRDATA
|
---|
| 133 | {
|
---|
| 134 | DEFWINDATA dwdMain,
|
---|
| 135 | dwdContent;
|
---|
| 136 |
|
---|
[243] | 137 | BOOL fMiniRecords; // set to TRUE on WM_CREATE if we have the
|
---|
| 138 | // CCS_MINIRECORDCORE style bit set
|
---|
[242] | 139 |
|
---|
[243] | 140 | CNRINFO CnrInfo; // private container info struct
|
---|
[242] | 141 |
|
---|
| 142 | LINKLIST llAllocatedFIs; // contains PFIELDINFO's that were allocated, auto-free
|
---|
| 143 | LINKLIST llColumns; // contains PDETAILCOLUMN's with FIELDINFO's that are
|
---|
| 144 | // currently inserted, auto-free
|
---|
| 145 |
|
---|
| 146 | LINKLIST llAllocatedRecs; // contains PRECORDCORE's that were allocated, auto-free
|
---|
| 147 | LINKLIST llRootRecords; // contains PRECORDLISTITEM's with RECORDCORE's that are
|
---|
| 148 | // currently inserted at root level (i.e. have no parent
|
---|
| 149 | // record), auto-free
|
---|
| 150 | TREE *RecordsTree; // tree of _all_ currently inserted RECORDLISTITEM's;
|
---|
| 151 | // we use CnrInfo.cRecords for the tree count
|
---|
| 152 |
|
---|
| 153 | // paint data
|
---|
| 154 |
|
---|
[243] | 155 | COUNTRYSETTINGS2 cs; // current NLS settings for painting CMA_DATE etc.
|
---|
[242] | 156 |
|
---|
[243] | 157 | FONTMETRICS fm; // font metrics of current font
|
---|
[242] | 158 |
|
---|
| 159 | LONG cyColTitlesContent, // if CnrInfo.flWindowAttr & CA_DETAILSVIEWTITLES, height of
|
---|
| 160 | // column titles area (excluding padding and horz. separator)
|
---|
| 161 | cyColTitlesBox; // ... and including those
|
---|
| 162 |
|
---|
[243] | 163 | BOOL fSettingPP; // anti-recursion flag
|
---|
[242] | 164 |
|
---|
[243] | 165 | // scrolling data
|
---|
[242] | 166 |
|
---|
[243] | 167 | SCROLLABLEWINDOW scrw;
|
---|
| 168 |
|
---|
| 169 | // selection data
|
---|
| 170 |
|
---|
| 171 | PRECORDLISTITEM
|
---|
| 172 | prliCursored; // currently cursored record (there can only be one ever)
|
---|
| 173 |
|
---|
| 174 | PRECORDLISTITEM
|
---|
| 175 | prliSwipingFirst; // set to record on which swipe select started; NULL if
|
---|
| 176 | // we're not currently swipe-selecting
|
---|
| 177 | BOOL fSwipeTurnOn; // if TRUE, we select records while swiping; if FALSE,
|
---|
| 178 | // we deselect
|
---|
| 179 |
|
---|
[242] | 180 | } CNRDATA, *PCNRDATA;
|
---|
| 181 |
|
---|
| 182 | // bits for WM_SEM2
|
---|
[243] | 183 | #define DDFL_INVALIDATECOLUMNS 0x0001
|
---|
| 184 | // no. of columns changed, recompute column data
|
---|
[242] | 185 |
|
---|
[243] | 186 | #define DDFL_INVALIDATERECORDS 0x0002
|
---|
| 187 | // record data changed, recompute all records and adjust columns
|
---|
[242] | 188 |
|
---|
[243] | 189 | #define DDFL_INVALIDATESOME 0x0004
|
---|
| 190 | // some records changed, recompute only those that have szlContent.x == -1
|
---|
[242] | 191 |
|
---|
[243] | 192 | #define DDFL_WINDOWSIZECHANGED 0x0008
|
---|
| 193 | // subwindows need repositioning
|
---|
[242] | 194 |
|
---|
[243] | 195 | #define DDFL_WORKAREACHANGED 0x0010
|
---|
| 196 | // cnr workarea changed, adjust scrollbars
|
---|
| 197 |
|
---|
[242] | 198 | #define DDFL_ALL 0xFFFF
|
---|
| 199 |
|
---|
| 200 | /* ******************************************************************
|
---|
| 201 | *
|
---|
| 202 | * Cnr details view stuff
|
---|
| 203 | *
|
---|
| 204 | ********************************************************************/
|
---|
| 205 |
|
---|
[243] | 206 | VOID ctnrInit(HWND hwnd,
|
---|
| 207 | MPARAM mp2,
|
---|
| 208 | ULONG flMainCnrStyle,
|
---|
| 209 | PDEFWINDATA pdwd);
|
---|
| 210 |
|
---|
| 211 | VOID ctnrDrawString(HPS hps,
|
---|
[242] | 212 | PCSZ pcsz,
|
---|
| 213 | PRECTL prcl,
|
---|
| 214 | ULONG fl,
|
---|
| 215 | PFONTMETRICS pfm);
|
---|
| 216 |
|
---|
[243] | 217 | VOID ctnrGetRecordRect(PCNRDATA pData,
|
---|
| 218 | PRECTL prcl,
|
---|
| 219 | const RECORDLISTITEM *prli);
|
---|
| 220 |
|
---|
| 221 | BOOL ctnrRepaintRecord(PCNRDATA pData,
|
---|
| 222 | const RECORDLISTITEM *prli);
|
---|
| 223 |
|
---|
| 224 | ULONG ctnrQuerySelMode(PCNRDATA pData);
|
---|
| 225 |
|
---|
| 226 | BOOL ctnrChangeEmphasis(PCNRDATA pData,
|
---|
| 227 | PRECORDLISTITEM prliSet,
|
---|
| 228 | BOOL fTurnOn,
|
---|
| 229 | ULONG fsEmphasis);
|
---|
| 230 |
|
---|
| 231 | VOID ctnrPresParamChanged(HWND hwnd,
|
---|
[242] | 232 | ULONG ulpp);
|
---|
| 233 |
|
---|
[243] | 234 | BOOL ctnrSetRecordEmphasis(PCNRDATA pData,
|
---|
| 235 | PRECORDCORE precc,
|
---|
| 236 | BOOL fTurnOn,
|
---|
| 237 | USHORT fsEmphasis,
|
---|
| 238 | BOOL fMouse);
|
---|
| 239 |
|
---|
| 240 | VOID ctnrRecordEnter(PCNRDATA pData,
|
---|
| 241 | const RECORDLISTITEM *prli,
|
---|
| 242 | BOOL fKeyboard);
|
---|
| 243 |
|
---|
| 244 | PLISTNODE ctnrFindListNodeForRecc(PCNRDATA pData,
|
---|
| 245 | const RECORDCORE *precc);
|
---|
| 246 |
|
---|
[242] | 247 | VOID cdtlRecalcDetails(PCNRDATA pData,
|
---|
| 248 | HPS hps,
|
---|
| 249 | PULONG pfl);
|
---|
| 250 |
|
---|
| 251 | MRESULT EXPENTRY fnwpCnrDetails(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2);
|
---|
| 252 |
|
---|
| 253 | #endif
|
---|
| 254 |
|
---|
| 255 | #if __cplusplus
|
---|
| 256 | }
|
---|
| 257 | #endif
|
---|
| 258 |
|
---|