SlideShare une entreprise Scribd logo
1  sur  33
Télécharger pour lire hors ligne
CocoaHeads.fr
NSWindow
1988 -
Stéphane Sudre
Employé du mois chez Lapeyre
Sommaire


• Profil d’une fenêtre
• Les bases
• Performance
• Utilisations avancées
Profil d’une fenêtre

                       Titre
      Boutons                   Barre de titre




                                     Zone de
    Ombre             Contenu   redimensionnement
Profil d’une fenêtre




       NSWindow       NSPanel
Profil d’une fenêtre




        Key      La fenêtre qui répond aux entrées clavier



       Main      La fenêtre standard qui est au premier plan



      Activate       L’application est l’application active
Les bases
Créer une fenêtre




                - initWithContentRect:
                            styleMask:
                              backing:
                                defer:
Les bases
Afficher/masquer une fenêtre

                - makeKeyAndOrderFront:

                - orderFront:

                - orderWindow:relativeTo:

                - setAlpha:

                - orderOut:

                - setHidesOnDeactivate:

                - setLevel:                  kCGDesktopWindowLevel-1




    !   Masquer n’est pas fermer !

                - close / - setReleasedWhenClose:
Les bases
Redimensionner une fenêtre


                 - setFrame:display:animate:

                 - setFrame:display:

                 - setContentSize:




    !    Indépendance de la résolution !
                 + frameRectForContentRect:styleMask:
Les bases
Contraindre le redimensionnement manuel




               - setMinSize:

               - setMaxSize:

               - setAspectRatio:

               - setResizeIncrements:
Les bases
Autoriser/interdire le redimensionnement manuel




                - setShowsResizeIndicator:

                - setMinSize:

                - setMaxSize:




               !   Il est peut-être déjà trop tard !
Les bases
Déplacer une fenêtre avec du code


                - setFrameOrigin:

                - setFrameTopLeftPoint:

                - setFrame:display:animate:




  Autoriser le déplacement par le fond
                - setMovableByBackground:
Les bases
Placer une fenêtre dans le Dock


                  - miniaturize:

                  - deminiaturize:




         !   Attention à la fermeture de fenêtres dans le Dock
Copyright 2010 Ed Whetstone
Démon!ration
Une fenêtre p"r les g"verner t"tes
- addChildWindow:ordered:
- removeChildWindow:
- parentWindow
NeXTStep forever
- (id) initWithContentRect:(NSRect) inFrame
                 styleMask:(NSUInteger) inStyle
                   backing:(NSBackingStoreType) inType
                      defer:(BOOL) aFlag {

  self=[super initWithContentRect:inFrame
                        styleMask:NSBorderlessWindowMask
                          backing:inType
                             defer:aFlag];
	    	
  if (self!=nil) {

	       [self setOpaque:NO];
	       	
	       [self setBackgroundColor: [NSColor clearColor]];

    }
	
    return self;
}
- (id) initWithContentRect:(NSRect) inFrame
                 styleMask:(NSUInteger) inStyle
                   backing:(NSBackingStoreType) inType
                      defer:(BOOL) aFlag {

  self=[super initWithContentRect:inFrame
                        styleMask:NSBorderlessWindowMask
                          backing:inType
                             defer:aFlag];
	    	
  if (self!=nil) {

	       [self setOpaque:NO];
	       	
	       [self setBackgroundColor: [NSColor clearColor]];

    }
	
    return self;
}
- (id) initWithContentRect:(NSRect) inFrame
                 styleMask:(NSUInteger) inStyle
                   backing:(NSBackingStoreType) inType
                      defer:(BOOL) aFlag {

  self=[super initWithContentRect:inFrame
                        styleMask:NSBorderlessWindowMask
                          backing:inType
                             defer:aFlag];
	    	
  if (self!=nil) {

	       [self setOpaque:NO];
	       	
	       [self setBackgroundColor: [NSColor clearColor]];

    }
	
    return self;
}
- (id) initWithContentRect:(NSRect) inFrame
                 styleMask:(NSUInteger) inStyle
                   backing:(NSBackingStoreType) inType
                      defer:(BOOL) aFlag {

  self=[super initWithContentRect:inFrame
                        styleMask:NSBorderlessWindowMask
                          backing:inType
                             defer:aFlag];
	    	
  if (self!=nil) {

	       [self setOpaque:NO];
	       	
	       [self setBackgroundColor: [NSColor clearColor]];

    }
	
    return self;
}
M
              I
