| 171 | |
| 172 | // Draw the button |
| 173 | void CBitmapButtonEx::DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct) { |
| 174 | // TODO: Add your code to draw the specified item |
| 175 | CBitmap *bitmap; |
| 176 | CPalette *palette; |
| 177 | COLORREF old_color, new_color, new_shadow_color; |
| 178 | CFont *old_font = NULL; |
| 179 | CBitmap *old_bitmap = NULL; |
| 180 | CPalette *old_palette = NULL; |
| 181 | int old_mode = 0; |
| 182 | UINT old_alignment = 0; |
| 183 | |
| 184 | // If button is hidden, don't draw it |
| 185 | if (m_Hidden) |
| 186 | return; |
| 187 | |
| 188 | // Get button's state and draw appropriate bitmap |
| 189 | if (m_AnimBitmaps != NULL) { |
| 190 | bitmap = &m_AnimBitmaps[m_CurrAnimFrame]; |
| 191 | new_color = DOWN_TEXT_COLOR; |
| 192 | new_shadow_color = DOWN_TEXT_SHADOW_COLOR; |
| 193 | } else if (lpDrawItemStruct->itemState & ODS_SELECTED) { |
| 194 | bitmap = &m_DownBitmap; |
| 195 | new_color = DOWN_TEXT_COLOR; |
| 196 | new_shadow_color = DOWN_TEXT_SHADOW_COLOR; |
| 197 | } else if (!m_IgnoreDisabled && lpDrawItemStruct->itemState & ODS_DISABLED) { |
| 198 | bitmap = &m_DisabledBitmap; |
| 199 | new_color = DISABLED_TEXT_COLOR; |
| 200 | new_shadow_color = DISABLED_TEXT_SHADOW_COLOR; |
| 201 | } else if (m_MouseOverBtn || lpDrawItemStruct->itemState & ODS_FOCUS) { |
| 202 | bitmap = &m_MouseBitmap; |
| 203 | new_color = LIT_TEXT_COLOR; |
| 204 | new_shadow_color = LIT_TEXT_SHADOW_COLOR; |
| 205 | } else { |
| 206 | bitmap = &m_UpBitmap; |
| 207 | new_color = UP_TEXT_COLOR; |
| 208 | new_shadow_color = UP_TEXT_SHADOW_COLOR; |
| 209 | } |
| 210 | |
| 211 | // Use the Application default palette (speeds things up in 256 color) |
| 212 | palette = &theApp.m_palette; |
| 213 | |
| 214 | // RECT rect=lpDrawItemStruct->rcItem; |
| 215 | |
| 216 | // Obtain the client window for this button |
| 217 | CClientDC *dc; |
| 218 | try { |
| 219 | dc = new CClientDC(this); |
| 220 | } catch (CResourceException) { |
| 221 | OutputDebugString("Could not get ClientDC for bitmap button!\n"); |
| 222 | } |
| 223 | |
| 224 | CDC memDC; |
| 225 | |
| 226 | CRect crect; |
| 227 | GetClientRect(&crect); |
| 228 | |
| 229 | BITMAP m_bmInfo; // Bitmap info |
| 230 | bitmap->GetObject(sizeof(BITMAP), &m_bmInfo); |
nothing calls this directly
no test coverage detected