mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-04-23 03:11:18 +00:00
Fix memory leak and commit latest scroller theming workings
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@27521 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
62492a9158
commit
23f7bcc0e6
3 changed files with 29 additions and 29 deletions
|
@ -1,3 +1,9 @@
|
|||
2009-01-05 Richard Frith-Macdonald <rfm@gnu.org>
|
||||
|
||||
* Source/NSScroller.m: Fixup/reorganisation of setting names for
|
||||
components parts of scroller for theming.
|
||||
* Source/GSThemeDrawing.m: Fix memory leak spotted by Fred.
|
||||
|
||||
2009-01-05 Richard Frith-Macdonald <rfm@gnu.org>
|
||||
|
||||
* Headers/Additions/GNUstepGUI/GSTheme.h:
|
||||
|
|
|
@ -327,13 +327,13 @@
|
|||
|
||||
- (NSCell*) cellForScrollerKnob: (BOOL)horizontal
|
||||
{
|
||||
NSButtonCell *knobCell;
|
||||
NSButtonCell *cell;
|
||||
|
||||
knobCell = [NSButtonCell new];
|
||||
[knobCell setButtonType: NSMomentaryChangeButton];
|
||||
[knobCell setImage: [NSImage imageNamed: @"common_Dimple"]];
|
||||
[knobCell setImagePosition: NSImageOnly];
|
||||
return knobCell;
|
||||
cell = [NSButtonCell new];
|
||||
[cell setButtonType: NSMomentaryChangeButton];
|
||||
[cell setImage: [NSImage imageNamed: @"common_Dimple"]];
|
||||
[cell setImagePosition: NSImageOnly];
|
||||
return AUTORELEASE(cell);
|
||||
}
|
||||
|
||||
- (NSCell*) cellForScrollerKnobSlot: (BOOL)horizontal
|
||||
|
|
|
@ -71,11 +71,28 @@ static const float buttonsOffset = 2; // buttonsWidth = sw - buttonsOffset
|
|||
|
||||
+ (void) _themeWillActivate: (NSNotification*)n
|
||||
{
|
||||
GSTheme *theme = [GSTheme theme];
|
||||
|
||||
/* Clear cached information from the old theme ... will get info from
|
||||
* the new theme as required.
|
||||
*/
|
||||
scrollerWidth = 0.0;
|
||||
[theme setName: nil forElement: upCell];
|
||||
DESTROY(upCell);
|
||||
[theme setName: nil forElement: downCell];
|
||||
DESTROY(downCell);
|
||||
[theme setName: nil forElement: leftCell];
|
||||
DESTROY(leftCell);
|
||||
[theme setName: nil forElement: rightCell];
|
||||
DESTROY(rightCell);
|
||||
[theme setName: nil forElement: verticalKnobCell];
|
||||
DESTROY(horizontalKnobCell);
|
||||
[theme setName: nil forElement: horizontalKnobCell];
|
||||
DESTROY(verticalKnobCell);
|
||||
[theme setName: nil forElement: verticalKnobSlotCell];
|
||||
DESTROY(horizontalKnobSlotCell);
|
||||
[theme setName: nil forElement: horizontalKnobSlotCell];
|
||||
DESTROY(verticalKnobSlotCell);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -336,21 +353,6 @@ static const float buttonsOffset = 2; // buttonsWidth = sw - buttonsOffset
|
|||
return [self initWithFrame: NSZeroRect];
|
||||
}
|
||||
|
||||
- (void) dealloc
|
||||
{
|
||||
GSTheme *theme = [GSTheme theme];
|
||||
|
||||
[theme setName: nil forElement: upCell];
|
||||
[theme setName: nil forElement: downCell];
|
||||
[theme setName: nil forElement: leftCell];
|
||||
[theme setName: nil forElement: rightCell];
|
||||
[theme setName: nil forElement: verticalKnobCell];
|
||||
[theme setName: nil forElement: horizontalKnobCell];
|
||||
[theme setName: nil forElement: verticalKnobSlotCell];
|
||||
[theme setName: nil forElement: horizontalKnobSlotCell];
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
/**
|
||||
* Cache images for scroll arrows and knob. If you override +scrollerWidth
|
||||
* you may need to override this as well (to provide images for the new
|
||||
|
@ -366,39 +368,31 @@ static const float buttonsOffset = 2; // buttonsWidth = sw - buttonsOffset
|
|||
|
||||
theme = [GSTheme theme];
|
||||
|
||||
[theme setName: nil forElement: upCell];
|
||||
ASSIGN(upCell ,[theme cellForScrollerArrow:
|
||||
NSScrollerDecrementArrow horizontal:NO]);
|
||||
[theme setName: GSScrollerUpArrow forElement: upCell];
|
||||
|
||||
[theme setName: nil forElement: downCell];
|
||||
ASSIGN(downCell, [theme cellForScrollerArrow:
|
||||
NSScrollerIncrementArrow horizontal:NO]);
|
||||
[theme setName: GSScrollerDownArrow forElement: downCell];
|
||||
|
||||
[theme setName: nil forElement: leftCell];
|
||||
ASSIGN(leftCell, [theme cellForScrollerArrow:
|
||||
NSScrollerDecrementArrow horizontal:YES]);
|
||||
[theme setName: GSScrollerLeftArrow forElement: leftCell];
|
||||
|
||||
[theme setName: nil forElement: rightCell];
|
||||
ASSIGN(rightCell, [theme cellForScrollerArrow:
|
||||
NSScrollerIncrementArrow horizontal:YES]);
|
||||
[theme setName: GSScrollerRightArrow forElement: rightCell];
|
||||
|
||||
[theme setName: nil forElement: verticalKnobCell];
|
||||
ASSIGN(verticalKnobCell, [theme cellForScrollerKnob: NO]);
|
||||
[theme setName: GSScrollerVerticalKnob forElement: verticalKnobCell];
|
||||
|
||||
[theme setName: nil forElement: horizontalKnobCell];
|
||||
ASSIGN(horizontalKnobCell, [theme cellForScrollerKnob: YES]);
|
||||
[theme setName: GSScrollerHorizontalKnob forElement: horizontalKnobCell];
|
||||
|
||||
[theme setName: nil forElement: verticalKnobSlotCell];
|
||||
ASSIGN(verticalKnobSlotCell, [theme cellForScrollerKnobSlot: NO]);
|
||||
[theme setName: GSScrollerVerticalSlot forElement: verticalKnobSlotCell];
|
||||
|
||||
[theme setName: nil forElement: horizontalKnobSlotCell];
|
||||
ASSIGN(horizontalKnobSlotCell, [theme cellForScrollerKnobSlot: YES]);
|
||||
[theme setName: GSScrollerHorizontalSlot forElement: horizontalKnobSlotCell];
|
||||
|
||||
|
|
Loading…
Reference in a new issue