D



    Forever
1   HIThemeDrawWindowFrame(...);




2


                                   rdar://8090925
Démon!ration
Ressources

Documentation
  developer.apple.com/mac/library/documentation/Cocoa/Conceptual/WinPanel/WinPanel.html




Sample Code

  developer.apple.com/mac/library/samplecode/RoundTransparentWindow/
  developer.apple.com/mac/library/samplecode/FunkyOverlayWindow/FunkyOverlayWindow.zip
CocoaHeads.fr

Contenu connexe

Tendances

Bases de PHP - Partie 1
Bases de PHP - Partie 1Bases de PHP - Partie 1
Bases de PHP - Partie 1Régis Lutter
 
Créez votre site web vous-même 1/2
Créez votre site web vous-même 1/2Créez votre site web vous-même 1/2
Créez votre site web vous-même 1/2pro-info.be
 
AngularJS et autres techno frontend
AngularJS et autres techno frontendAngularJS et autres techno frontend
AngularJS et autres techno frontendyllieth
 
Application web php5 html5 css3 bootstrap
Application web php5 html5 css3 bootstrapApplication web php5 html5 css3 bootstrap
Application web php5 html5 css3 bootstrapBassem ABCHA
 
Soutenance Zend Framework vs Symfony
Soutenance Zend Framework vs SymfonySoutenance Zend Framework vs Symfony
Soutenance Zend Framework vs SymfonyVincent Composieux
 
Bonnes pratiques de developpement en PHP
Bonnes pratiques de developpement en PHPBonnes pratiques de developpement en PHP
Bonnes pratiques de developpement en PHPPascal MARTIN
 

Tendances (9)

Bases de PHP - Partie 1
Bases de PHP - Partie 1Bases de PHP - Partie 1
Bases de PHP - Partie 1
 
Php4 Mysql
Php4 MysqlPhp4 Mysql
Php4 Mysql
 
Créez votre site web vous-même 1/2
Créez votre site web vous-même 1/2Créez votre site web vous-même 1/2
Créez votre site web vous-même 1/2
 
AngularJS et autres techno frontend
AngularJS et autres techno frontendAngularJS et autres techno frontend
AngularJS et autres techno frontend
 
Application web php5 html5 css3 bootstrap
Application web php5 html5 css3 bootstrapApplication web php5 html5 css3 bootstrap
Application web php5 html5 css3 bootstrap
 
Soutenance Zend Framework vs Symfony
Soutenance Zend Framework vs SymfonySoutenance Zend Framework vs Symfony
Soutenance Zend Framework vs Symfony
 
Bonnes pratiques de developpement en PHP
Bonnes pratiques de developpement en PHPBonnes pratiques de developpement en PHP
Bonnes pratiques de developpement en PHP
 
03 presentation-navigation
03 presentation-navigation03 presentation-navigation
03 presentation-navigation
 
Cours JavaScript
Cours JavaScriptCours JavaScript
Cours JavaScript
 

En vedette

Velocity is not the Goal
Velocity is not the GoalVelocity is not the Goal
Velocity is not the GoalDoc Norton
 
Jordan Hubbard Talk @ LISA
Jordan Hubbard Talk @ LISAJordan Hubbard Talk @ LISA
Jordan Hubbard Talk @ LISAguest4c923d
 
