mirror of
https://github.com/gnustep/apps-gorm.git
synced 2025-04-22 22:20:44 +00:00
Changes to support sort descriptors.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/apps/gorm/trunk@34069 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
0f8b9f3d20
commit
4609f85bdf
6 changed files with 51 additions and 14 deletions
|
@ -1,3 +1,12 @@
|
|||
2011-10-26 Gregory John Casamento <greg.casamento@gmail.com>
|
||||
|
||||
* Palettes/3Containers/GormTableViewAttributesInspector.h:
|
||||
Add sortMatrix and sortOrder to class for inspector.
|
||||
* Palettes/3Containers/GormTableViewAttributesInspector.m:
|
||||
Add logic to ok:/revert: to handle sort descriptors.
|
||||
* Palettes/3Containers/GormNSTableViewInspector.gorm:
|
||||
Add form and popupbutton for sortMatrix and sortOrder
|
||||
|
||||
2011-10-25 Fred Kiefer <FredKiefer@gmx.de>
|
||||
|
||||
* Palettes/0Menu/GormMenuEditor.m: Protect against the menu parent
|
||||
|
|
|
@ -16,7 +16,9 @@
|
|||
columnSelectionSwitch,
|
||||
drawgridSwitch,
|
||||
resizingSwitch,
|
||||
reorderingSwitch
|
||||
reorderingSwitch,
|
||||
sortMatrix,
|
||||
sortOrder
|
||||
);
|
||||
Super = IBInspector;
|
||||
};
|
||||
|
|
Binary file not shown.
Binary file not shown.
|
@ -39,6 +39,7 @@
|
|||
@class NSColorWell;
|
||||
@class NSForm;
|
||||
@class NSMatrix;
|
||||
@class NSPopUpButton;
|
||||
|
||||
@interface GormTableViewAttributesInspector: IBInspector
|
||||
{
|
||||
|
@ -49,14 +50,17 @@
|
|||
/* scrollers */
|
||||
NSButton *verticalScrollerSwitch;
|
||||
NSButton *horizontalScrollerSwitch;
|
||||
|
||||
/* border and rows */
|
||||
NSMatrix *borderMatrix;
|
||||
NSForm *rowsHeightForm;
|
||||
/* options */
|
||||
NSButton *drawgridSwitch;
|
||||
NSButton *resizingSwitch;
|
||||
NSButton *reorderingSwitch;
|
||||
|
||||
/* sorting */
|
||||
NSForm *sortMatrix;
|
||||
NSPopUpButton *sortOrder;
|
||||
/* tag */
|
||||
NSForm *tagForm;
|
||||
NSColorWell *backgroundColor;
|
||||
}
|
||||
|
|
|
@ -29,16 +29,17 @@
|
|||
Clean up
|
||||
Author : Fabien Vallon <fabien@sonappart.net>
|
||||
*/
|
||||
#include "GormTableViewAttributesInspector.h"
|
||||
#include "GormNSTableView.h"
|
||||
#include <GormCore/NSColorWell+GormExtensions.h>
|
||||
#include <GormCore/GormPrivate.h>
|
||||
#include <Foundation/NSNotification.h>
|
||||
#include <AppKit/NSButton.h>
|
||||
#include <AppKit/NSColorWell.h>
|
||||
#include <AppKit/NSForm.h>
|
||||
#include <AppKit/NSMatrix.h>
|
||||
#include <AppKit/NSNibLoading.h>
|
||||
#import "GormTableViewAttributesInspector.h"
|
||||
#import "GormNSTableView.h"
|
||||
#import <GormCore/NSColorWell+GormExtensions.h>
|
||||
#import <GormCore/GormPrivate.h>
|
||||
#import <Foundation/NSNotification.h>
|
||||
#import <Foundation/NSSortDescriptor.h>
|
||||
#import <AppKit/NSButton.h>
|
||||
#import <AppKit/NSColorWell.h>
|
||||
#import <AppKit/NSForm.h>
|
||||
#import <AppKit/NSMatrix.h>
|
||||
#import <AppKit/NSNibLoading.h>
|
||||
|
||||
|
||||
@implementation GormTableViewAttributesInspector
|
||||
|
@ -173,6 +174,19 @@
|
|||
{
|
||||
[object setBackgroundColor: [backgroundColor color]];
|
||||
}
|
||||
else if( sender == sortMatrix || sender == sortOrder )
|
||||
{
|
||||
NSString *key = [[sortMatrix cellAtIndex: 0] stringValue];
|
||||
SEL selector = NSSelectorFromString([[sortMatrix cellAtIndex: 1] stringValue]);
|
||||
BOOL isAscending = ([sortOrder indexOfSelectedItem] == 0);
|
||||
NSMutableArray *newSortDescriptors = [NSMutableArray array];
|
||||
NSSortDescriptor *sortDescriptor = [[NSSortDescriptor alloc] initWithKey:key
|
||||
ascending:isAscending
|
||||
selector:selector];
|
||||
[newSortDescriptors addObject: sortDescriptor];
|
||||
[object setSortDescriptors: newSortDescriptors];
|
||||
[sortDescriptor release];
|
||||
}
|
||||
|
||||
// #warning always needed ?
|
||||
[scrollView setNeedsDisplay: YES];
|
||||
|
@ -235,7 +249,15 @@
|
|||
|
||||
/* background color */
|
||||
[backgroundColor setColorWithoutAction: [object backgroundColor]];
|
||||
|
||||
|
||||
/* sort */
|
||||
NSSortDescriptor *sortDescriptor = [[object sortDescriptors] objectAtIndex: 0];
|
||||
if(sortDescriptor)
|
||||
{
|
||||
[[sortMatrix cellAtIndex: 0] setStringValue: [sortDescriptor key]];
|
||||
[[sortMatrix cellAtIndex: 1] setStringValue: NSStringFromSelector([sortDescriptor selector])];
|
||||
[sortOrder selectItemAtIndex: ([sortDescriptor ascending]?0:1)];
|
||||
}
|
||||
[super revert:sender];
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue