Permalink
Browse files

added TUIStyledView

  • Loading branch information...
1 parent 5c1cad1 commit e7546bba6dc558dd9ea2990422ca32a0e0265679 @joshaber joshaber committed May 31, 2012
Showing with 66 additions and 0 deletions.
  1. +8 −0 TwUI.xcodeproj/project.pbxproj
  2. +17 −0 lib/UIKit/TUIStyledView.h
  3. +41 −0 lib/UIKit/TUIStyledView.m
@@ -118,6 +118,8 @@
88D25F5813F5D96500CFAAA9 /* TUITableView+Cell.m in Sources */ = {isa = PBXBuildFile; fileRef = 88D25F5413F5D96500CFAAA9 /* TUITableView+Cell.m */; };
88D25F5913F5D96500CFAAA9 /* TUITableView+Cell.m in Sources */ = {isa = PBXBuildFile; fileRef = 88D25F5413F5D96500CFAAA9 /* TUITableView+Cell.m */; };
88D25F5A13F5D96500CFAAA9 /* TUITableView+Cell.m in Sources */ = {isa = PBXBuildFile; fileRef = 88D25F5413F5D96500CFAAA9 /* TUITableView+Cell.m */; };
+ 88D81CFF1577EF0D009D453B /* TUIStyledView.h in Headers */ = {isa = PBXBuildFile; fileRef = 88D81CFD1577EF0D009D453B /* TUIStyledView.h */; settings = {ATTRIBUTES = (Public, ); }; };
+ 88D81D001577EF0D009D453B /* TUIStyledView.m in Sources */ = {isa = PBXBuildFile; fileRef = 88D81CFE1577EF0D009D453B /* TUIStyledView.m */; };
88EFFB5113F417E200CF91A9 /* TUITextViewEditor.h in Headers */ = {isa = PBXBuildFile; fileRef = 88EFFB4F13F417E200CF91A9 /* TUITextViewEditor.h */; };
88EFFB5213F417E200CF91A9 /* TUITextViewEditor.h in Headers */ = {isa = PBXBuildFile; fileRef = 88EFFB4F13F417E200CF91A9 /* TUITextViewEditor.h */; };
88EFFB5313F417E200CF91A9 /* TUITextViewEditor.h in Headers */ = {isa = PBXBuildFile; fileRef = 88EFFB4F13F417E200CF91A9 /* TUITextViewEditor.h */; };
@@ -304,6 +306,8 @@
88CC1F3613E3684600827793 /* TUIButton+Accessibility.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "TUIButton+Accessibility.m"; sourceTree = "<group>"; };
88D25F5313F5D96500CFAAA9 /* TUITableView+Cell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "TUITableView+Cell.h"; sourceTree = "<group>"; };
88D25F5413F5D96500CFAAA9 /* TUITableView+Cell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "TUITableView+Cell.m"; sourceTree = "<group>"; };
+ 88D81CFD1577EF0D009D453B /* TUIStyledView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TUIStyledView.h; sourceTree = "<group>"; };
+ 88D81CFE1577EF0D009D453B /* TUIStyledView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TUIStyledView.m; sourceTree = "<group>"; };
88EFFB4F13F417E200CF91A9 /* TUITextViewEditor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TUITextViewEditor.h; sourceTree = "<group>"; };
88EFFB5013F417E200CF91A9 /* TUITextViewEditor.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TUITextViewEditor.m; sourceTree = "<group>"; };
CB5B264C13BE6DA200579B1E /* TwUI.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = TwUI.framework; sourceTree = BUILT_PRODUCTS_DIR; };
@@ -617,6 +621,8 @@
CBB74C6613BE6E1900C85CB5 /* TUIResponder.m */,
CBB74C6713BE6E1900C85CB5 /* TUIScrollKnob.h */,
CBB74C6813BE6E1900C85CB5 /* TUIScrollKnob.m */,
+ 88D81CFD1577EF0D009D453B /* TUIStyledView.h */,
+ 88D81CFE1577EF0D009D453B /* TUIStyledView.m */,
CBB74C6913BE6E1900C85CB5 /* TUIScrollView.h */,
CBB74C6A13BE6E1900C85CB5 /* TUIScrollView.m */,
CBB74C6B13BE6E1900C85CB5 /* TUIStringDrawing.h */,
@@ -710,6 +716,7 @@
CBB74CA713BE6E1900C85CB5 /* TUIFont.h in Headers */,
CBB74CA913BE6E1900C85CB5 /* TUIGeometry.h in Headers */,
CBB74CAB13BE6E1900C85CB5 /* TUIImage+Drawing.h in Headers */,
+ 88D81CFF1577EF0D009D453B /* TUIStyledView.h in Headers */,
CBB74CAD13BE6E1900C85CB5 /* TUIImage.h in Headers */,
CBB74CAF13BE6E1900C85CB5 /* TUIImageView.h in Headers */,
CBB74CB113BE6E1900C85CB5 /* TUIKit.h in Headers */,
@@ -1033,6 +1040,7 @@
884E8F5515387E11000F7A8D /* TUIPopover.m in Sources */,
884E8F5E1538809C000F7A8D /* CAAnimation+TUIExtensions.m in Sources */,
30D399C9156D8ADD006ECDAE /* TUIProgressBar.m in Sources */,
+ 88D81D001577EF0D009D453B /* TUIStyledView.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
View
@@ -0,0 +1,17 @@
+//
+// TUIStyledView.h
+// TwUI
+//
+// Created by Josh Abernathy on 5/31/12.
+// Copyright (c) 2012 __MyCompanyName__. All rights reserved.
+//
+
+#import "TUIView.h"
+
+
+@interface TUIStyledView : TUIView
+
+@property (nonatomic, strong) TUIColor *strokeColor;
+@property (nonatomic, assign) CGFloat strokeWidth;
+
+@end
View
@@ -0,0 +1,41 @@
+//
+// TUIStyledView.m
+// TwUI
+//
+// Created by Josh Abernathy on 5/31/12.
+// Copyright (c) 2012 __MyCompanyName__. All rights reserved.
+//
+
+#import "TUIStyledView.h"
+#import "TUIKit.h"
+
+
+@implementation TUIStyledView
+
+
+#pragma mark TUIView
+
+- (void)drawRect:(CGRect)rect {
+ [super drawRect:rect];
+
+ CGContextRef context = TUIGraphicsGetCurrentContext();
+ [self.backgroundColor set];
+ CGContextFillRect(context, self.bounds);
+
+ if(self.strokeColor != nil) {
+ [self.strokeColor set];
+ CGContextStrokeRectWithWidth(context, self.bounds, self.strokeWidth);
+ }
+
+ for(TUITextRenderer *renderer in self.textRenderers) {
+ [renderer draw];
+ }
+}
+
+
+#pragma mark API
+
+@synthesize strokeColor;
+@synthesize strokeWidth;
+
+@end

0 comments on commit e7546bb

Please sign in to comment.