CodeStock :: Introduction To MacRuby and HotCocoa
CodeStock :: Introduction To MacRuby and HotCocoaCodeStock :: Introduction To MacRuby and HotCocoa
CodeStock :: Introduction To MacRuby and HotCocoaDoc Norton
 
Growing into Excellence - PNSQC
Growing into Excellence - PNSQCGrowing into Excellence - PNSQC
Growing into Excellence - PNSQCDoc Norton
 
Velocity is NOT the Goal - PNSQC
Velocity is NOT the Goal - PNSQCVelocity is NOT the Goal - PNSQC
Velocity is NOT the Goal - PNSQCDoc Norton
 
Velocity is not the goal code palo-usa
Velocity is not the goal   code palo-usaVelocity is not the goal   code palo-usa
Velocity is not the goal code palo-usaDoc Norton
 
MacRuby - When objective-c and Ruby meet
MacRuby - When objective-c and Ruby meetMacRuby - When objective-c and Ruby meet
MacRuby - When objective-c and Ruby meetMatt Aimonetti
 

En vedette (7)

Velocity is not the Goal
Velocity is not the GoalVelocity is not the Goal
Velocity is not the Goal
 
Jordan Hubbard Talk @ LISA
Jordan Hubbard Talk @ LISAJordan Hubbard Talk @ LISA
Jordan Hubbard Talk @ LISA
 
CodeStock :: Introduction To MacRuby and HotCocoa
CodeStock :: Introduction To MacRuby and HotCocoaCodeStock :: Introduction To MacRuby and HotCocoa
CodeStock :: Introduction To MacRuby and HotCocoa
 
Growing into Excellence - PNSQC
Growing into Excellence - PNSQCGrowing into Excellence - PNSQC
Growing into Excellence - PNSQC
 
Velocity is NOT the Goal - PNSQC
Velocity is NOT the Goal - PNSQCVelocity is NOT the Goal - PNSQC
Velocity is NOT the Goal - PNSQC
 
Velocity is not the goal code palo-usa
Velocity is not the goal   code palo-usaVelocity is not the goal   code palo-usa
Velocity is not the goal code palo-usa
 
MacRuby - When objective-c and Ruby meet
MacRuby - When objective-c and Ruby meetMacRuby - When objective-c and Ruby meet
MacRuby - When objective-c and Ruby meet
 

Similaire à Slides de la

Node.js, le pavé dans la mare
Node.js, le pavé dans la mareNode.js, le pavé dans la mare
Node.js, le pavé dans la mareValtech
 
Grails from scratch to prod - MixIT 2011
Grails from scratch to prod - MixIT 2011Grails from scratch to prod - MixIT 2011
Grails from scratch to prod - MixIT 2011Aurélien Maury
 
Microsoft Composition, pierre angulaire de vos applications ?
Microsoft Composition, pierre angulaire de vos applications ?Microsoft Composition, pierre angulaire de vos applications ?
Microsoft Composition, pierre angulaire de vos applications ?Microsoft
 
Enib cours c.a.i. web - séance #1 - html5 css3-js - 2
Enib   cours c.a.i. web - séance #1 - html5 css3-js - 2Enib   cours c.a.i. web - séance #1 - html5 css3-js - 2
Enib cours c.a.i. web - séance #1 - html5 css3-js - 2Horacio Gonzalez
 
Suivi qualité avec sonar pour php
Suivi qualité avec sonar pour phpSuivi qualité avec sonar pour php
Suivi qualité avec sonar pour phpGabriele Santini
 
Création d’une application gérant l’offline et le stockage
Création d’une application gérant l’offline et le stockageCréation d’une application gérant l’offline et le stockage
Création d’une application gérant l’offline et le stockagedavrous
 
Développement avec Java Micro Edition
Développement avec Java Micro EditionDéveloppement avec Java Micro Edition
Développement avec Java Micro EditionSylvain Wallez
 
Création d'une application html5 utilisant canvas, svg et les animations css3
Création d'une application html5 utilisant canvas, svg et les animations css3Création d'une application html5 utilisant canvas, svg et les animations css3
Création d'une application html5 utilisant canvas, svg et les animations css3davrous
 
