mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-04-23 20:01:11 +00:00
Added more graphical elements, any functionality is still missing.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@8170 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
6f5e42e1d1
commit
dd30b76aec
1 changed files with 207 additions and 7 deletions
|
@ -29,8 +29,16 @@
|
|||
*/
|
||||
|
||||
#include <AppKit/NSApplication.h>
|
||||
#include <AppKit/NSFont.h>
|
||||
#include <AppKit/NSTextField.h>
|
||||
#include <AppKit/NSImage.h>
|
||||
#include <AppKit/NSImageView.h>
|
||||
#include <AppKit/NSBox.h>
|
||||
#include <AppKit/NSButton.h>
|
||||
#include <AppKit/NSComboBox.h>
|
||||
#include <AppKit/NSMatrix.h>
|
||||
#include <AppKit/NSForm.h>
|
||||
#include <AppKit/NSFormCell.h>
|
||||
#include <AppKit/NSPrintInfo.h>
|
||||
#include <AppKit/NSPageLayout.h>
|
||||
|
||||
|
@ -100,10 +108,6 @@ NSPageLayout *shared_instance;
|
|||
|
||||
- (int)runModalWithPrintInfo:(NSPrintInfo *)pInfo
|
||||
{
|
||||
/*
|
||||
NSRunAlertPanel (NULL, @"Page Layout Panel not implemented yet",
|
||||
@"OK", NULL, NULL);
|
||||
*/
|
||||
// store the print Info
|
||||
_printInfo = pInfo;
|
||||
|
||||
|
@ -125,7 +129,8 @@ NSPageLayout *shared_instance;
|
|||
}
|
||||
|
||||
- (void)setAccessoryView:(NSView *)aView
|
||||
{}
|
||||
{
|
||||
}
|
||||
|
||||
//
|
||||
// Updating the Panel's Display
|
||||
|
@ -160,6 +165,9 @@ NSPageLayout *shared_instance;
|
|||
return;
|
||||
}
|
||||
|
||||
// store the values in the print info
|
||||
[self writePrintInfo];
|
||||
|
||||
_result = NSOKButton;
|
||||
}
|
||||
if ([sender tag] == NSPLCancelButton)
|
||||
|
@ -172,10 +180,12 @@ NSPageLayout *shared_instance;
|
|||
|
||||
- (void)pickedOrientation:(id)sender
|
||||
{
|
||||
NSLog(@"pickedOrientation %@", sender);
|
||||
}
|
||||
|
||||
- (void)pickedPaperSize:(id)sender
|
||||
{
|
||||
NSLog(@"pickedPaperSize %@", sender);
|
||||
}
|
||||
|
||||
- (void)pickedUnits:(id)sender
|
||||
|
@ -252,14 +262,204 @@ NSPageLayout *shared_instance;
|
|||
screen: nil];
|
||||
if (self != nil)
|
||||
{
|
||||
NSImageView *imageView;
|
||||
NSImage *paper;
|
||||
NSComboBox *combo;
|
||||
NSBox *box;
|
||||
NSForm *f;
|
||||
NSFormCell *fc;
|
||||
NSMatrix *o;
|
||||
NSButtonCell *oc;
|
||||
NSButton *okButton;
|
||||
NSButton *cancelButton;
|
||||
NSRect rb = {{56,8}, {72,24}};
|
||||
NSRect pi = {{60,170}, {100,100}};
|
||||
NSRect wf = {{5,120}, {75,30}};
|
||||
NSRect hf = {{90,120}, {75,30}};
|
||||
NSRect pb = {{190,240}, {95,30}};
|
||||
NSRect pc = {{5,5}, {85,20}};
|
||||
NSRect lb = {{190,180}, {95,30}};
|
||||
NSRect lc = {{5,5}, {85,20}};
|
||||
NSRect ub = {{190,120}, {95,30}};
|
||||
NSRect uc = {{5,5}, {85,20}};
|
||||
NSRect sb = {{190,60}, {95,35}};
|
||||
NSRect mo = {{60,60}, {90,40}};
|
||||
NSRect rb = {{126,8}, {72,24}};
|
||||
NSRect db = {{217,8}, {72,24}};
|
||||
NSView *content = [self contentView];
|
||||
NSView *content;
|
||||
|
||||
[self setTitle: @"Page Layout"];
|
||||
|
||||
content = [self contentView];
|
||||
|
||||
// image of the paper size
|
||||
paper = nil;
|
||||
imageView = [[NSImageView alloc] initWithFrame: pi];
|
||||
[imageView setImage: paper];
|
||||
[imageView setImageScaling: NSScaleNone];
|
||||
[imageView setEditable: NO];
|
||||
[imageView setTag: NSPLImageButton];
|
||||
[content addSubview: imageView];
|
||||
RELEASE(imageView);
|
||||
|
||||
// Width
|
||||
f = [[NSForm alloc] initWithFrame: wf];
|
||||
fc = [f addEntry: @"Width:"];
|
||||
[fc setEditable: YES];
|
||||
[fc setSelectable: YES];
|
||||
[f setBordered: NO];
|
||||
[f setBezeled: YES];
|
||||
[f setTitleAlignment: NSRightTextAlignment];
|
||||
[f setTextAlignment: NSLeftTextAlignment];
|
||||
[f setAutosizesCells: YES];
|
||||
[f sizeToFit];
|
||||
[f setEntryWidth: 80.0];
|
||||
[f setTag: NSPLWidthForm];
|
||||
[content addSubview: f];
|
||||
RELEASE(f);
|
||||
|
||||
// Height
|
||||
f = [[NSForm alloc] initWithFrame: hf];
|
||||
fc = [f addEntry: @"Height:"];
|
||||
[fc setEditable: YES];
|
||||
[fc setSelectable: YES];
|
||||
[f setBordered: NO];
|
||||
[f setBezeled: YES];
|
||||
[f setTitleAlignment: NSRightTextAlignment];
|
||||
[f setTextAlignment: NSLeftTextAlignment];
|
||||
[f setAutosizesCells: YES];
|
||||
[f sizeToFit];
|
||||
[f setEntryWidth: 80.0];
|
||||
[f setTag: NSPLHeightForm];
|
||||
[content addSubview: f];
|
||||
RELEASE(f);
|
||||
|
||||
// Paper Size
|
||||
box = [[NSBox alloc] initWithFrame: pb];
|
||||
[box setTitle: @"Paper Size"];
|
||||
[box setTitlePosition: NSAtTop];
|
||||
[box setBorderType: NSGrooveBorder];
|
||||
[box setAutoresizingMask: (NSViewWidthSizable | NSViewHeightSizable)];
|
||||
|
||||
combo = [[NSComboBox alloc] initWithFrame: pc];
|
||||
[combo setEditable: NO];
|
||||
[combo setSelectable: NO];
|
||||
[combo setBordered: NO];
|
||||
[combo setBezeled: YES];
|
||||
[combo setDrawsBackground: NO];
|
||||
[combo setAlignment: NSLeftTextAlignment];
|
||||
[combo addItemWithObjectValue: @"A2"];
|
||||
[combo addItemWithObjectValue: @"A3"];
|
||||
[combo addItemWithObjectValue: @"A4"];
|
||||
[combo addItemWithObjectValue: @"A5"];
|
||||
[combo addItemWithObjectValue: @"A6"];
|
||||
[combo setNumberOfVisibleItems: 5];
|
||||
[combo selectItemAtIndex: 0];
|
||||
[combo setObjectValue:[combo objectValueOfSelectedItem]];
|
||||
[combo setAction: @selector(pickedPaperSize:)];
|
||||
[combo setTarget: self];
|
||||
[combo setTag: NSPLPaperNameButton];
|
||||
[box addSubview: combo];
|
||||
RELEASE(combo);
|
||||
[box sizeToFit];
|
||||
|
||||
[content addSubview: box];
|
||||
RELEASE(box);
|
||||
|
||||
// Layout
|
||||
box = [[NSBox alloc] initWithFrame: lb];
|
||||
[box setTitle: @"Layout"];
|
||||
[box setTitlePosition: NSAtTop];
|
||||
[box setBorderType: NSGrooveBorder];
|
||||
[box setAutoresizingMask: (NSViewWidthSizable | NSViewHeightSizable)];
|
||||
|
||||
combo = [[NSComboBox alloc] initWithFrame: lc];
|
||||
[combo setEditable: NO];
|
||||
[combo setSelectable: NO];
|
||||
[combo setBordered: NO];
|
||||
[combo setBezeled: YES];
|
||||
[combo setDrawsBackground: NO];
|
||||
[combo setAlignment: NSLeftTextAlignment];
|
||||
[combo addItemWithObjectValue: @"1 Up"];
|
||||
[combo setNumberOfVisibleItems: 5];
|
||||
[combo selectItemAtIndex: 0];
|
||||
[combo setObjectValue:[combo objectValueOfSelectedItem]];
|
||||
[box addSubview: combo];
|
||||
RELEASE(combo);
|
||||
[box sizeToFit];
|
||||
|
||||
[content addSubview: box];
|
||||
RELEASE(box);
|
||||
|
||||
// Units
|
||||
box = [[NSBox alloc] initWithFrame: ub];
|
||||
[box setTitle: @"Units"];
|
||||
[box setTitlePosition: NSAtTop];
|
||||
[box setBorderType: NSGrooveBorder];
|
||||
[box setAutoresizingMask: (NSViewWidthSizable | NSViewHeightSizable)];
|
||||
|
||||
combo = [[NSComboBox alloc] initWithFrame: uc];
|
||||
[combo setEditable: NO];
|
||||
[combo setSelectable: NO];
|
||||
[combo setBordered: NO];
|
||||
[combo setBezeled: YES];
|
||||
[combo setDrawsBackground: NO];
|
||||
[combo setAlignment: NSLeftTextAlignment];
|
||||
[combo addItemWithObjectValue: @"Points"];
|
||||
[combo addItemWithObjectValue: @"Millimeter"];
|
||||
[combo addItemWithObjectValue: @"Centimeter"];
|
||||
[combo addItemWithObjectValue: @"Inches"];
|
||||
[combo setNumberOfVisibleItems: 5];
|
||||
[combo selectItemAtIndex: 2];
|
||||
[combo setObjectValue:[combo objectValueOfSelectedItem]];
|
||||
[combo setAction: @selector(pickedUnits:)];
|
||||
[combo setTarget: self];
|
||||
[combo setTag: NSPLUnitsButton];
|
||||
[box addSubview: combo];
|
||||
RELEASE(combo);
|
||||
[box sizeToFit];
|
||||
|
||||
[content addSubview: box];
|
||||
RELEASE(box);
|
||||
|
||||
// Sacle
|
||||
box = [[NSBox alloc] initWithFrame: sb];
|
||||
[box setTitle: @"Scale"];
|
||||
[box setTitlePosition: NSAtTop];
|
||||
[box setBorderType: NSGrooveBorder];
|
||||
[box setAutoresizingMask: (NSViewWidthSizable | NSViewHeightSizable)];
|
||||
|
||||
|
||||
[content addSubview: box];
|
||||
RELEASE(box);
|
||||
|
||||
// orientation
|
||||
o = [[NSMatrix alloc] initWithFrame: mo
|
||||
mode: NSRadioModeMatrix
|
||||
cellClass: [NSButtonCell class]
|
||||
numberOfRows: 1
|
||||
numberOfColumns: 2];
|
||||
[o setCellSize: NSMakeSize(60, 50)];
|
||||
[o setIntercellSpacing: NSMakeSize(5, 5)];
|
||||
oc = (NSButtonCell*)[o cellAtRow: 0 column: 0];
|
||||
[oc setFont: [NSFont systemFontOfSize: 10]];
|
||||
[oc setButtonType: NSOnOffButton];
|
||||
[oc setBordered: YES];
|
||||
[oc setTitle: @"Portrait"];
|
||||
[oc setImagePosition: NSImageAbove];
|
||||
oc = (NSButtonCell*)[o cellAtRow: 0 column: 1];
|
||||
[oc setFont: [NSFont systemFontOfSize: 10]];
|
||||
[oc setButtonType: NSOnOffButton];
|
||||
[oc setBordered: YES];
|
||||
[oc setTitle: @"Landscape"];
|
||||
[oc setImagePosition: NSImageAbove];
|
||||
[o selectCellAtRow: 0 column: 0];
|
||||
[o setAllowsEmptySelection: NO];
|
||||
[o setTag: NSPLOrientationMatrix];
|
||||
[o setAction: @selector(pickedOrientation:)];
|
||||
[o setTarget: self];
|
||||
[content addSubview: o];
|
||||
RELEASE(o);
|
||||
|
||||
// cancle button
|
||||
cancelButton = [[NSButton alloc] initWithFrame: rb];
|
||||
[cancelButton setStringValue: @"Cancel"];
|
||||
|
|
Loading…
Reference in a new issue