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);
38 if((t=FXABS(dg))>n) n=t;
39 if((t=FXABS(db))>n) n=t;
42 if(n>MAXSTEPS) n=MAXSTEPS;
57 dc.setForeground(FXRGB(rr>>16,gg>>16,bb>>16));
58 dc.fillRectangle(x,y+yl,w,yh-yl);
78 FXObject* tgt, FXSelector sel, FXuint opts,
79 FXint x, FXint y, FXint w, FXint h,
80 FXint pl, FXint pr, FXint pt, FXint pb)
81 : FXButton( p, text, ic, tgt, sel, opts, x, y, w, h, pl, pr, pt, pb )
86 FXint tw=0,th=0,iw=0,ih=0,tx,ty,ix,iy;
87 FXEvent*ev=(FXEvent*)ptr;
88 FXDCWindow dc(
this,ev);
91 FXColor top = FXRGB(0xfe,0xfd,0xfd);
92 FXColor bottom = FXRGB(0xdd,0xd7,0xce);
93 FXColor shade = FXRGB(0xdc,0xd9,0xd4);
97 FXColor bordercolor = FXRGB(123,158,189);
105 FXPoint basebackground[4]= {FXPoint(0,0),FXPoint(width-1,0),FXPoint(0,height-1),FXPoint(width-1,height-1)};
107 FXPoint bordershade[16]= {
108 FXPoint(0,1),FXPoint(1,0),FXPoint(1,2),FXPoint(2,1),
109 FXPoint(width-2,0),FXPoint(width-1,1),FXPoint(width-3,1),FXPoint(width-2,2),
110 FXPoint(0,height-2),FXPoint(1,height-1),FXPoint(1,height-3),FXPoint(2,height-2),
111 FXPoint(width-1,height-2),FXPoint(width-2,height-1),FXPoint(width-2,height-3),FXPoint(width-3,height-2)
113 FXPoint bordercorners[4]= {
114 FXPoint(1,1),FXPoint(1,height-2),FXPoint(width-2,1),FXPoint(width-2,height-2)
118 if (options&BUTTON_TOOLBAR && !underCursor()) {
119 dc.setForeground(baseColor);
120 dc.fillRectangle(0,0,width,height);
122 else if (state==STATE_UP && ((options&BUTTON_TOOLBAR)==0 || (options&BUTTON_TOOLBAR && underCursor()))) {
124 dc.setForeground(baseColor);
125 dc.drawPoints(basebackground,4);
127 dc.setForeground(bordercolor);
128 dc.drawRectangle(2,0,width-5,0);
129 dc.drawRectangle(2,height-1,width-5,height-1);
130 dc.drawRectangle(0,2,0,height-5);
131 dc.drawRectangle(width-1,2,width-1,height-5);
132 dc.drawPoints(bordercorners,4);
133 dc.setForeground(shade);
134 dc.drawPoints(bordershade,16);
137 dc.setForeground(top);
138 dc.drawRectangle(1,3,0,height-7);
139 dc.setForeground(bottom);
140 dc.drawRectangle(width-2,3,0,height-7);
144 dc.setForeground(baseColor);
145 dc.drawPoints(basebackground,4);
147 dc.setForeground(bordercolor);
148 dc.drawRectangle(2,0,width-5,0);
149 dc.drawRectangle(2,height-1,width-5,height-1);
150 dc.drawRectangle(0,2,0,height-5);
151 dc.drawRectangle(width-1,2,width-1,height-5);
152 dc.drawPoints(bordercorners,4);
153 dc.setForeground(shade);
154 dc.drawPoints(bordershade,16);
156 dc.setForeground(FXRGB(0xdc,0xd4,0xc9));
157 dc.fillRectangle(2,1,width-4,height-2);
162 tw=labelWidth(label);
163 th=labelHeight(label);
167 ih=icon->getHeight();
174 if (state && (options&(FRAME_RAISED|FRAME_SUNKEN))) {
184 dc.drawIcon(icon,ix,iy);
188 dc.setForeground(textColor);
189 drawLabel(dc,label,hotoff,tx,ty,tw,th);
192 dc.drawFocusRectangle(border+1,border+1,width-2*border-2,height-2*border-2);
199 dc.drawIconSunken(icon,ix,iy);
203 dc.setForeground(hiliteColor);
204 drawLabel(dc,label,hotoff,tx+1,ty+1,tw,th);
205 dc.setForeground(shadowColor);
206 drawLabel(dc,label,hotoff,tx,ty,tw,th);
222 FXuint opts,FXint x,FXint y,FXint w,FXint h,
223 FXint pl,FXint pr,FXint pt,FXint pb)
224 : FXTextField( p, ncols, tgt, sel, opts, x, y, w, h, pl, pr, pt, pb ) {
228 static void drawFrame(FXDCWindow& dc,FXint x,FXint y,FXint w,FXint h) {
230 dc.setForeground(FXRGB(123,158,189));
231 dc.fillRectangle(x,y,w,1);
232 dc.fillRectangle(x,y,1,h);
234 dc.fillRectangle(x,y+h-1,w,1);
235 dc.fillRectangle(x+w-1,y,1,h);
244 dc.setForeground(FXRGB(255,158,100));
245 dc.fillRectangle(x,y,w,1);
246 dc.fillRectangle(x,y,1,h);
248 dc.fillRectangle(x,y+h-1,w,1);
249 dc.fillRectangle(x+w-1,y,1,h);
252 dc.fillRectangle(x+1,y+1,w-3,1);
253 dc.fillRectangle(x+1,y+1,1,h-3);
254 dc.fillRectangle(x+1,y+h-2,w-2,1);
255 dc.fillRectangle(x+w-2,y+1,1,h-2);
264 dc.setForeground(FXRGB(123,158,255));
265 dc.fillRectangle(x,y,w,1);
266 dc.fillRectangle(x,y,1,h);
268 dc.fillRectangle(x,y+h-1,w,1);
269 dc.fillRectangle(x+w-1,y,1,h);
272 dc.fillRectangle(x+1,y+1,w-3,1);
273 dc.fillRectangle(x+1,y+1,1,h-3);
274 dc.fillRectangle(x+1,y+h-2,w-2,1);
275 dc.fillRectangle(x+w-2,y+1,1,h-2);
283 FXEvent *ev=(FXEvent*)ptr;
284 FXDCWindow dc(
this,ev);
293 dc.setForeground(isEnabled() ? backColor : baseColor);
296 dc.fillRectangle(border,border,width-(border<<1),height-(border<<1));
299 dc.setClipRectangle(border,border,width-(border<<1),height-(border<<1));
300 drawTextRange(dc,0,contents.length());
303 if (flags&FLAG_CARET) {
304 int xx=coord(cursor)-1;
305 dc.setForeground(cursorColor);
306 dc.fillRectangle(xx,padtop+border,1,height-padbottom-padtop-(border<<1));
307 dc.fillRectangle(xx-2,padtop+border,5,1);
308 dc.fillRectangle(xx-2,height-border-padbottom-1,5,1);
331 {
"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)}
345 app->setSelMenuTextColor(
ColorThemes[0].menufore );
346 app->setSelMenuBackColor(
ColorThemes[0].menuback );
360 FXint x,FXint y,FXint w,FXint h,
361 FXint pl,FXint pr,FXint pt,FXint pb)
362 : FXComboBox(p,cols, tgt, sel, opts,x,y,w,h, pl,pr,pt,pb) {
366 FRAME_RAISED|MENUBUTTON_DOWN|MENUBUTTON_ATTACH_RIGHT,
368 button->setXOffset(border);
369 button->setYOffset(border);
375 FXEvent *ev=(FXEvent*)ptr;
376 FXDCWindow dc(
this,ev);
378 dc.setForeground(backColor);
379 dc.fillRectangle(ev->rect.x,ev->rect.y,ev->rect.w,ev->rect.h);
395 FXint x,FXint y,FXint w,FXint h,FXint pl,FXint pr,FXint pt,FXint pb)
396 : FXLabel( p, text, ic, opts, x, y, w, h, pl, pr, pt, pb ) {
404 FXEvent *ev=(FXEvent*)ptr;
405 FXDCWindow dc(
this,ev);
406 FXint tw=0,th=0,iw=0,ih=0,tx,ty,ix,iy;
407 dc.setForeground(backColor);
408 dc.fillRectangle(0,0,width,height);
409 if (!label.empty()) {
410 tw=labelWidth(label);
411 th=labelHeight(label);
415 ih=icon->getHeight();
421 dc.drawIcon(icon,ix,iy);
423 dc.drawIconSunken(icon,ix,iy);
425 if (!label.empty()) {
428 dc.setForeground(textColor);
429 drawLabel(dc,label,hotoff,tx,ty,tw,th);
432 dc.setForeground(hiliteColor);
433 drawLabel(dc,label,hotoff,tx+1,ty+1,tw,th);
434 dc.setForeground(shadowColor);
435 drawLabel(dc,label,hotoff,tx,ty,tw,th);
438 if (options & (FRAME_THICK|FRAME_RAISED|FRAME_SUNKEN)) {
439 if( options & (FRAME_SUNKEN) )
441 else if( options & (FRAME_RAISED) )
460 FXint x,FXint y,FXint w,FXint h,FXint pl,FXint pr,FXint pt,FXint pb)
461 : FXTabItem(p,text,ic,opts,x,y,w,h,pl,pr,pt,pb) {
462 shadowColor = FXRGB(123,158,189);
463 borderColor = FXRGB(123,158,189);
464 hiliteColor = FXRGB(123,158,189);
471 FXint pl,FXint pr,FXint pt,FXint pb,FXint hs,FXint vs)
472 : FXVerticalFrame( p, opts, x, y, w, h, pl, pr, pt, pb, hs, vs ) {
473 setHiliteColor( FXRGB(123,158,189) );
478 FXint pl,FXint pr,FXint pt,FXint pb,FXint hs,FXint vs)
479 : FXHorizontalFrame( p, opts, x, y, w, h, pl, pr, pt, pb, hs, vs ) {
480 setHiliteColor( FXRGB(123,158,189) );
486 #define MENUBUTTONARROW_WIDTH 13 487 #define MENUBUTTONARROW_HEIGHT 5 497 FXIcon* ic,FXPopup* pup,FXuint opts,
498 FXint x,FXint y,FXint w,FXint h,
499 FXint pl,FXint pr,FXint pt,FXint pb )
500 : FXMenuButton( p, text, ic, pup, opts, x, y, w, h,
508 FXint tw=0,th=0,iw=0,ih=0,tx,ty,ix,iy;
509 FXEvent *ev=(FXEvent*)ptr;
511 FXDCWindow dc(
this,ev);
517 FXColor top = FXRGB(0xde,0xe7,0xff);
518 FXColor bottom = FXRGB(0xbd,0xcf,0xff);
519 FXColor shade = FXRGB(0xbd,0xcb,0xf7);
521 FXColor buttoncolor = FXRGB(0x4a,0x61,0x84);
524 FXColor bordercolor = shade;
526 FXPoint basebackground[4]= {
527 FXPoint(0,0),FXPoint(width-1,0),FXPoint(0,height-1),FXPoint(width-1,height-1)
529 FXPoint bordershade[16]= {
530 FXPoint(0,1),FXPoint(1,0),FXPoint(1,2),FXPoint(2,1),
531 FXPoint(width-2,0),FXPoint(width-1,1),FXPoint(width-3,1),FXPoint(width-2,2),
532 FXPoint(0,height-2),FXPoint(1,height-1),FXPoint(1,height-3),FXPoint(2,height-2),
533 FXPoint(width-1,height-2),FXPoint(width-2,height-1),FXPoint(width-2,height-3),FXPoint(width-3,height-2)
535 FXPoint bordercorners[4]= {
536 FXPoint(1,1),FXPoint(1,height-2),FXPoint(width-2,1),FXPoint(width-2,height-2)
541 if (options&(FRAME_RAISED|FRAME_SUNKEN)) {
544 if (options&MENUBUTTON_TOOLBAR) {
547 if (isEnabled() && underCursor() && !state) {
548 dc.setForeground(backColor);
549 dc.fillRectangle(border,border,width-border*2,height-border*2);
550 if(options&FRAME_THICK) drawDoubleRaisedRectangle(dc,0,0,width,height);
551 else drawRaisedRectangle(dc,0,0,width,height);
555 else if (isEnabled() && state) {
556 dc.setForeground(hiliteColor);
557 dc.fillRectangle(border,border,width-border*2,height-border*2);
558 if(options&FRAME_THICK) drawDoubleSunkenRectangle(dc,0,0,width,height);
559 else drawSunkenRectangle(dc,0,0,width,height);
564 dc.setForeground(backColor);
565 dc.fillRectangle(0,0,width,height);
572 if (!isEnabled() || !state) {
580 dc.setForeground(baseColor);
581 dc.drawPoints(basebackground,4);
583 dc.setForeground(bordercolor);
584 dc.drawRectangle(2,0,width-5,0);
585 dc.drawRectangle(2,height-1,width-5,height-1);
586 dc.drawRectangle(0,2,0,height-5);
587 dc.drawRectangle(width-1,2,0,height-5);
588 dc.drawPoints(bordercorners,4);
589 dc.setForeground(shade);
590 dc.drawPoints(bordershade,16);
593 dc.setForeground(top);
594 dc.drawRectangle(1,3,0,height-7);
595 dc.setForeground(bottom);
596 dc.drawRectangle(width-2,3,0,height-7);
601 dc.setForeground(baseColor);
602 dc.drawPoints(basebackground,4);
604 dc.setForeground(bordercolor);
605 dc.drawRectangle(2,0,width-5,0);
606 dc.drawRectangle(2,height-1,width-5,height-1);
607 dc.drawRectangle(0,2,0,height-5);
608 dc.drawRectangle(width-1,2,0,height-5);
609 dc.drawPoints(bordercorners,4);
610 dc.setForeground(shade);
611 dc.drawPoints(bordershade,16);
613 dc.setForeground(FXRGB(0xdc,0xd4,0xc9));
614 dc.fillRectangle(2,1,width-4,height-2);
621 if(isEnabled() && state) {
622 dc.setForeground(hiliteColor);
623 dc.fillRectangle(0,0,width,height);
626 dc.setForeground(backColor);
627 dc.fillRectangle(0,0,width,height);
632 if (!label.empty()) {
633 tw=labelWidth(label);
634 th=labelHeight(label);
640 ih=icon->getHeight();
644 else if(!(options&MENUBUTTON_NOARROWS)) {
645 if(options&MENUBUTTON_LEFT) {
670 dc.drawIcon(icon,ix,iy);
672 dc.drawIconSunken(icon,ix,iy);
676 else if (!(options&MENUBUTTON_NOARROWS)) {
679 if ((options&MENUBUTTON_RIGHT)==MENUBUTTON_RIGHT) {
681 dc.setForeground(buttoncolor);
683 dc.setForeground(shadowColor);
690 dc.fillPolygon(points,3);
694 else if (options&MENUBUTTON_LEFT) {
696 dc.setForeground(buttoncolor);
698 dc.setForeground(shadowColor);
705 dc.fillPolygon(points,3);
709 else if (options&MENUBUTTON_UP) {
711 dc.setForeground(buttoncolor);
713 dc.setForeground(shadowColor);
720 dc.fillPolygon(points,3);
726 dc.setForeground(buttoncolor);
728 dc.setForeground(shadowColor);
741 dc.fillConcavePolygon(points,6);
746 if (!label.empty()) {
749 dc.setForeground(textColor);
750 drawLabel(dc,label,hotoff,tx,ty,tw,th);
753 dc.setForeground(hiliteColor);
754 drawLabel(dc,label,hotoff,tx+1,ty+1,tw,th);
755 dc.setForeground(shadowColor);
756 drawLabel(dc,label,hotoff,tx,ty,tw,th);
763 dc.drawFocusRectangle(border+1,border+1,width-2*border-2,height-2*border-2);
773 FXint tw=0,iw=0,s=0,w,pw;
775 if (!label.empty()) {
776 tw=labelWidth(label);
779 if (!(options&MENUBUTTON_NOARROWS)) {
780 if (options&MENUBUTTON_LEFT)
787 if (!(options&(ICON_AFTER_TEXT|ICON_BEFORE_TEXT)))
791 w=padleft+padright+(border<<1)+w;
792 if (!(options&MENUBUTTON_LEFT) &&
793 (options&MENUBUTTON_ATTACH_RIGHT) &&
794 (options&MENUBUTTON_ATTACH_CENTER)) {
796 pw=pane->getDefaultWidth();
809 FXMAPFUNC(SEL_PAINT, 0, ThemeHeaderItem::onPaint)
817 :FXHeaderItem(text, ic, s, ptr) {
823 register FXint tx,ty,tw,th,ix,iy,iw,ih,s,ml,mr,mt,mb,beg,end,t,xx,yy,bb,aa,ax,ay;
824 register FXFont *font=header->getFont();
825 FXColor top = FXRGB(0xfe,0xfd,0xfd);
826 FXColor bottom = FXRGB(0xdd,0xd7,0xce);
827 FXColor shade = FXRGB(0xdc,0xd9,0xd4);
830 bb=header->getBorderWidth();
831 ml=header->getPadLeft()+bb;
832 mr=header->getPadRight()+bb;
833 mt=header->getPadTop()+bb;
834 mb=header->getPadBottom()+bb;
836 dc.setForeground(shade);
847 dc.setClipRectangle(x,y,w,h);
849 dc.setForeground(header->getTextColor());
854 while(end<label.length() && label[end]!=
'\n') end++;
855 if((t=font->getTextWidth(&label[beg],end-beg))>tw) tw=t;
856 th+=font->getFontHeight();
859 while(end<label.length());
864 ih=icon->getHeight();
872 if (state&(ARROW_UP|ARROW_DOWN)) {
873 aa=(font->getFontHeight()-5)|1;
877 dc.setForeground(header->getHiliteColor());
878 dc.drawLine(ax+aa/2,ay,ax+aa-1,ay+aa);
879 dc.drawLine(ax,ay+aa,ax+aa,ay+aa);
880 dc.setForeground(header->getShadowColor());
881 dc.drawLine(ax+aa/2,ay,ax,ay+aa);
884 dc.setForeground(header->getHiliteColor());
885 dc.drawLine(ax+aa/2,ay+aa,ax+aa-1,ay);
886 dc.setForeground(header->getShadowColor());
887 dc.drawLine(ax+aa/2,ay+aa,ax,ay);
888 dc.drawLine(ax,ay,ax+aa,ay);
891 dc.setClipRectangle(x,y,w,h);
900 else if (state&AFTER) {
909 else if(state&RIGHT) {
914 else if (state&AFTER) {
928 else if (state&AFTER) {
944 else if (state&BELOW) {
953 else if(state&BOTTOM) {
958 else if (state&BELOW) {
972 else if (state&BELOW) {
992 dc.drawIcon(icon,ix,iy);
996 dc.setForeground(header->getTextColor());
999 yy=ty+font->getFontAscent();
1003 while(end<label.length() && label[end]!=
'\n')
1007 else if(state&RIGHT)
1008 xx=tx+tw-font->getTextWidth(&label[beg],end-beg);
1010 xx=tx+(tw-font->getTextWidth(&label[beg],end-beg))/2;
1011 dc.drawText(xx,yy,&label[beg],end-beg);
1012 yy+=font->getFontHeight();
1015 while(end<label.length());
1018 dc.clearClipRectangle();
#define MENUBUTTONARROW_HEIGHT
FXDEFMAP(ThemeButton) ThemeButtonMap[]
long onPaint(FXObject *, FXSelector, void *ptr)
#define MENUBUTTONARROW_WIDTH
static void drawSunkenFrame(FXDCWindow &dc, FXint x, FXint y, FXint w, FXint h)
const ColorTheme ColorThemes[]
void init_theme(FXApp *app)
FXIMPLEMENT(ThemeButton, FXButton, ThemeButtonMap, ARRAYNUMBER(ThemeButtonMap))
long onPaint(FXObject *, FXSelector, void *ptr)
static void drawHighlightFrame(FXDCWindow &dc, FXint x, FXint y, FXint w, FXint h)
void drawFrame(FXDCWindow &dc, FXint x, FXint y, FXint w, FXint h)
long onPaint(FXObject *, FXSelector, void *ptr)
static void drawFrame(FXDCWindow &dc, FXint x, FXint y, FXint w, FXint h)
static void drawRectangle(FXDC &dc, FXColor lower, FXColor upper, FXint x, FXint y, FXint w, FXint h)