示例#1
0
/* 
 * StatsListDrawItem:  Message handler for stats list boxes.  Return TRUE iff
 *   message is handled.
 */
BOOL StatsListDrawItem(HWND hwnd, const DRAWITEMSTRUCT *lpdis)
{
   AREA stats_area;

   if (hList == NULL)
      return TRUE;

   switch (lpdis->itemAction)
   {
   case ODA_SELECT:
   case ODA_DRAWENTIRE:
      /* If box is empty, do nothing */
      if (lpdis->itemID == -1)
	 return TRUE;

      /* Draw window background at correct offset */
      StatsGetArea(&stats_area);
      DrawWindowBackgroundColor(pinventory_bkgnd(), lpdis->hDC, (RECT *) (&lpdis->rcItem),			//	was NULL
				stats_area.x + lpdis->rcItem.left,
				stats_area.y + lpdis->rcItem.top + StatsGetButtonBorder(), -1);

      /* Draw info on stat */
	  StatsListDrawStat(lpdis, (Bool) (lpdis->itemState & ODS_SELECTED), (Bool)( StatsGetCurrentGroup() == STATS_SPELLS ) );
      break;

   case ODA_FOCUS:
//      DrawFocusRect(lpdis->hDC, &lpdis->rcItem);
      break;
   }
   
   return TRUE;
}
示例#2
0
/*
 * DisplayNumericStat:  Display the given numeric type stat from the current group on the
 *   main window.
 */
void DisplayNumericStat(Statistic *s)
{
   RECT r;
   HDC hdc;
   HFONT hOldFont;
   char *name, *str;
   AREA stats_area;
   AREA a;

	//	ajw - Avoid drawing if Inventory is selected as the "group".
	if( StatsGetCurrentGroup() == STATS_INVENTORY )
		return;
	
   StatsGetArea(&stats_area);

   r.left   = 0;
   r.right  = stats_area.cx / 2;
   r.top    = s->y;
   r.bottom = r.top + s->cy;

   /* If stat is out of stats area, abort */
   if (r.bottom > stats_area.cy || s->num <= top_stat)
      return;

   hdc = GetDC(hStats);
//   DrawWindowBackground(hdc, &r, stats_area.x + r.left, stats_area.y + r.top);
   DrawWindowBackgroundColor( pinventory_bkgnd(), hdc, &r, stats_area.x + r.left, stats_area.y + r.top, -1 );

   hOldFont = (HFONT) SelectObject(hdc, GetFont(FONT_STATS));

   SetBkMode(hdc, TRANSPARENT);

   name = LookupNameRsc(s->name_res);

   // Draw with drop shadow
   SetTextColor(hdc, GetColor(COLOR_STATSBGD));
   DrawText(hdc, name, strlen(name), &r, DT_LEFT);
   OffsetRect(&r, 1, 1);
   SetTextColor(hdc, GetColor(COLOR_STATSFGD));
   DrawText(hdc, name, strlen(name), &r, DT_LEFT);

   switch (s->numeric.tag)
   {
   case STAT_RES:
      r.left  = stats_area.cx / 2;
      r.right = stats_area.cx;
      DrawWindowBackgroundColor( pinventory_bkgnd(), hdc, &r, stats_area.x + r.left, stats_area.y + r.top, -1 );

      str = LookupNameRsc(s->numeric.value);
      DrawText(hdc, str, strlen(str), &r, DT_RIGHT);
      break;

   case STAT_INT:
      // Draw background around stat bar
     a.x = stats_area.cx / 2;
     a.cx = stats_bar_width;
     a.y = s->y + (s->cy - STATS_BAR_HEIGHT) / 2;
     a.cy = STATS_BAR_HEIGHT;
     InterfaceDrawBarBorder( pinventory_bkgnd(), hdc, &a );
     break;
   }

   SelectObject(hdc, hOldFont);
   ReleaseDC(hStats, hdc);

   InvalidateRect( s->hControl, NULL, FALSE );
}