Main Page | Class Hierarchy | Class List | File List | Class Members | File Members

lboxvar.c File Reference

#include "precomp.h"

Go to the source code of this file.

Functions

INT LBGetVariableHeightItemHeight (PLBIV plb, INT itemNumber)
void LBSetVariableHeightItemHeight (PLBIV plb, INT itemNumber, INT itemHeight)
INT CItemInWindowVarOwnerDraw (PLBIV plb, BOOL fPartial)
INT LBPage (PLBIV plb, INT startItem, BOOL fPageForwardDirection)
INT LBCalcVarITopScrollAmt (PLBIV plb, INT iTopOld, INT iTopNew)


Function Documentation

INT CItemInWindowVarOwnerDraw PLBIV  plb,
BOOL  fPartial
 

Definition at line 101 of file lboxvar.c.

References _GetClientRect(), tagLBIV::cMac, INT, tagLBIV::iTop, LBGetItemRect(), and tagLBIV::spwnd.

Referenced by CItemInWindow().

00104 { 00105 RECT rect; 00106 INT sItem; 00107 INT clientbottom; 00108 00109 _GetClientRect(plb->spwnd, (LPRECT)&rect); 00110 clientbottom = rect.bottom; 00111 00112 /* 00113 * Find the number of var height ownerdraw items which are visible starting 00114 * from plb->iTop. 00115 */ 00116 for (sItem = plb->iTop; sItem < plb->cMac; sItem++) { 00117 00118 /* 00119 * Find out if the item is visible or not 00120 */ 00121 if (!LBGetItemRect(plb, sItem, (LPRECT)&rect)) { 00122 00123 /* 00124 * This is the first item which is completely invisible, so return 00125 * how many items are visible. 00126 */ 00127 return (sItem - plb->iTop); 00128 } 00129 00130 if (!fPartial && rect.bottom > clientbottom) { 00131 00132 /* 00133 * If we only want fully visible items, then if this item is 00134 * visible, we check if the bottom of the item is below the client 00135 * rect, so we return how many are fully visible. 00136 */ 00137 return (sItem - plb->iTop - 1); 00138 } 00139 } 00140 00141 /* 00142 * All the items are visible 00143 */ 00144 return (plb->cMac - plb->iTop); 00145 }

INT LBCalcVarITopScrollAmt PLBIV  plb,
INT  iTopOld,
INT  iTopNew
 

Definition at line 198 of file lboxvar.c.

References _GetClientRect(), INT, LBGetItemRect(), and tagLBIV::spwnd.

Referenced by xxxNewITopEx().

00202 { 00203 RECT rc; 00204 RECT rcClient; 00205 00206 _GetClientRect(plb->spwnd, (LPRECT)&rcClient); 00207 00208 /* 00209 * Just optimize redrawing when move +/- 1 item. We will redraw all items 00210 * if moving more than 1 item ahead or back. This is good enough for now. 00211 */ 00212 if (iTopOld + 1 == iTopNew) { 00213 00214 /* 00215 * We are scrolling the current iTop up off the top off the listbox so 00216 * return a negative number. 00217 */ 00218 LBGetItemRect(plb, iTopOld, (LPRECT)&rc); 00219 return (rcClient.top - rc.bottom); 00220 } 00221 00222 if (iTopOld - 1 == iTopNew) { 00223 00224 /* 00225 * We are scrolling the current iTop down and the previous item is 00226 * becoming the new iTop so return a positive number. 00227 */ 00228 LBGetItemRect(plb, iTopNew, (LPRECT)&rc); 00229 return -rc.top; 00230 } 00231 00232 return rcClient.bottom - rcClient.top; 00233 }

INT LBGetVariableHeightItemHeight PLBIV  plb,
INT  itemNumber
 

Definition at line 25 of file lboxvar.c.

References BYTE, tagLBIV::cMac, tagLBIV::fHasStrings, gpsi, INT, tagLBIV::rgpch, UINT, and tagLBIV::wMultiple.

Referenced by LBGetItemRect(), LBGetSetItemHeightHandler(), LBPage(), and LBSetCItemFullMax().

00028 { 00029 BYTE itemHeight; 00030 int offsetHeight; 00031 00032 if (plb->cMac) { 00033 if (plb->fHasStrings) 00034 offsetHeight = plb->cMac * sizeof(LBItem); 00035 else 00036 offsetHeight = plb->cMac * sizeof(LBODItem); 00037 00038 if (plb->wMultiple) 00039 offsetHeight += plb->cMac; 00040 00041 offsetHeight += itemNumber; 00042 00043 itemHeight = *(plb->rgpch+(UINT)offsetHeight); 00044 00045 return (INT)itemHeight; 00046 00047 } 00048 00049 /* 00050 *Default, we return the height of the system font. This is so we can draw 00051 * the focus rect even though there are no items in the listbox. 00052 */ 00053 return gpsi->cySysFontChar; 00054 }

INT LBPage PLBIV  plb,
INT  startItem,
BOOL  fPageForwardDirection
 

Definition at line 157 of file lboxvar.c.

References _GetClientRect(), tagLBIV::cMac, INT, LBGetVariableHeightItemHeight(), max, min, and tagLBIV::spwnd.

Referenced by xxxInsureVisible(), xxxLBoxCtlKeyInput(), and xxxLBoxCtlScroll().

00161 { 00162 INT i; 00163 INT height; 00164 RECT rc; 00165 00166 if (plb->cMac == 1) 00167 return(0); 00168 00169 _GetClientRect(plb->spwnd, &rc); 00170 height = rc.bottom; 00171 i = startItem; 00172 00173 if (fPageForwardDirection) { 00174 while ((height >= 0) && (i < plb->cMac)) 00175 height -= LBGetVariableHeightItemHeight(plb, i++); 00176 00177 return((height >= 0) ? plb->cMac - 1 : max(i - 2, startItem + 1)); 00178 } else { 00179 while ((height >= 0) && (i >= 0)) 00180 height -= LBGetVariableHeightItemHeight(plb, i--); 00181 00182 return((height >= 0) ? 0 : min(i + 2, startItem - 1)); 00183 } 00184 00185 }

void LBSetVariableHeightItemHeight PLBIV  plb,
INT  itemNumber,
INT  itemHeight
 

Definition at line 67 of file lboxvar.c.

References BYTE, tagLBIV::cMac, tagLBIV::fHasStrings, tagLBIV::rgpch, UINT, and tagLBIV::wMultiple.

Referenced by LBGetSetItemHeightHandler().

00071 { 00072 int offsetHeight; 00073 00074 if (plb->fHasStrings) 00075 offsetHeight = plb->cMac * sizeof(LBItem); 00076 else 00077 offsetHeight = plb->cMac * sizeof(LBODItem); 00078 00079 if (plb->wMultiple) 00080 offsetHeight += plb->cMac; 00081 00082 offsetHeight += itemNumber; 00083 00084 *(plb->rgpch + (UINT)offsetHeight) = (BYTE)itemHeight; 00085 00086 }


Generated on Sat May 15 19:44:30 2004 for test by doxygen 1.3.7