Javascript objet : que fait ce code ?
Javascript objet : que fait ce code ?Javascript objet : que fait ce code ?
Javascript objet : que fait ce code ?Ruau Mickael
 
Atelier autour de UWA à ParisWeb 2007
Atelier autour de UWA à ParisWeb 2007Atelier autour de UWA à ParisWeb 2007
Atelier autour de UWA à ParisWeb 2007Netvibes
 
Aperçu de RequireJS
Aperçu de RequireJSAperçu de RequireJS
Aperçu de RequireJSVISEO
 
Grails from scratch to prod - MixIT 2010
Grails from scratch to prod - MixIT 2010Grails from scratch to prod - MixIT 2010
Grails from scratch to prod - MixIT 2010Aurélien Maury
 
Gagnez en productivité grâce aux préprocesseurs css
Gagnez en productivité grâce aux préprocesseurs cssGagnez en productivité grâce aux préprocesseurs css
Gagnez en productivité grâce aux préprocesseurs csspefringant
 
Cours yeoman backbone box2d
Cours yeoman backbone box2dCours yeoman backbone box2d
Cours yeoman backbone box2dhugomallet
 
Comment organiser un gros projet backbone
Comment organiser un gros projet backboneComment organiser un gros projet backbone
Comment organiser un gros projet backboneNicolas Carlo
 
Internationalisation du Front
Internationalisation du FrontInternationalisation du Front
Internationalisation du FrontYannick Croissant
 
Cocoaheads Rennes #3 : Bien coder sur iOS
Cocoaheads Rennes #3 : Bien coder sur iOSCocoaheads Rennes #3 : Bien coder sur iOS
Cocoaheads Rennes #3 : Bien coder sur iOSCocoaHeadsRNS
 

Similaire à Slides de la (19)

Node.js, le pavé dans la mare
Node.js, le pavé dans la mareNode.js, le pavé dans la mare
Node.js, le pavé dans la mare
 
Grails from scratch to prod - MixIT 2011
Grails from scratch to prod - MixIT 2011Grails from scratch to prod - MixIT 2011
Grails from scratch to prod - MixIT 2011
 
Microsoft Composition, pierre angulaire de vos applications ?
Microsoft Composition, pierre angulaire de vos applications ?Microsoft Composition, pierre angulaire de vos applications ?
Microsoft Composition, pierre angulaire de vos applications ?
 
Enib cours c.a.i. web - séance #1 - html5 css3-js - 2
Enib   cours c.a.i. web - séance #1 - html5 css3-js - 2Enib   cours c.a.i. web - séance #1 - html5 css3-js - 2
Enib cours c.a.i. web - séance #1 - html5 css3-js - 2
 
Suivi qualité avec sonar pour php
Suivi qualité avec sonar pour phpSuivi qualité avec sonar pour php
Suivi qualité avec sonar pour php
 
Création d’une application gérant l’offline et le stockage
Création d’une application gérant l’offline et le stockageCréation d’une application gérant l’offline et le stockage
Création d’une application gérant l’offline et le stockage
 
Développement avec Java Micro Edition
Développement avec Java Micro EditionDéveloppement avec Java Micro Edition
Développement avec Java Micro Edition
 
Création d'une application html5 utilisant canvas, svg et les animations css3
Création d'une application html5 utilisant canvas, svg et les animations css3Création d'une application html5 utilisant canvas, svg et les animations css3
Création d'une application html5 utilisant canvas, svg et les animations css3
 
Javascript objet : que fait ce code ?
Javascript objet : que fait ce code ?Javascript objet : que fait ce code ?
Javascript objet : que fait ce code ?
 
Native script
Native scriptNative script
Native script
 
Atelier autour de UWA à ParisWeb 2007
Atelier autour de UWA à ParisWeb 2007Atelier autour de UWA à ParisWeb 2007
Atelier autour de UWA à ParisWeb 2007
 
