Changeset 55 for trunk/src/helpers/dialog.c
- Timestamp:
- Apr 6, 2001, 7:12:11 PM (24 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/helpers/dialog.c
r54 r55 157 157 typedef struct _ROWDEF 158 158 { 159 PTABLEDEF pOwningTable; // table whose linked list this row belongs to 160 161 LINKLIST llColumns; // contains COLUMNDEF structs, no auto-free 159 PTABLEDEF pOwningTable; // table whose linked list this row belongs to 160 161 LINKLIST llColumns; // contains COLUMNDEF structs, no auto-free 162 163 ULONG flRowFormat; // one of: 164 // -- ROW_VALIGN_BOTTOM 0x0000 165 // -- ROW_VALIGN_CENTER 0x0001 166 // -- ROW_VALIGN_TOP 0x0002 162 167 163 168 CONTROLPOS cpRow; … … 188 193 { 189 194 PROCESS_CALC_SIZES, // step 1 190 PROCESS_CALC_POSITIONS, // step 2191 PROCESS_CREATE_CONTROLS // step 3195 PROCESS_CALC_POSITIONS, // step 3 196 PROCESS_CREATE_CONTROLS // step 4 192 197 } PROCESSMODE; 193 198 … … 212 217 213 218 VOID CalcAutoSizeText(PCONTROLDEF pControlDef, 219 BOOL fMultiLine, // in: if TRUE, multiple lines 214 220 PSIZEL pszlAuto, // out: computed size 215 221 PDLGPRIVATE pDlgData) … … 265 271 if (pControlDef->pcszText) 266 272 { 267 POINTL aptl[TXTBOX_COUNT]; 268 GpiQueryTextBox(pDlgData->hps, 269 strlen(pControlDef->pcszText), 270 (PCH)pControlDef->pcszText, 271 TXTBOX_COUNT, 272 aptl); 273 pszlAuto->cx = aptl[TXTBOX_TOPRIGHT].x - aptl[TXTBOX_BOTTOMLEFT].x; 273 // do we have multiple lines? 274 if (fMultiLine) 275 { 276 RECTL rcl = {0, 0, 1000, 1000}; 277 winhDrawFormattedText(pDlgData->hps, 278 &rcl, 279 pControlDef->pcszText, 280 DT_LEFT | DT_TOP | DT_WORDBREAK | DT_QUERYEXTENT); 281 pszlAuto->cx = rcl.xRight - rcl.xLeft; 282 pszlAuto->cy = rcl.yTop - rcl.yBottom; 283 } 284 else 285 { 286 POINTL aptl[TXTBOX_COUNT]; 287 GpiQueryTextBox(pDlgData->hps, 288 strlen(pControlDef->pcszText), 289 (PCH)pControlDef->pcszText, 290 TXTBOX_COUNT, 291 aptl); 292 pszlAuto->cx = aptl[TXTBOX_TOPRIGHT].x - aptl[TXTBOX_BOTTOMLEFT].x; 293 } 274 294 } 275 295 } … … 292 312 case 0xffff0003L: // WC_BUTTON: 293 313 CalcAutoSizeText(pControlDef, 314 FALSE, // no multiline 294 315 pszlAuto, 295 316 pDlgData); … … 316 337 if (pControlDef->flStyle & SS_TEXT) 317 338 CalcAutoSizeText(pControlDef, 339 ((pControlDef->flStyle & DT_WORDBREAK) != 0), 318 340 pszlAuto, 319 341 pDlgData); … … 384 406 pColumnDef->pOwningRow = pOwningRow; 385 407 386 // for PROCESS_CALC_SIZES: have control return its size387 // plus spacings into szlControl388 // for PROCESS_CALC_POSITIONS: have control compute its389 // position from the column position (there may be390 // spacings)391 // for PROCESS_CREATE_CONTROLS: well, create the control392 408 switch (ProcessMode) 393 409 { 410 /* 411 * PROCESS_CALC_SIZES: 412 * step 1. 413 */ 414 394 415 case PROCESS_CALC_SIZES: 395 416 { … … 454 475 break; } 455 476 477 /* 478 * PROCESS_CALC_POSITIONS: 479 * step 2. 480 */ 481 456 482 case PROCESS_CALC_POSITIONS: 457 483 { … … 459 485 ULONG ulSpacing = 0; 460 486 461 // column position = *plX 487 // column position = *plX on ProcessRow stack 462 488 pColumnDef->cpColumn.x = *plX; 463 489 pColumnDef->cpColumn.y = pOwningRow->cpRow.y; 490 491 // check vertical alignment of row; 492 // we might need to increase column y 493 switch (pOwningRow->flRowFormat & ROW_VALIGN_MASK) 494 { 495 // case ROW_VALIGN_BOTTOM: // do nothing 496 497 case ROW_VALIGN_CENTER: 498 if (pColumnDef->cpColumn.cy < pOwningRow->cpRow.cy) 499 pColumnDef->cpColumn.y 500 += ( (pOwningRow->cpRow.cy - pColumnDef->cpColumn.cy) 501 / 2); 502 break; 503 504 case ROW_VALIGN_TOP: 505 if (pColumnDef->cpColumn.cy < pOwningRow->cpRow.cy) 506 pColumnDef->cpColumn.y 507 += (pOwningRow->cpRow.cy - pColumnDef->cpColumn.cy); 508 break; 509 } 464 510 465 511 if (pColumnDef->fIsNestedTable) … … 481 527 *plX += pColumnDef->cpColumn.cx; 482 528 483 // calculate controlpos by applying spacing529 // calculate CONTROL pos from COLUMN pos by applying spacing 484 530 pColumnDef->cpControl.x = pColumnDef->cpColumn.x 485 531 + ulSpacing; … … 499 545 } 500 546 break; } 547 548 /* 549 * PROCESS_CREATE_CONTROLS: 550 * step 3. 551 */ 501 552 502 553 case PROCESS_CREATE_CONTROLS: … … 1176 1227 lstInit(&pCurrentRow->llColumns, FALSE); 1177 1228 1229 pCurrentRow->flRowFormat = pItemThis->ulData; 1230 1178 1231 lstAppendItem(&pCurrentTable->llRows, pCurrentRow); 1179 1232 }
Note:
See TracChangeset
for help on using the changeset viewer.