Example #1
0
void DrawMenuFrame(Menu *menu, int items)
{
  int a;
  Node *mi;

  XClearWindow(disp,menu->win);

  DrawBevel(menu->win,0,0,menu->width-1,menu->height-1,MENUBORDERW,\
                                      TheScreen.MenuLightGC,TheScreen.MenuShadowGC);
  if(menu->name) {
    DrawBevel(menu->win,MENUBORDERW,MENUBORDERW,menu->width-MENUBORDERW-1,\
                               menu->ItemHeight+MENUBORDERW-1,MENUBORDERW,\
                                             TheScreen.MenuShadowGC,TheScreen.MenuLightGC);
    XDrawString(disp,menu->win,TheScreen.MenuTextGC,MENUXOFS+2*MENUBORDERW,MENUYOFS+\
             2*MENUBORDERW+menu->font->ascent,menu->name,strlen(menu->name));
  }

  mi=NULL;
  while((mi=NodeNext(menu->Items,mi))){
    MenuItem *item;
    item=mi->data;
    if(item->type != I_LINE) {
      if(items) DrawItem(item, 0);
    } else {
      int h;
      h=item->y;
      for(a=0;a<MENUBORDERW;a++) {
        XDrawLine(disp,menu->win,TheScreen.MenuShadowGC,a+1,h-1-a,menu->width-a,h-1-a);
        XDrawLine(disp,menu->win,TheScreen.MenuLightGC,a,a+h,menu->width-a-2,a+h);
      }
    }
  }
}
Example #2
0
void SelectItem(MenuItem *item, unsigned int state)
{
  if(selectedMenuItem){
    DrawBevel(selectedMenuItem->win, 0, 0,
              selectedMenuItem->menu->width - 2 * MENUBORDERW - 1,
              selectedMenuItem->menu->ItemHeight - 1, MENUBORDERW,
              TheScreen.MenuBackGC, TheScreen.MenuBackGC);
  }
  selectedMenuItem=item;
  if(selectedMenuItem){
    if((selectedMenuItem->y+selectedMenuItem->menu->y
        + selectedMenuItem->menu->ItemHeight) >= TheScreen.height){
      XWarpPointer(disp,None,None,0,0,0,0,0,-MENUSCROLLHEIGHT*\
                           selectedMenuItem->menu->ItemHeight);
      selectedMenuItem->menu->y -= MENUSCROLLHEIGHT 
	                           * selectedMenuItem->menu->ItemHeight;
      XMoveWindow(disp, selectedMenuItem->menu->win, selectedMenuItem->menu->x,
		  selectedMenuItem->menu->y);
    }
    if((selectedMenuItem->y+selectedMenuItem->menu->y)<=0){
      XWarpPointer(disp,None,None,0,0,0,0,0,MENUSCROLLHEIGHT*\
                                  selectedMenuItem->menu->ItemHeight);
      selectedMenuItem->menu->y += MENUSCROLLHEIGHT
	                           * selectedMenuItem->menu->ItemHeight;
      XMoveWindow(disp, selectedMenuItem->menu->win, selectedMenuItem->menu->x,
		  selectedMenuItem->menu->y);
    }
    if(ButtonCount(state)>0) MenuDontKeepItAnymore();
    if(selectedMenuItem->menu != activemen){
      DeleteSubMenus(selectedMenuItem->menu);
      activemen = selectedMenuItem->menu;
    }
    if(selectedMenuItem->type == I_SUBMENU) {
      long int x,y;
      Menu *men;
      men=selectedMenuItem->data;
      men->parent=selectedMenuItem->menu;
      x=selectedMenuItem->menu->x+selectedMenuItem->menu->width*0.8;
      if((x+men->width)>TheScreen.width) x=selectedMenuItem->menu->x-men->width;
      if(x<30) x=30;
      y=selectedMenuItem->menu->y+selectedMenuItem->y;
      if(y>(((signed long int)TheScreen.height)-((signed long int)men->height-\
                                         1))) y=TheScreen.height-men->height-1;
      if(y<0) y=0;
      MapMenu(men, x, y);
    }
    DrawBevel(item->win, 0, 0, item->menu->width - 2 * MENUBORDERW - 1,
              item->menu->ItemHeight - 1, MENUBORDERW,
              TheScreen.MenuShadowGC, TheScreen.MenuLightGC);
  }
}
Example #3
0
void CColorButtonCtrl::DrawBevelInset(CDC* pDC, CRect& rc)
{
    CPen penLight(PS_SOLID, 1, ::GetSysColor(COLOR_3DHILIGHT));
    CPen penShadow(PS_SOLID, 1, ::GetSysColor(COLOR_3DSHADOW));

    DrawBevel(pDC, rc, penShadow, penLight);
}
//---------------------------------------------------------------------------
// This routine draws a bevel around TeeChart axes
void __fastcall DrawBevelAroundAxes(TCustomChart *Chart, TBevelCut Style, int Size)
{
  TRect R = Chart->ChartRect;
  R.Right += 1;
  R.Bottom += 1;
  DrawBevel(Chart->Canvas,Style,R,Size);
}
Example #5
0
void DrawItem(MenuItem *item, short deactivate)
{
  XClearWindow(disp,item->win);
  XDrawString(disp,item->win,TheScreen.MenuTextGC,MENUXOFS+MENUBORDERW,\
            MENUYOFS+MENUBORDERW+item->menu->font->ascent,item->name,\
                                                  strlen(item->name));
  if(item->type==I_SUBMENU) {
    XDrawLine(disp,item->win,TheScreen.MenuTextGC,item->menu->width-4*\
           MENUBORDERW,item->menu->ItemHeight/2,item->menu->width-10*\
                               MENUBORDERW,item->menu->ItemHeight/2);
    XDrawLine(disp,item->win,TheScreen.MenuTextGC,item->menu->width-6.6*\
                 MENUBORDERW,item->menu->ItemHeight/2-1.5*MENUBORDERW,\
             item->menu->width-4*MENUBORDERW,item->menu->ItemHeight/2);
  }
  if(item->type==I_SWITCH_OFF) {
    DrawBevel(item->win,item->menu->width-9*MENUBORDERW,\
                 item->menu->ItemHeight/2-2*MENUBORDERW,\
                      item->menu->width-5*MENUBORDERW-1,\
               item->menu->ItemHeight/2+2*MENUBORDERW-1,\
                        MENUBORDERW,TheScreen.MenuLightGC,\
                                   TheScreen.MenuShadowGC);
  }
  if(item->type==I_SWITCH_ON) {
    DrawBevel(item->win,item->menu->width-9*MENUBORDERW,\
                 item->menu->ItemHeight/2-2*MENUBORDERW,\
                      item->menu->width-5*MENUBORDERW-1,\
               item->menu->ItemHeight/2+2*MENUBORDERW-1,\
                       MENUBORDERW,TheScreen.MenuShadowGC,\
                                    TheScreen.MenuLightGC);
    XFillRectangle(disp,item->win,TheScreen.MenuTextGC,\
                     item->menu->width-8*MENUBORDERW,\
                item->menu->ItemHeight/2-MENUBORDERW,\
                         2*MENUBORDERW,2*MENUBORDERW);
  }
  if(!deactivate && (item == selectedMenuItem))
    DrawBevel(item->win,0,0,item->menu->width-2*MENUBORDERW-1,\
                         item->menu->ItemHeight-1,MENUBORDERW,\
                     TheScreen.MenuShadowGC,TheScreen.MenuLightGC);
}
Example #6
0
void QSegmentWidget::InitPixmap()
{
  m_pixmap = new QPixmap(BM_OSIZE, BM_OSIZE);
//  m_pixmap->fill(palette().color(backgroundRole()));
  m_pixmap->fill(Qt::transparent);
  QPainter painter(m_pixmap);
  painter.setRenderHint(QPainter::Antialiasing);
  painter.setRenderHint(QPainter::SmoothPixmapTransform);
  painter.setWindow( -(BM_OSIZE / 2), -(BM_OSIZE / 2),
    BM_OSIZE, BM_OSIZE);
//    qDebug() << QString("InitPixmap (%1, %2)").arg(-(BM_OSIZE / 2)).arg(BM_OSIZE);
  DrawBevel(&painter);
  DrawBackground(&painter);
//  DrawCenterText(&painter);
}
Example #7
0
/*
** Draws the solid background & bevel if such are defined
*/
bool Meter::Draw(Gfx::Canvas& canvas)
{
	if (IsHidden()) return false;

	canvas.SetAntiAliasing(m_AntiAlias);

	if (m_SolidColor.a != 0.0f || m_SolidColor2.a != 0.0f)
	{
		const FLOAT x = (FLOAT)GetX();
		const FLOAT y = (FLOAT)GetY();

		const D2D1_RECT_F r = D2D1::RectF(x, y, x + (FLOAT)m_W, y + (FLOAT)m_H);

		if (m_SolidColor.r == m_SolidColor2.r && m_SolidColor.g == m_SolidColor2.g && 
			m_SolidColor.b == m_SolidColor2.b && m_SolidColor.a == m_SolidColor2.a)
		{
			canvas.FillRectangle(r, m_SolidColor);
		}
		else
		{
			canvas.FillGradientRectangle(r, m_SolidColor, m_SolidColor2, (FLOAT)m_SolidAngle);
		}
	}

	if (m_SolidBevel != BEVELTYPE_NONE)
	{
		D2D1_COLOR_F lightColor = D2D1::ColorF(D2D1::ColorF::White);
		D2D1_COLOR_F darkColor = D2D1::ColorF(D2D1::ColorF::Black);
		
		if (m_SolidBevel == BEVELTYPE_DOWN)
		{
			lightColor = D2D1::ColorF(D2D1::ColorF::Black);
			darkColor = D2D1::ColorF(D2D1::ColorF::White);
		}

		// The bevel is drawn outside the meter
		const FLOAT x = (FLOAT)GetX();
		const FLOAT y = (FLOAT)GetY();
		const D2D1_RECT_F rect = D2D1::RectF(x - 2.0f, y - 2.0f, x + (FLOAT)m_W + 2.0f, y + (FLOAT)m_H + 2.0f);
		DrawBevel(canvas, rect, lightColor, darkColor);
	}

	return true;
}