15 #define ICON_SPACING 4
19 static void drawRectangle(FXDC& dc,FXColor lower,FXColor upper,FXint x,FXint y,FXint w,FXint h){
20 register FXint rr,gg,bb,dr,dg,db,r1,g1,b1,r2,g2,b2,yl,yh,yy,dy,n,t;
21 const FXint MAXSTEPS=128;
24 dc.setStipple(STIPPLE_NONE);
25 dc.setFillStyle(FILL_SOLID);
27 r1=FXREDVAL(lower); r2=FXREDVAL(upper); dr=r2-r1;
28 g1=FXGREENVAL(lower); g2=FXGREENVAL(upper); dg=g2-g1;
29 b1=FXBLUEVAL(lower); b2=FXBLUEVAL(upper); db=b2-b1;
32 if((t=FXABS(dg))>n) n=t;
33 if((t=FXABS(db))>n) n=t;
36 if(n>MAXSTEPS) n=MAXSTEPS;
51 dc.setForeground(FXRGB(rr>>16,gg>>16,bb>>16));
52 dc.fillRectangle(x,y+yl,w,yh-yl);
71 FXObject* tgt, FXSelector sel, FXuint opts,
72 FXint x, FXint y, FXint w, FXint h,
73 FXint pl, FXint pr, FXint pt, FXint pb)
74 : FXButton( p, text, ic, tgt, sel, opts, x, y, w, h, pl, pr, pt, pb )
79 FXint tw=0,th=0,iw=0,ih=0,tx,ty,ix,iy;
80 FXEvent*ev=(FXEvent*)ptr;
81 FXDCWindow dc(
this,ev);
84 FXColor top = FXRGB(0xfe,0xfd,0xfd);
85 FXColor bottom = FXRGB(0xdd,0xd7,0xce);
86 FXColor shade = FXRGB(0xdc,0xd9,0xd4);
90 FXColor bordercolor = FXRGB(123,158,189);
98 FXPoint basebackground[4]={FXPoint(0,0),FXPoint(width-1,0),FXPoint(0,height-1),FXPoint(width-1,height-1)};
100 FXPoint bordershade[16]={
101 FXPoint(0,1),FXPoint(1,0),FXPoint(1,2),FXPoint(2,1),
102 FXPoint(width-2,0),FXPoint(width-1,1),FXPoint(width-3,1),FXPoint(width-2,2),
103 FXPoint(0,height-2),FXPoint(1,height-1),FXPoint(1,height-3),FXPoint(2,height-2),
104 FXPoint(width-1,height-2),FXPoint(width-2,height-1),FXPoint(width-2,height-3),FXPoint(width-3,height-2)
106 FXPoint bordercorners[4]={
107 FXPoint(1,1),FXPoint(1,height-2),FXPoint(width-2,1),FXPoint(width-2,height-2)
111 if (options&BUTTON_TOOLBAR && !underCursor()) {
112 dc.setForeground(baseColor);
113 dc.fillRectangle(0,0,width,height);
115 else if (state==STATE_UP && ((options&BUTTON_TOOLBAR)==0 || (options&BUTTON_TOOLBAR && underCursor()))) {
117 dc.setForeground(baseColor);
118 dc.drawPoints(basebackground,4);
120 dc.setForeground(bordercolor);
121 dc.drawRectangle(2,0,width-5,0);
122 dc.drawRectangle(2,height-1,width-5,height-1);
123 dc.drawRectangle(0,2,0,height-5);
124 dc.drawRectangle(width-1,2,width-1,height-5);
125 dc.drawPoints(bordercorners,4);
126 dc.setForeground(shade);
127 dc.drawPoints(bordershade,16);
130 dc.setForeground(top);
131 dc.drawRectangle(1,3,0,height-7);
132 dc.setForeground(bottom);
133 dc.drawRectangle(width-2,3,0,height-7);
137 dc.setForeground(baseColor);
138 dc.drawPoints(basebackground,4);
140 dc.setForeground(bordercolor);
141 dc.drawRectangle(2,0,width-5,0);
142 dc.drawRectangle(2,height-1,width-5,height-1);
143 dc.drawRectangle(0,2,0,height-5);
144 dc.drawRectangle(width-1,2,width-1,height-5);
145 dc.drawPoints(bordercorners,4);
146 dc.setForeground(shade);
147 dc.drawPoints(bordershade,16);
149 dc.setForeground(FXRGB(0xdc,0xd4,0xc9));
150 dc.fillRectangle(2,1,width-4,height-2);
155 tw=labelWidth(label);
156 th=labelHeight(label);
160 ih=icon->getHeight();
167 if (state && (options&(FRAME_RAISED|FRAME_SUNKEN))){
168 ++tx; ++ty; ++ix; ++iy;
174 dc.drawIcon(icon,ix,iy);
178 dc.setForeground(textColor);
179 drawLabel(dc,label,hotoff,tx,ty,tw,th);
182 dc.drawFocusRectangle(border+1,border+1,width-2*border-2,height-2*border-2);
189 dc.drawIconSunken(icon,ix,iy);
193 dc.setForeground(hiliteColor);
194 drawLabel(dc,label,hotoff,tx+1,ty+1,tw,th);
195 dc.setForeground(shadowColor);
196 drawLabel(dc,label,hotoff,tx,ty,tw,th);
212 FXuint opts,FXint x,FXint y,FXint w,FXint h,
213 FXint pl,FXint pr,FXint pt,FXint pb)
214 : FXTextField( p, ncols, tgt, sel, opts, x, y, w, h, pl, pr, pt, pb )
219 static void drawFrame(FXDCWindow& dc,FXint x,FXint y,FXint w,FXint h) {
221 dc.setForeground(FXRGB(123,158,189));
222 dc.fillRectangle(x,y,w,1);
223 dc.fillRectangle(x,y,1,h);
225 dc.fillRectangle(x,y+h-1,w,1);
226 dc.fillRectangle(x+w-1,y,1,h);
235 dc.setForeground(FXRGB(255,158,100));
236 dc.fillRectangle(x,y,w,1);
237 dc.fillRectangle(x,y,1,h);
239 dc.fillRectangle(x,y+h-1,w,1);
240 dc.fillRectangle(x+w-1,y,1,h);
243 dc.fillRectangle(x+1,y+1,w-3,1);
244 dc.fillRectangle(x+1,y+1,1,h-3);
245 dc.fillRectangle(x+1,y+h-2,w-2,1);
246 dc.fillRectangle(x+w-2,y+1,1,h-2);
255 dc.setForeground(FXRGB(123,158,255));
256 dc.fillRectangle(x,y,w,1);
257 dc.fillRectangle(x,y,1,h);
259 dc.fillRectangle(x,y+h-1,w,1);
260 dc.fillRectangle(x+w-1,y,1,h);
263 dc.fillRectangle(x+1,y+1,w-3,1);
264 dc.fillRectangle(x+1,y+1,1,h-3);
265 dc.fillRectangle(x+1,y+h-2,w-2,1);
266 dc.fillRectangle(x+w-2,y+1,1,h-2);
274 FXEvent *ev=(FXEvent*)ptr;
275 FXDCWindow dc(
this,ev);
284 dc.setForeground(isEnabled() ? backColor : baseColor);
287 dc.fillRectangle(border,border,width-(border<<1),height-(border<<1));
290 dc.setClipRectangle(border,border,width-(border<<1),height-(border<<1));
291 drawTextRange(dc,0,contents.length());
294 if (flags&FLAG_CARET){
295 int xx=coord(cursor)-1;
296 dc.setForeground(cursorColor);
297 dc.fillRectangle(xx,padtop+border,1,height-padbottom-padtop-(border<<1));
298 dc.fillRectangle(xx-2,padtop+border,5,1);
299 dc.fillRectangle(xx-2,height-border-padbottom-1,5,1);
322 {
"Redmond XP",FXRGB(238,238,230),FXRGB( 0, 0, 0),FXRGB(255,255,255),FXRGB( 0, 0, 0),FXRGB( 74,121,205),FXRGB(255,255,255),FXRGB(255,255,225),FXRGB( 0, 0, 0),FXRGB( 74,121,205),FXRGB(255,255,255)}
328 app->setBaseColor( ColorThemes[0].base );
329 app->setBorderColor( ColorThemes[0].border );
330 app->setBackColor( ColorThemes[0].back );
331 app->setForeColor( ColorThemes[0].fore );
332 app->setSelforeColor( ColorThemes[0].selfore );
333 app->setSelbackColor( ColorThemes[0].selback );
334 app->setTipforeColor( ColorThemes[0].tipfore );
335 app->setTipbackColor( ColorThemes[0].tipback );
336 app->setSelMenuTextColor( ColorThemes[0].menufore );
337 app->setSelMenuBackColor( ColorThemes[0].menuback );
351 FXint x,FXint y,FXint w,FXint h,
352 FXint pl,FXint pr,FXint pt,FXint pb)
353 : FXComboBox(p,cols, tgt, sel, opts,x,y,w,h, pl,pr,pt,pb)
358 FRAME_RAISED|MENUBUTTON_DOWN|MENUBUTTON_ATTACH_RIGHT,
360 button->setXOffset(border);
361 button->setYOffset(border);
367 FXEvent *ev=(FXEvent*)ptr;
368 FXDCWindow dc(
this,ev);
370 dc.setForeground(backColor);
371 dc.fillRectangle(ev->rect.x,ev->rect.y,ev->rect.w,ev->rect.h);
387 FXint x,FXint y,FXint w,FXint h,FXint pl,FXint pr,FXint pt,FXint pb)
388 : FXLabel( p, text, ic, opts, x, y, w, h, pl, pr, pt, pb )
397 FXEvent *ev=(FXEvent*)ptr;
398 FXDCWindow dc(
this,ev);
399 FXint tw=0,th=0,iw=0,ih=0,tx,ty,ix,iy;
400 dc.setForeground(backColor);
401 dc.fillRectangle(0,0,width,height);
403 tw=labelWidth(label);
404 th=labelHeight(label);
408 ih=icon->getHeight();
414 dc.drawIcon(icon,ix,iy);
416 dc.drawIconSunken(icon,ix,iy);
421 dc.setForeground(textColor);
422 drawLabel(dc,label,hotoff,tx,ty,tw,th);
425 dc.setForeground(hiliteColor);
426 drawLabel(dc,label,hotoff,tx+1,ty+1,tw,th);
427 dc.setForeground(shadowColor);
428 drawLabel(dc,label,hotoff,tx,ty,tw,th);
431 if (options & (FRAME_THICK|FRAME_RAISED|FRAME_SUNKEN)) {
432 if( options & (FRAME_SUNKEN) )
434 else if( options & (FRAME_RAISED) )
453 FXint x,FXint y,FXint w,FXint h,FXint pl,FXint pr,FXint pt,FXint pb)
454 : FXTabItem(p,text,ic,opts,x,y,w,h,pl,pr,pt,pb)
456 shadowColor = FXRGB(123,158,189);
457 borderColor = FXRGB(123,158,189);
458 hiliteColor = FXRGB(123,158,189);
465 FXint pl,FXint pr,FXint pt,FXint pb,FXint hs,FXint vs)
466 : FXVerticalFrame( p, opts, x, y, w, h, pl, pr, pt, pb, hs, vs )
468 setHiliteColor( FXRGB(123,158,189) );
473 FXint pl,FXint pr,FXint pt,FXint pb,FXint hs,FXint vs)
474 : FXHorizontalFrame( p, opts, x, y, w, h, pl, pr, pt, pb, hs, vs )
476 setHiliteColor( FXRGB(123,158,189) );
482 #define MENUBUTTONARROW_WIDTH 13
483 #define MENUBUTTONARROW_HEIGHT 5
493 FXIcon* ic,FXPopup* pup,FXuint opts,
494 FXint x,FXint y,FXint w,FXint h,
495 FXint pl,FXint pr,FXint pt,FXint pb )
496 : FXMenuButton( p, text, ic, pup, opts, x, y, w, h,
505 FXint tw=0,th=0,iw=0,ih=0,tx,ty,ix,iy;
506 FXEvent *ev=(FXEvent*)ptr;
508 FXDCWindow dc(
this,ev);
514 FXColor top = FXRGB(0xde,0xe7,0xff);
515 FXColor bottom = FXRGB(0xbd,0xcf,0xff);
516 FXColor shade = FXRGB(0xbd,0xcb,0xf7);
518 FXColor buttoncolor = FXRGB(0x4a,0x61,0x84);
521 FXColor bordercolor = shade;
523 FXPoint basebackground[4]={
524 FXPoint(0,0),FXPoint(width-1,0),FXPoint(0,height-1),FXPoint(width-1,height-1)
526 FXPoint bordershade[16]={
527 FXPoint(0,1),FXPoint(1,0),FXPoint(1,2),FXPoint(2,1),
528 FXPoint(width-2,0),FXPoint(width-1,1),FXPoint(width-3,1),FXPoint(width-2,2),
529 FXPoint(0,height-2),FXPoint(1,height-1),FXPoint(1,height-3),FXPoint(2,height-2),
530 FXPoint(width-1,height-2),FXPoint(width-2,height-1),FXPoint(width-2,height-3),FXPoint(width-3,height-2)
532 FXPoint bordercorners[4]={
533 FXPoint(1,1),FXPoint(1,height-2),FXPoint(width-2,1),FXPoint(width-2,height-2)
538 if (options&(FRAME_RAISED|FRAME_SUNKEN)){
541 if (options&MENUBUTTON_TOOLBAR){
544 if (isEnabled() && underCursor() && !state){
545 dc.setForeground(backColor);
546 dc.fillRectangle(border,border,width-border*2,height-border*2);
547 if(options&FRAME_THICK) drawDoubleRaisedRectangle(dc,0,0,width,height);
548 else drawRaisedRectangle(dc,0,0,width,height);
552 else if (isEnabled() && state){
553 dc.setForeground(hiliteColor);
554 dc.fillRectangle(border,border,width-border*2,height-border*2);
555 if(options&FRAME_THICK) drawDoubleSunkenRectangle(dc,0,0,width,height);
556 else drawSunkenRectangle(dc,0,0,width,height);
561 dc.setForeground(backColor);
562 dc.fillRectangle(0,0,width,height);
569 if (!isEnabled() || !state){
577 dc.setForeground(baseColor);
578 dc.drawPoints(basebackground,4);
580 dc.setForeground(bordercolor);
581 dc.drawRectangle(2,0,width-5,0);
582 dc.drawRectangle(2,height-1,width-5,height-1);
583 dc.drawRectangle(0,2,0,height-5);
584 dc.drawRectangle(width-1,2,0,height-5);
585 dc.drawPoints(bordercorners,4);
586 dc.setForeground(shade);
587 dc.drawPoints(bordershade,16);
590 dc.setForeground(top);
591 dc.drawRectangle(1,3,0,height-7);
592 dc.setForeground(bottom);
593 dc.drawRectangle(width-2,3,0,height-7);
598 dc.setForeground(baseColor);
599 dc.drawPoints(basebackground,4);
601 dc.setForeground(bordercolor);
602 dc.drawRectangle(2,0,width-5,0);
603 dc.drawRectangle(2,height-1,width-5,height-1);
604 dc.drawRectangle(0,2,0,height-5);
605 dc.drawRectangle(width-1,2,0,height-5);
606 dc.drawPoints(bordercorners,4);
607 dc.setForeground(shade);
608 dc.drawPoints(bordershade,16);
610 dc.setForeground(FXRGB(0xdc,0xd4,0xc9));
611 dc.fillRectangle(2,1,width-4,height-2);
618 if(isEnabled() && state){
619 dc.setForeground(hiliteColor);
620 dc.fillRectangle(0,0,width,height);
623 dc.setForeground(backColor);
624 dc.fillRectangle(0,0,width,height);
630 tw=labelWidth(label);
631 th=labelHeight(label);
637 ih=icon->getHeight();
641 else if(!(options&MENUBUTTON_NOARROWS)){
642 if(options&MENUBUTTON_LEFT){
658 ++tx; ++ty; ++ix; ++iy;
664 dc.drawIcon(icon,ix,iy);
666 dc.drawIconSunken(icon,ix,iy);
670 else if (!(options&MENUBUTTON_NOARROWS)){
673 if ((options&MENUBUTTON_RIGHT)==MENUBUTTON_RIGHT){
675 dc.setForeground(buttoncolor);
677 dc.setForeground(shadowColor);
683 points[2].y=(FXshort)(iy+(MENUBUTTONARROW_WIDTH>>1));
684 dc.fillPolygon(points,3);
688 else if (options&MENUBUTTON_LEFT){
690 dc.setForeground(buttoncolor);
692 dc.setForeground(shadowColor);
698 points[2].y=(FXshort)(iy+(MENUBUTTONARROW_WIDTH>>1));
699 dc.fillPolygon(points,3);
703 else if (options&MENUBUTTON_UP){
705 dc.setForeground(buttoncolor);
707 dc.setForeground(shadowColor);
714 dc.fillPolygon(points,3);
720 dc.setForeground(buttoncolor);
722 dc.setForeground(shadowColor);
727 points[1].x=(FXshort)(ix+(MENUBUTTONARROW_WIDTH>>1));
729 points[3].x=ix+MENUBUTTONARROW_WIDTH-3;
731 points[4].x=(FXshort)(ix+(MENUBUTTONARROW_WIDTH>>1));
732 points[4].y=iy+MENUBUTTONARROW_HEIGHT-3;
735 dc.fillConcavePolygon(points,6);
743 dc.setForeground(textColor);
744 drawLabel(dc,label,hotoff,tx,ty,tw,th);
747 dc.setForeground(hiliteColor);
748 drawLabel(dc,label,hotoff,tx+1,ty+1,tw,th);
749 dc.setForeground(shadowColor);
750 drawLabel(dc,label,hotoff,tx,ty,tw,th);
757 dc.drawFocusRectangle(border+1,border+1,width-2*border-2,height-2*border-2);
767 FXint tw=0,iw=0,s=0,w,pw;
770 tw=labelWidth(label); s=4;
772 if (!(options&MENUBUTTON_NOARROWS)){
773 if (options&MENUBUTTON_LEFT)
780 if (!(options&(ICON_AFTER_TEXT|ICON_BEFORE_TEXT)))
784 w=padleft+padright+(border<<1)+w;
785 if (!(options&MENUBUTTON_LEFT) &&
786 (options&MENUBUTTON_ATTACH_RIGHT) &&
787 (options&MENUBUTTON_ATTACH_CENTER)) {
789 pw=pane->getDefaultWidth();
802 FXMAPFUNC(SEL_PAINT, 0, ThemeHeaderItem::onPaint)
810 :FXHeaderItem(text, ic, s, ptr)
817 register FXint tx,ty,tw,th,ix,iy,iw,ih,s,ml,mr,mt,mb,beg,end,t,xx,yy,bb,aa,ax,ay;
818 register FXFont *font=header->getFont();
819 FXColor top = FXRGB(0xfe,0xfd,0xfd);
820 FXColor bottom = FXRGB(0xdd,0xd7,0xce);
821 FXColor shade = FXRGB(0xdc,0xd9,0xd4);
824 bb=header->getBorderWidth();
825 ml=header->getPadLeft()+bb;
826 mr=header->getPadRight()+bb;
827 mt=header->getPadTop()+bb;
828 mb=header->getPadBottom()+bb;
830 dc.setForeground(shade);
839 dc.setClipRectangle(x,y,w,h);
841 dc.setForeground(header->getTextColor());
846 while(end<label.length() && label[end]!=
'\n') end++;
847 if((t=font->getTextWidth(&label[beg],end-beg))>tw) tw=t;
848 th+=font->getFontHeight();
851 while(end<label.length());
856 ih=icon->getHeight();
864 if (state&(ARROW_UP|ARROW_DOWN)){
865 aa=(font->getFontHeight()-5)|1;
869 dc.setForeground(header->getHiliteColor());
870 dc.drawLine(ax+aa/2,ay,ax+aa-1,ay+aa);
871 dc.drawLine(ax,ay+aa,ax+aa,ay+aa);
872 dc.setForeground(header->getShadowColor());
873 dc.drawLine(ax+aa/2,ay,ax,ay+aa);
876 dc.setForeground(header->getHiliteColor());
877 dc.drawLine(ax+aa/2,ay+aa,ax+aa-1,ay);
878 dc.setForeground(header->getShadowColor());
879 dc.drawLine(ax+aa/2,ay+aa,ax,ay);
880 dc.drawLine(ax,ay,ax+aa,ay);
883 dc.setClipRectangle(x,y,w,h);
891 else if (state&AFTER){
898 else if(state&RIGHT){
903 else if (state&AFTER){
908 ix=x+w-iw; tx=x+w-tw;
916 else if (state&AFTER){
932 else if (state&BELOW){
941 else if(state&BOTTOM){
946 else if (state&BELOW){
960 else if (state&BELOW){
980 dc.drawIcon(icon,ix,iy);
984 dc.setForeground(header->getTextColor());
987 yy=ty+font->getFontAscent();
991 while(end<label.length() && label[end]!=
'\n')
996 xx=tx+tw-font->getTextWidth(&label[beg],end-beg);
998 xx=tx+(tw-font->getTextWidth(&label[beg],end-beg))/2;
999 dc.drawText(xx,yy,&label[beg],end-beg);
1000 yy+=font->getFontHeight();
1003 while(end<label.length());
1006 dc.clearClipRectangle();