Aperçu de RequireJS
Aperçu de RequireJSAperçu de RequireJS
Aperçu de RequireJS
 
Grails from scratch to prod - MixIT 2010
Grails from scratch to prod - MixIT 2010Grails from scratch to prod - MixIT 2010
Grails from scratch to prod - MixIT 2010
 
Gagnez en productivité grâce aux préprocesseurs css
Gagnez en productivité grâce aux préprocesseurs cssGagnez en productivité grâce aux préprocesseurs css
Gagnez en productivité grâce aux préprocesseurs css
 
Cours yeoman backbone box2d
Cours yeoman backbone box2dCours yeoman backbone box2d
Cours yeoman backbone box2d
 
Comment organiser un gros projet backbone
Comment organiser un gros projet backboneComment organiser un gros projet backbone
Comment organiser un gros projet backbone
 
Internationalisation du Front
Internationalisation du FrontInternationalisation du Front
Internationalisation du Front
 
Cocoaheads Rennes #3 : Bien coder sur iOS
Cocoaheads Rennes #3 : Bien coder sur iOSCocoaheads Rennes #3 : Bien coder sur iOS
Cocoaheads Rennes #3 : Bien coder sur iOS
 
Algo poo ts
Algo poo tsAlgo poo ts
Algo poo ts
 

Plus de CocoaHeads.fr

Présentation gnireenigne
Présentation   gnireenignePrésentation   gnireenigne
Présentation gnireenigneCocoaHeads.fr
 
Wireless ad hoc distribution
Wireless ad hoc distributionWireless ad hoc distribution
Wireless ad hoc distributionCocoaHeads.fr
 
Déploiement ad hoc et beta test
Déploiement ad hoc et beta testDéploiement ad hoc et beta test
Déploiement ad hoc et beta testCocoaHeads.fr
 
Automatisation shipping process
Automatisation shipping processAutomatisation shipping process
Automatisation shipping processCocoaHeads.fr
 
Slides de la Localisation
Slides de la LocalisationSlides de la Localisation
Slides de la LocalisationCocoaHeads.fr
 
Presentation de Mars
Presentation de MarsPresentation de Mars
Presentation de MarsCocoaHeads.fr
 
Presentation de Mars
Presentation de MarsPresentation de Mars
Presentation de MarsCocoaHeads.fr
 
Presentation de Mars
Presentation de MarsPresentation de Mars
Presentation de MarsCocoaHeads.fr
 

Plus de CocoaHeads.fr (14)

Hello xcode 4 v2
Hello xcode 4 v2Hello xcode 4 v2
Hello xcode 4 v2
 
Présentation gnireenigne
Présentation   gnireenignePrésentation   gnireenigne
Présentation gnireenigne
 
Mac app store redux
Mac app store reduxMac app store redux
Mac app store redux
 
Organic quality
Organic qualityOrganic quality
Organic quality
 
Wireless ad hoc distribution
Wireless ad hoc distributionWireless ad hoc distribution
Wireless ad hoc distribution
 
Déploiement ad hoc et beta test
Déploiement ad hoc et beta testDéploiement ad hoc et beta test
Déploiement ad hoc et beta test
 
Automatisation shipping process
Automatisation shipping processAutomatisation shipping process
Automatisation shipping process
 
Bitmaps
BitmapsBitmaps
Bitmaps
 
Slides de la Localisation
Slides de la LocalisationSlides de la Localisation
Slides de la Localisation
 
Design patterns
Design patternsDesign patterns
Design patterns
 
Design patterns
Design patternsDesign patterns
Design patterns
 
Presentation de Mars
Presentation de MarsPresentation de Mars
Presentation de Mars
 
Presentation de Mars
Presentation de MarsPresentation de Mars
Presentation de Mars
 
Presentation de Mars
Presentation de MarsPresentation de Mars
Presentation de Mars
 

Slides de la