コード例 #1
0
    def initWithFrame_(self, frame):
        self = NSView.initWithFrame_(self, frame)
        if self:
            self.items = []

            self.leftButton = NSButton.alloc().initWithFrame_(
                NSMakeRect(0, 0, 20, 20))
            self.leftButton.setTarget_(self)
            self.leftButton.setAction_("scrollLeft:")
            self.leftButton.setImage_(
                NSImage.imageNamed_("NSLeftFacingTriangleTemplate"))
            self.leftButton.setHidden_(True)
            self.leftButton.cell().setBezelStyle_(NSShadowlessSquareBezelStyle)
            self.addSubview_(self.leftButton)

            self.rightButton = NSButton.alloc().initWithFrame_(
                NSMakeRect(0, 0, 20, 20))
            self.rightButton.setTarget_(self)
            self.rightButton.setAction_("scrollRight:")
            self.rightButton.setImage_(
                NSImage.imageNamed_("NSRightFacingTriangleTemplate"))
            self.rightButton.setHidden_(True)
            self.rightButton.cell().setBezelStyle_(
                NSShadowlessSquareBezelStyle)
            self.addSubview_(self.rightButton)

        return self
コード例 #2
0
    def initWithFrame_(self, frame):
        self = NSView.initWithFrame_(self, frame)
        if self:
            self.items = []

            self.leftButton = NSButton.alloc().initWithFrame_(NSMakeRect(0, 0, 20, 20))
            self.leftButton.setTarget_(self)
            self.leftButton.setAction_("scrollLeft:")
            self.leftButton.setImage_(NSImage.imageNamed_("NSLeftFacingTriangleTemplate"))
            self.leftButton.setHidden_(True)
            self.leftButton.cell().setBezelStyle_(NSShadowlessSquareBezelStyle)
            self.addSubview_(self.leftButton)

            self.rightButton = NSButton.alloc().initWithFrame_(NSMakeRect(0, 0, 20, 20))
            self.rightButton.setTarget_(self)
            self.rightButton.setAction_("scrollRight:")
            self.rightButton.setImage_(NSImage.imageNamed_("NSRightFacingTriangleTemplate"))
            self.rightButton.setHidden_(True)
            self.rightButton.cell().setBezelStyle_(NSShadowlessSquareBezelStyle)
            self.addSubview_(self.rightButton)

        return self
コード例 #3
0
    def initWithSwitcher_item_(self, switcher, item):
        self = NSView.initWithFrame_(self, NSMakeRect(0, 2, 100, 18))
        if self:
            self.closeIcon.setSize_(NSMakeSize(12, 12))
            self.closeButton = NSButton.alloc().initWithFrame_(NSMakeRect(3, 5, 12, 14))
            self.closeButton.setImagePosition_(NSImageOnly)
            self.closeButton.setButtonType_(NSMomentaryChangeButton)
            self.closeButton.cell().setBezelStyle_(NSSmallSquareBezelStyle)
            self.closeButton.setBordered_(False)
            self.closeButton.setImage_(self.closeIcon)
            self.closeButton.setAutoresizingMask_(NSViewMaxXMargin|NSViewMaxYMargin)
            self.closeButton.setHidden_(True)
            self.addSubview_(self.closeButton)

            self.switcher = switcher
            self.item = item
        return self
コード例 #4
0
    def initWithSwitcher_item_(self, switcher, item):
        self = NSView.initWithFrame_(self, NSMakeRect(0, 2, 100, 18))
        if self:
            self.closeIcon.setSize_(NSMakeSize(12, 12))
            self.closeButton = NSButton.alloc().initWithFrame_(
                NSMakeRect(3, 5, 12, 14))
            self.closeButton.setImagePosition_(NSImageOnly)
            self.closeButton.setButtonType_(NSMomentaryChangeButton)
            self.closeButton.cell().setBezelStyle_(NSSmallSquareBezelStyle)
            self.closeButton.setBordered_(False)
            self.closeButton.setImage_(self.closeIcon)
            self.closeButton.setAutoresizingMask_(NSViewMaxXMargin
                                                  | NSViewMaxYMargin)
            self.closeButton.setHidden_(True)
            self.addSubview_(self.closeButton)

            self.switcher = switcher
            self.item = item
        return self