23 |
|
|
24 |
#include <GL/gl.h> |
#include <GL/gl.h> |
25 |
|
|
26 |
|
#include <Foundation/NSGeometry.h> |
27 |
|
|
28 |
#include "Interface/UiScrollBar.h" |
#include "Interface/UiScrollBar.h" |
29 |
|
#include "DrawFuncs.h" |
30 |
|
|
31 |
#define BORDERSIZE 5 |
#define BORDERSIZE 5.0f |
32 |
|
|
33 |
@interface UiScrollBar (Theme) |
@interface UiScrollBar (Theme) |
34 |
|
|
41 |
|
|
42 |
- (void) _displayRect: (NSRect)rect |
- (void) _displayRect: (NSRect)rect |
43 |
{ |
{ |
44 |
|
draw_button (0.0f, NSWidth ([self frame]), |
45 |
|
0.0f, NSHeight ([self frame]), |
46 |
|
BORDERSIZE / 2.0f); |
47 |
|
|
48 |
/* Tell the container to display his widgets */ |
/* Tell the container to display his widgets */ |
49 |
glPushMatrix (); |
glPushMatrix (); |
50 |
glTranslatef (BORDERSIZE, BORDERSIZE, 0.0f); |
glTranslatef (BORDERSIZE, BORDERSIZE, 0.0f); |
51 |
[super _displayRect: rect]; |
[super _displayRect: rect]; |
52 |
glPopMatrix (); |
glPopMatrix (); |
|
|
|
|
/* Sets the color to white */ |
|
|
glColor3f (1.0f, 1.0f, 1.0f); |
|
|
|
|
|
/* enables stripple lines */ |
|
|
glEnable (GL_LINE_STIPPLE); |
|
|
|
|
|
/* sets the line to be stippled to dash */ |
|
|
glLineStipple (1, 0xAAAA); |
|
|
|
|
|
/* draw the border */ |
|
|
NSRect rectangle = [self frame]; |
|
|
|
|
|
glBegin (GL_LINE_LOOP); |
|
|
glVertex2f (0.0f, 0.0f); |
|
|
glVertex2f (0.0f, NSHeight (rectangle)); |
|
|
glVertex2f (NSWidth (rectangle), NSHeight (rectangle)); |
|
|
glVertex2f (NSWidth (rectangle), 0.0f); |
|
|
glEnd (); |
|
|
|
|
|
glDisable (GL_LINE_STIPPLE); |
|
53 |
} |
} |
54 |
|
|
55 |
- (void) sizeToFit |
- (void) sizeToFit |
57 |
[super sizeToFit]; |
[super sizeToFit]; |
58 |
|
|
59 |
/* add the size of the border to the size of the button */ |
/* add the size of the border to the size of the button */ |
60 |
[self setSize: NSMakeSize (NSWidth ([self frame]) + 2 * BORDERSIZE, |
[self setSize: NSMakeSize (NSWidth ([self frame]) + 2.0f * BORDERSIZE, |
61 |
NSHeight ([self frame]) + 2 * BORDERSIZE)]; |
NSHeight ([self frame]) + 2.0f * BORDERSIZE)]; |
62 |
} |
} |
63 |
|
|
64 |
@end |
@end |