├── .gitignore ├── JUInspectorView.xcodeproj ├── project.pbxproj └── project.xcworkspace │ └── contents.xcworkspacedata ├── JUInspectorView ├── AppDelegate.h ├── AppDelegate.m ├── JUInspectorView-Info.plist ├── JUInspectorView-Prefix.pch ├── en.lproj │ └── MainMenu.xib └── main.m ├── README.markdown ├── Source ├── JUInspectorBaseView.h ├── JUInspectorBaseView.m ├── JUInspectorView.h ├── JUInspectorView.m ├── JUInspectorViewContainer.h ├── JUInspectorViewContainer.m ├── JUInspectorViewHeader.h └── JUInspectorViewHeader.m └── screenshot.png /.gitignore: -------------------------------------------------------------------------------- 1 | # OS X 2 | .DS_Store 3 | 4 | # Xcode 5 | build/ 6 | *.pbxuser 7 | !default.pbxuser 8 | *.mode1v3 9 | !default.mode1v3 10 | *.mode2v3 11 | !default.mode2v3 12 | *.perspectivev3 13 | !default.perspectivev3 14 | xcuserdata 15 | *.xccheckout 16 | profile 17 | *.moved-aside 18 | DerivedData 19 | *.hmap 20 | *.ipa 21 | 22 | # CocoaPods 23 | Pods 24 | -------------------------------------------------------------------------------- /JUInspectorView.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | E975D7F913F66D33006186C6 /* JUInspectorViewContainer.m in Sources */ = {isa = PBXBuildFile; fileRef = E975D7F813F66D33006186C6 /* JUInspectorViewContainer.m */; }; 11 | E98DE5CD13F7D266009F3EE2 /* JUInspectorView.m in Sources */ = {isa = PBXBuildFile; fileRef = E98DE5CC13F7D266009F3EE2 /* JUInspectorView.m */; }; 12 | E9E70F4713F5C8B200479B24 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E9E70F4613F5C8B200479B24 /* Cocoa.framework */; }; 13 | E9E70F5313F5C8B300479B24 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = E9E70F5213F5C8B300479B24 /* main.m */; }; 14 | E9E70F5A13F5C8B300479B24 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = E9E70F5913F5C8B300479B24 /* AppDelegate.m */; }; 15 | E9E70F5D13F5C8B300479B24 /* MainMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = E9E70F5B13F5C8B300479B24 /* MainMenu.xib */; }; 16 | E9E70F6613F5C9C200479B24 /* JUInspectorViewHeader.m in Sources */ = {isa = PBXBuildFile; fileRef = E9E70F6513F5C9C200479B24 /* JUInspectorViewHeader.m */; }; 17 | FFF7FB0214333BC600607DE4 /* JUInspectorBaseView.m in Sources */ = {isa = PBXBuildFile; fileRef = FFF7FB0114333BC600607DE4 /* JUInspectorBaseView.m */; }; 18 | /* End PBXBuildFile section */ 19 | 20 | /* Begin PBXFileReference section */ 21 | E975D7F713F66D33006186C6 /* JUInspectorViewContainer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JUInspectorViewContainer.h; sourceTree = ""; }; 22 | E975D7F813F66D33006186C6 /* JUInspectorViewContainer.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = JUInspectorViewContainer.m; sourceTree = ""; }; 23 | E98DE5CB13F7D266009F3EE2 /* JUInspectorView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JUInspectorView.h; sourceTree = ""; }; 24 | E98DE5CC13F7D266009F3EE2 /* JUInspectorView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = JUInspectorView.m; sourceTree = ""; }; 25 | E9E70F4213F5C8B200479B24 /* JUInspectorView.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = JUInspectorView.app; sourceTree = BUILT_PRODUCTS_DIR; }; 26 | E9E70F4613F5C8B200479B24 /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = System/Library/Frameworks/Cocoa.framework; sourceTree = SDKROOT; }; 27 | E9E70F4913F5C8B200479B24 /* AppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppKit.framework; path = System/Library/Frameworks/AppKit.framework; sourceTree = SDKROOT; }; 28 | E9E70F4A13F5C8B200479B24 /* CoreData.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreData.framework; path = System/Library/Frameworks/CoreData.framework; sourceTree = SDKROOT; }; 29 | E9E70F4B13F5C8B200479B24 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; 30 | E9E70F4E13F5C8B200479B24 /* JUInspectorView-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "JUInspectorView-Info.plist"; sourceTree = ""; }; 31 | E9E70F5213F5C8B300479B24 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 32 | E9E70F5413F5C8B300479B24 /* JUInspectorView-Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "JUInspectorView-Prefix.pch"; sourceTree = ""; }; 33 | E9E70F5813F5C8B300479B24 /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; 34 | E9E70F5913F5C8B300479B24 /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; 35 | E9E70F5C13F5C8B300479B24 /* en */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = en; path = en.lproj/MainMenu.xib; sourceTree = ""; }; 36 | E9E70F6413F5C9C200479B24 /* JUInspectorViewHeader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JUInspectorViewHeader.h; sourceTree = ""; }; 37 | E9E70F6513F5C9C200479B24 /* JUInspectorViewHeader.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = JUInspectorViewHeader.m; sourceTree = ""; }; 38 | FFF7FB0014333BC600607DE4 /* JUInspectorBaseView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JUInspectorBaseView.h; sourceTree = ""; }; 39 | FFF7FB0114333BC600607DE4 /* JUInspectorBaseView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = JUInspectorBaseView.m; sourceTree = ""; }; 40 | /* End PBXFileReference section */ 41 | 42 | /* Begin PBXFrameworksBuildPhase section */ 43 | E9E70F3F13F5C8B200479B24 /* Frameworks */ = { 44 | isa = PBXFrameworksBuildPhase; 45 | buildActionMask = 2147483647; 46 | files = ( 47 | E9E70F4713F5C8B200479B24 /* Cocoa.framework in Frameworks */, 48 | ); 49 | runOnlyForDeploymentPostprocessing = 0; 50 | }; 51 | /* End PBXFrameworksBuildPhase section */ 52 | 53 | /* Begin PBXGroup section */ 54 | E9E70F3713F5C8B000479B24 = { 55 | isa = PBXGroup; 56 | children = ( 57 | E9E70F6313F5C94E00479B24 /* Source */, 58 | E9E70F4C13F5C8B200479B24 /* JUInspectorView */, 59 | E9E70F4513F5C8B200479B24 /* Frameworks */, 60 | E9E70F4313F5C8B200479B24 /* Products */, 61 | ); 62 | sourceTree = ""; 63 | }; 64 | E9E70F4313F5C8B200479B24 /* Products */ = { 65 | isa = PBXGroup; 66 | children = ( 67 | E9E70F4213F5C8B200479B24 /* JUInspectorView.app */, 68 | ); 69 | name = Products; 70 | sourceTree = ""; 71 | }; 72 | E9E70F4513F5C8B200479B24 /* Frameworks */ = { 73 | isa = PBXGroup; 74 | children = ( 75 | E9E70F4613F5C8B200479B24 /* Cocoa.framework */, 76 | E9E70F4813F5C8B200479B24 /* Other Frameworks */, 77 | ); 78 | name = Frameworks; 79 | sourceTree = ""; 80 | }; 81 | E9E70F4813F5C8B200479B24 /* Other Frameworks */ = { 82 | isa = PBXGroup; 83 | children = ( 84 | E9E70F4913F5C8B200479B24 /* AppKit.framework */, 85 | E9E70F4A13F5C8B200479B24 /* CoreData.framework */, 86 | E9E70F4B13F5C8B200479B24 /* Foundation.framework */, 87 | ); 88 | name = "Other Frameworks"; 89 | sourceTree = ""; 90 | }; 91 | E9E70F4C13F5C8B200479B24 /* JUInspectorView */ = { 92 | isa = PBXGroup; 93 | children = ( 94 | E9E70F5813F5C8B300479B24 /* AppDelegate.h */, 95 | E9E70F5913F5C8B300479B24 /* AppDelegate.m */, 96 | E9E70F5B13F5C8B300479B24 /* MainMenu.xib */, 97 | E9E70F4D13F5C8B200479B24 /* Supporting Files */, 98 | ); 99 | path = JUInspectorView; 100 | sourceTree = ""; 101 | }; 102 | E9E70F4D13F5C8B200479B24 /* Supporting Files */ = { 103 | isa = PBXGroup; 104 | children = ( 105 | E9E70F5213F5C8B300479B24 /* main.m */, 106 | E9E70F4E13F5C8B200479B24 /* JUInspectorView-Info.plist */, 107 | E9E70F5413F5C8B300479B24 /* JUInspectorView-Prefix.pch */, 108 | ); 109 | name = "Supporting Files"; 110 | sourceTree = ""; 111 | }; 112 | E9E70F6313F5C94E00479B24 /* Source */ = { 113 | isa = PBXGroup; 114 | children = ( 115 | E975D7F713F66D33006186C6 /* JUInspectorViewContainer.h */, 116 | E975D7F813F66D33006186C6 /* JUInspectorViewContainer.m */, 117 | E9E70F6413F5C9C200479B24 /* JUInspectorViewHeader.h */, 118 | E9E70F6513F5C9C200479B24 /* JUInspectorViewHeader.m */, 119 | E98DE5CB13F7D266009F3EE2 /* JUInspectorView.h */, 120 | E98DE5CC13F7D266009F3EE2 /* JUInspectorView.m */, 121 | FFF7FB0014333BC600607DE4 /* JUInspectorBaseView.h */, 122 | FFF7FB0114333BC600607DE4 /* JUInspectorBaseView.m */, 123 | ); 124 | path = Source; 125 | sourceTree = ""; 126 | }; 127 | /* End PBXGroup section */ 128 | 129 | /* Begin PBXNativeTarget section */ 130 | E9E70F4113F5C8B200479B24 /* JUInspectorView */ = { 131 | isa = PBXNativeTarget; 132 | buildConfigurationList = E9E70F6013F5C8B300479B24 /* Build configuration list for PBXNativeTarget "JUInspectorView" */; 133 | buildPhases = ( 134 | E9E70F3E13F5C8B200479B24 /* Sources */, 135 | E9E70F3F13F5C8B200479B24 /* Frameworks */, 136 | E9E70F4013F5C8B200479B24 /* Resources */, 137 | ); 138 | buildRules = ( 139 | ); 140 | dependencies = ( 141 | ); 142 | name = JUInspectorView; 143 | productName = JUInspectorView; 144 | productReference = E9E70F4213F5C8B200479B24 /* JUInspectorView.app */; 145 | productType = "com.apple.product-type.application"; 146 | }; 147 | /* End PBXNativeTarget section */ 148 | 149 | /* Begin PBXProject section */ 150 | E9E70F3913F5C8B100479B24 /* Project object */ = { 151 | isa = PBXProject; 152 | attributes = { 153 | }; 154 | buildConfigurationList = E9E70F3C13F5C8B100479B24 /* Build configuration list for PBXProject "JUInspectorView" */; 155 | compatibilityVersion = "Xcode 3.2"; 156 | developmentRegion = English; 157 | hasScannedForEncodings = 0; 158 | knownRegions = ( 159 | en, 160 | ); 161 | mainGroup = E9E70F3713F5C8B000479B24; 162 | productRefGroup = E9E70F4313F5C8B200479B24 /* Products */; 163 | projectDirPath = ""; 164 | projectRoot = ""; 165 | targets = ( 166 | E9E70F4113F5C8B200479B24 /* JUInspectorView */, 167 | ); 168 | }; 169 | /* End PBXProject section */ 170 | 171 | /* Begin PBXResourcesBuildPhase section */ 172 | E9E70F4013F5C8B200479B24 /* Resources */ = { 173 | isa = PBXResourcesBuildPhase; 174 | buildActionMask = 2147483647; 175 | files = ( 176 | E9E70F5D13F5C8B300479B24 /* MainMenu.xib in Resources */, 177 | ); 178 | runOnlyForDeploymentPostprocessing = 0; 179 | }; 180 | /* End PBXResourcesBuildPhase section */ 181 | 182 | /* Begin PBXSourcesBuildPhase section */ 183 | E9E70F3E13F5C8B200479B24 /* Sources */ = { 184 | isa = PBXSourcesBuildPhase; 185 | buildActionMask = 2147483647; 186 | files = ( 187 | E9E70F5313F5C8B300479B24 /* main.m in Sources */, 188 | E9E70F5A13F5C8B300479B24 /* AppDelegate.m in Sources */, 189 | E9E70F6613F5C9C200479B24 /* JUInspectorViewHeader.m in Sources */, 190 | E975D7F913F66D33006186C6 /* JUInspectorViewContainer.m in Sources */, 191 | E98DE5CD13F7D266009F3EE2 /* JUInspectorView.m in Sources */, 192 | FFF7FB0214333BC600607DE4 /* JUInspectorBaseView.m in Sources */, 193 | ); 194 | runOnlyForDeploymentPostprocessing = 0; 195 | }; 196 | /* End PBXSourcesBuildPhase section */ 197 | 198 | /* Begin PBXVariantGroup section */ 199 | E9E70F5B13F5C8B300479B24 /* MainMenu.xib */ = { 200 | isa = PBXVariantGroup; 201 | children = ( 202 | E9E70F5C13F5C8B300479B24 /* en */, 203 | ); 204 | name = MainMenu.xib; 205 | sourceTree = ""; 206 | }; 207 | /* End PBXVariantGroup section */ 208 | 209 | /* Begin XCBuildConfiguration section */ 210 | E9E70F5E13F5C8B300479B24 /* Debug */ = { 211 | isa = XCBuildConfiguration; 212 | buildSettings = { 213 | ALWAYS_SEARCH_USER_PATHS = NO; 214 | ARCHS = "$(ARCHS_STANDARD_64_BIT)"; 215 | BUILD_STYLE = Debug; 216 | COPY_PHASE_STRIP = NO; 217 | GCC_C_LANGUAGE_STANDARD = gnu99; 218 | GCC_DYNAMIC_NO_PIC = NO; 219 | GCC_ENABLE_OBJC_EXCEPTIONS = YES; 220 | GCC_OPTIMIZATION_LEVEL = 0; 221 | GCC_PREPROCESSOR_DEFINITIONS = ( 222 | "DEBUG=1", 223 | "$(inherited)", 224 | ); 225 | GCC_SYMBOLS_PRIVATE_EXTERN = NO; 226 | GCC_VERSION = com.apple.compilers.llvm.clang.1_0; 227 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 228 | GCC_WARN_ABOUT_MISSING_PROTOTYPES = YES; 229 | GCC_WARN_ABOUT_RETURN_TYPE = YES; 230 | GCC_WARN_UNUSED_VARIABLE = YES; 231 | MACOSX_DEPLOYMENT_TARGET = 10.7; 232 | ONLY_ACTIVE_ARCH = YES; 233 | SDKROOT = macosx; 234 | }; 235 | name = Debug; 236 | }; 237 | E9E70F5F13F5C8B300479B24 /* Release */ = { 238 | isa = XCBuildConfiguration; 239 | buildSettings = { 240 | ALWAYS_SEARCH_USER_PATHS = NO; 241 | ARCHS = "$(ARCHS_STANDARD_64_BIT)"; 242 | BUILD_STYLE = Release; 243 | COPY_PHASE_STRIP = YES; 244 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 245 | GCC_C_LANGUAGE_STANDARD = gnu99; 246 | GCC_ENABLE_OBJC_EXCEPTIONS = YES; 247 | GCC_VERSION = com.apple.compilers.llvm.clang.1_0; 248 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 249 | GCC_WARN_ABOUT_MISSING_PROTOTYPES = YES; 250 | GCC_WARN_ABOUT_RETURN_TYPE = YES; 251 | GCC_WARN_UNUSED_VARIABLE = YES; 252 | MACOSX_DEPLOYMENT_TARGET = 10.7; 253 | SDKROOT = macosx; 254 | }; 255 | name = Release; 256 | }; 257 | E9E70F6113F5C8B300479B24 /* Debug */ = { 258 | isa = XCBuildConfiguration; 259 | buildSettings = { 260 | BUILD_STYLE = Debug; 261 | CLANG_ENABLE_MODULES = YES; 262 | CLANG_ENABLE_OBJC_ARC = YES; 263 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 264 | GCC_PREFIX_HEADER = "JUInspectorView/JUInspectorView-Prefix.pch"; 265 | INFOPLIST_FILE = "JUInspectorView/JUInspectorView-Info.plist"; 266 | MACOSX_DEPLOYMENT_TARGET = 10.7; 267 | PRODUCT_NAME = "$(TARGET_NAME)"; 268 | WRAPPER_EXTENSION = app; 269 | }; 270 | name = Debug; 271 | }; 272 | E9E70F6213F5C8B300479B24 /* Release */ = { 273 | isa = XCBuildConfiguration; 274 | buildSettings = { 275 | BUILD_STYLE = Release; 276 | CLANG_ENABLE_MODULES = YES; 277 | CLANG_ENABLE_OBJC_ARC = YES; 278 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 279 | GCC_PREFIX_HEADER = "JUInspectorView/JUInspectorView-Prefix.pch"; 280 | INFOPLIST_FILE = "JUInspectorView/JUInspectorView-Info.plist"; 281 | MACOSX_DEPLOYMENT_TARGET = 10.7; 282 | PRODUCT_NAME = "$(TARGET_NAME)"; 283 | WRAPPER_EXTENSION = app; 284 | }; 285 | name = Release; 286 | }; 287 | /* End XCBuildConfiguration section */ 288 | 289 | /* Begin XCConfigurationList section */ 290 | E9E70F3C13F5C8B100479B24 /* Build configuration list for PBXProject "JUInspectorView" */ = { 291 | isa = XCConfigurationList; 292 | buildConfigurations = ( 293 | E9E70F5E13F5C8B300479B24 /* Debug */, 294 | E9E70F5F13F5C8B300479B24 /* Release */, 295 | ); 296 | defaultConfigurationIsVisible = 0; 297 | defaultConfigurationName = Release; 298 | }; 299 | E9E70F6013F5C8B300479B24 /* Build configuration list for PBXNativeTarget "JUInspectorView" */ = { 300 | isa = XCConfigurationList; 301 | buildConfigurations = ( 302 | E9E70F6113F5C8B300479B24 /* Debug */, 303 | E9E70F6213F5C8B300479B24 /* Release */, 304 | ); 305 | defaultConfigurationIsVisible = 0; 306 | defaultConfigurationName = Release; 307 | }; 308 | /* End XCConfigurationList section */ 309 | }; 310 | rootObject = E9E70F3913F5C8B100479B24 /* Project object */; 311 | } 312 | -------------------------------------------------------------------------------- /JUInspectorView.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /JUInspectorView/AppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.h 3 | // JUInspectorView 4 | // 5 | // Copyright (c) 2011 by Sidney Just 6 | // Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated 7 | // documentation files (the "Software"), to deal in the Software without restriction, including without limitation 8 | // the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, 9 | // and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 10 | // The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 11 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, 12 | // INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR 13 | // PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE 14 | // FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 15 | // ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 16 | // 17 | 18 | @import Cocoa; 19 | #import "JUInspectorView.h" 20 | 21 | @interface AppDelegate : NSObject 22 | { 23 | IBOutlet NSWindow *window; 24 | IBOutlet JUInspectorViewContainer *inspectorContainer; 25 | IBOutlet JUInspectorView *textInspector; 26 | IBOutlet JUInspectorView *buttonInspector; 27 | } 28 | 29 | @end 30 | -------------------------------------------------------------------------------- /JUInspectorView/AppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.m 3 | // JUInspectorView 4 | // 5 | // Copyright (c) 2011 by Sidney Just 6 | // Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated 7 | // documentation files (the "Software"), to deal in the Software without restriction, including without limitation 8 | // the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, 9 | // and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 10 | // The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 11 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, 12 | // INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR 13 | // PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE 14 | // FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 15 | // ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 16 | // 17 | 18 | #import "AppDelegate.h" 19 | 20 | @implementation AppDelegate 21 | 22 | - (void)applicationDidFinishLaunching:(NSNotification *)aNotification 23 | { 24 | // The index and title of the inspectors are set via Interface Builder! 25 | [inspectorContainer addInspectorView:buttonInspector expanded:NO]; 26 | [inspectorContainer addInspectorView:textInspector expanded:YES]; 27 | } 28 | 29 | @end 30 | -------------------------------------------------------------------------------- /JUInspectorView/JUInspectorView-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIconFile 10 | 11 | CFBundleIdentifier 12 | com.mycompany.${PRODUCT_NAME:rfc1034identifier} 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | ${PRODUCT_NAME} 17 | CFBundlePackageType 18 | APPL 19 | CFBundleShortVersionString 20 | 1.0 21 | CFBundleSignature 22 | ???? 23 | CFBundleVersion 24 | 1 25 | LSMinimumSystemVersion 26 | ${MACOSX_DEPLOYMENT_TARGET} 27 | NSHumanReadableCopyright 28 | Copyright © 2011 __MyCompanyName__. All rights reserved. 29 | NSMainNibFile 30 | MainMenu 31 | NSPrincipalClass 32 | NSApplication 33 | 34 | 35 | -------------------------------------------------------------------------------- /JUInspectorView/JUInspectorView-Prefix.pch: -------------------------------------------------------------------------------- 1 | // 2 | // Prefix header for all source files of the 'JUInspectorView' target in the 'JUInspectorView' project 3 | // 4 | 5 | #ifdef __OBJC__ 6 | #import 7 | #endif 8 | -------------------------------------------------------------------------------- /JUInspectorView/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // JUInspectorView 4 | // 5 | // Copyright (c) 2011 by Sidney Just 6 | // Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated 7 | // documentation files (the "Software"), to deal in the Software without restriction, including without limitation 8 | // the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, 9 | // and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 10 | // The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 11 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, 12 | // INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR 13 | // PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE 14 | // FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 15 | // ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 16 | // 17 | 18 | #import 19 | 20 | int main(int argc, char *argv[]) 21 | { 22 | return NSApplicationMain(argc, (const char **)argv); 23 | } 24 | -------------------------------------------------------------------------------- /README.markdown: -------------------------------------------------------------------------------- 1 | ##Overview 2 | 3 | ![JUInspectorView preview](screenshot.png?raw=true) 4 | 5 | JUInspectorView is a shameless copy of Xcode 5's inspector views. It draws a header with a title and then a custom NSView or NSView subclass as the body. There is a disclosure triangle to open/close the body views and everything is totally like in Xcode 5. 6 | 7 | You can insert the JUInspectorViewContainer (the component which contains all the inspector views) into almost any other view hierarchy, although it makes more sense to add it into a NSScrollView which than can be put into whatever you want. 8 | 9 | ##Tips 10 | If you add a "fullscreen" (read: inspector filling) table view or text view or whatever draws a border, make it borderless! It looks horrible, really. 11 | You should also enable the automatic width autoresize mask flag for body views, setting the height flag has no effect. 12 | 13 | ##License 14 | MIT. Do whatever you want. -------------------------------------------------------------------------------- /Source/JUInspectorBaseView.h: -------------------------------------------------------------------------------- 1 | // 2 | // JUInspectorBaseView.h 3 | // JUInspectorView 4 | // 5 | // Created by Jon Gilkison on 9/28/11. 6 | // Copyright 2011 Interfacelab LLC. All rights reserved. 7 | // 8 | 9 | @import Cocoa; 10 | 11 | @interface JUInspectorBaseView : NSView 12 | 13 | -(void)setupView; 14 | 15 | @end 16 | -------------------------------------------------------------------------------- /Source/JUInspectorBaseView.m: -------------------------------------------------------------------------------- 1 | // 2 | // JUInspectorBaseView.m 3 | // JUInspectorView 4 | // 5 | // Created by Jon Gilkison on 9/28/11. 6 | // Copyright 2011 Interfacelab LLC. All rights reserved. 7 | // 8 | 9 | #import "JUInspectorBaseView.h" 10 | 11 | @implementation JUInspectorBaseView 12 | 13 | #pragma mark - Init/Dealloc 14 | 15 | - (id)initWithFrame:(NSRect)frame 16 | { 17 | if((self = [super initWithFrame:frame])) 18 | { 19 | [self setupView]; 20 | } 21 | 22 | return self; 23 | } 24 | 25 | - (id)initWithCoder:(NSCoder *)decoder 26 | { 27 | if((self = [super initWithCoder:decoder])) 28 | { 29 | [self setupView]; 30 | } 31 | 32 | return self; 33 | } 34 | 35 | - (void)setupView 36 | { 37 | } 38 | 39 | @end 40 | -------------------------------------------------------------------------------- /Source/JUInspectorView.h: -------------------------------------------------------------------------------- 1 | // 2 | // JUInspectoView.h 3 | // JUInspectorView 4 | // 5 | // Copyright (c) 2011 by Sidney Just 6 | // Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated 7 | // documentation files (the "Software"), to deal in the Software without restriction, including without limitation 8 | // the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, 9 | // and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 10 | // The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 11 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, 12 | // INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR 13 | // PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE 14 | // FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 15 | // ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 16 | // 17 | 18 | @import Cocoa; 19 | #import "JUInspectorBaseView.h" 20 | #import "JUInspectorViewHeader.h" 21 | #import "JUInspectorViewContainer.h" 22 | 23 | @interface JUInspectorView : JUInspectorBaseView 24 | 25 | @property (weak, nonatomic) NSString *name; 26 | @property (assign, nonatomic) NSInteger index; 27 | 28 | @property (strong, nonatomic) NSColor *dashColor; 29 | @property (weak, nonatomic) IBOutlet NSView *body; 30 | @property (assign, nonatomic) BOOL expanded; 31 | 32 | @property (strong, nonatomic) JUInspectorViewHeader *header; 33 | @property (weak, nonatomic) JUInspectorViewContainer *container; 34 | 35 | @end 36 | -------------------------------------------------------------------------------- /Source/JUInspectorView.m: -------------------------------------------------------------------------------- 1 | // 2 | // JUInspectoView.m 3 | // JUInspectorView 4 | // 5 | // Copyright (c) 2011 by Sidney Just 6 | // Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated 7 | // documentation files (the "Software"), to deal in the Software without restriction, including without limitation 8 | // the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, 9 | // and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 10 | // The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 11 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, 12 | // INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR 13 | // PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE 14 | // FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 15 | // ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 16 | // 17 | 18 | #import "JUInspectorView.h" 19 | 20 | const CGFloat JUInspectorViewDashInset = 18.0; 21 | const CGFloat JUInspectorViewContentInset = 36.0; 22 | 23 | @implementation JUInspectorView 24 | 25 | #pragma mark - Init/Dealloc 26 | 27 | - (void)setupView 28 | { 29 | self.dashColor = [NSColor lightGrayColor]; 30 | 31 | self.header = [[JUInspectorViewHeader alloc] initWithFrame:NSZeroRect]; 32 | [self.header setAutoresizingMask:NSViewWidthSizable]; 33 | self.header.delegate=self; 34 | 35 | [self addSubview:self.header]; 36 | [self setExpanded:YES]; 37 | } 38 | 39 | 40 | #pragma mark - Properties 41 | 42 | - (void)setExpanded:(BOOL)value 43 | { 44 | if (_expanded==value) 45 | return; 46 | 47 | _expanded=value; 48 | 49 | NSRect frame; 50 | 51 | if (_expanded) 52 | { 53 | frame = [self.body bounds]; 54 | frame.origin = [self frame].origin; 55 | frame.size.height += [self.header bounds].size.height; 56 | 57 | [self.body setHidden:NO]; 58 | [self.header setState:NSOnState]; 59 | [self.container arrangeViews]; 60 | } 61 | else 62 | { 63 | frame.origin = [self frame].origin; 64 | frame.size = [self.header frame].size; 65 | 66 | [self.body setHidden:YES]; 67 | [self.header setState:NSOffState]; 68 | } 69 | 70 | [self setFrame:frame]; 71 | [self.container arrangeViews]; 72 | } 73 | 74 | -(NSString *)name 75 | { 76 | return [self.header title]; 77 | } 78 | 79 | - (void)setName:(NSString *)value 80 | { 81 | [self.header setTitle:value]; 82 | } 83 | 84 | - (void)setBody:(NSView *)pbody 85 | { 86 | [_body removeFromSuperview]; 87 | 88 | _body = pbody; 89 | 90 | if([_body isFlipped]) 91 | { 92 | NSRect bodyFrame = [_body bounds]; 93 | bodyFrame.origin.y = [self.header bounds].size.height + 1.0; 94 | 95 | [_body setFrame:bodyFrame]; 96 | } 97 | else 98 | { 99 | NSRect bodyFrame = [_body bounds]; 100 | bodyFrame.origin.y = -bodyFrame.size.height + [self.header bounds].size.height - 1.0; 101 | 102 | [_body setFrame:bodyFrame]; 103 | } 104 | 105 | [self addSubview:_body]; 106 | 107 | self.expanded = !self.expanded; 108 | } 109 | 110 | #pragma mark - NSView Overrides 111 | 112 | - (void)setFrame:(NSRect)frameRect 113 | { 114 | [super setFrame:frameRect]; 115 | 116 | NSRect bodyRect = [self.body frame]; 117 | bodyRect.origin.x = JUInspectorViewContentInset; 118 | bodyRect.size.width = frameRect.size.width - (JUInspectorViewContentInset * 2.0); 119 | [self.body setFrame:bodyRect]; 120 | } 121 | 122 | - (BOOL)isFlipped 123 | { 124 | return YES; 125 | } 126 | 127 | - (void)drawRect:(NSRect)dirtyRect 128 | { 129 | [self.dashColor set]; 130 | 131 | NSBezierPath *bottomOfFramePath = [NSBezierPath bezierPath]; 132 | [bottomOfFramePath moveToPoint:CGPointMake(CGRectGetMinX(self.bounds) + JUInspectorViewDashInset, CGRectGetHeight(self.bounds))]; 133 | [bottomOfFramePath lineToPoint:CGPointMake(CGRectGetMaxX(self.bounds) - JUInspectorViewDashInset, CGRectGetHeight(self.bounds))]; 134 | 135 | [bottomOfFramePath setLineWidth:1.0]; 136 | [bottomOfFramePath stroke]; 137 | } 138 | 139 | - (NSString *)description 140 | { 141 | return [NSString stringWithFormat:@"JUCollectionView \"%@\", expanded: %@", self.name, self.expanded ? @"YES" : @"NO"]; 142 | } 143 | 144 | - (NSComparisonResult)compare:(JUInspectorView *)otherView 145 | { 146 | if(otherView.index > self.index) 147 | return NSGreaterThanComparison; 148 | 149 | if(otherView.index < self.index) 150 | return NSLessThanComparison; 151 | 152 | return NSEqualToComparison; 153 | } 154 | 155 | #pragma mark - JUInspectorViewHeaderDelegate 156 | 157 | -(void)headerClicked:(JUInspectorViewHeader *)headerView 158 | { 159 | self.expanded=!self.expanded; 160 | } 161 | 162 | 163 | @end 164 | -------------------------------------------------------------------------------- /Source/JUInspectorViewContainer.h: -------------------------------------------------------------------------------- 1 | // 2 | // JUInspectorViewContainer.h 3 | // JUInspectorView 4 | // 5 | // Copyright (c) 2011 by Sidney Just 6 | // Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated 7 | // documentation files (the "Software"), to deal in the Software without restriction, including without limitation 8 | // the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, 9 | // and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 10 | // The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 11 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, 12 | // INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR 13 | // PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE 14 | // FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 15 | // ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 16 | // 17 | 18 | @import Cocoa; 19 | #import "JUInspectorBaseView.h" 20 | 21 | @class JUInspectorView; 22 | 23 | @interface JUInspectorViewContainer : JUInspectorBaseView 24 | 25 | @property (strong, nonatomic) NSMutableArray *inspectorViews; 26 | 27 | - (void)arrangeViews; 28 | 29 | - (void)addInspectorView:(JUInspectorView *)view expanded:(BOOL)expanded; 30 | - (void)addInspectorView:(JUInspectorView *)view atIndex:(NSInteger)index expanded:(BOOL)expanded; 31 | - (void)removeInspectorView:(JUInspectorView *)view; 32 | 33 | @end 34 | -------------------------------------------------------------------------------- /Source/JUInspectorViewContainer.m: -------------------------------------------------------------------------------- 1 | // 2 | // JUInspectorViewContainer.m 3 | // JUInspectorView 4 | // 5 | // Copyright (c) 2011 by Sidney Just 6 | // Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated 7 | // documentation files (the "Software"), to deal in the Software without restriction, including without limitation 8 | // the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, 9 | // and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 10 | // The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 11 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, 12 | // INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR 13 | // PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE 14 | // FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 15 | // ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 16 | // 17 | 18 | #import "JUInspectorViewContainer.h" 19 | #import "JUInspectorView.h" 20 | 21 | @interface JUInspectorView (JUInspectorViewPrivate) 22 | 23 | -(void)updateBounds; 24 | 25 | @end 26 | 27 | @implementation JUInspectorViewContainer 28 | 29 | #pragma mark - Init/Dealloc 30 | 31 | - (void)setupView 32 | { 33 | self.inspectorViews = [[NSMutableArray alloc] init]; 34 | } 35 | 36 | 37 | #pragma mark - NSView override 38 | 39 | - (void)setFrame:(NSRect)frameRect 40 | { 41 | [super setFrame:frameRect]; 42 | [self arrangeViews]; 43 | } 44 | 45 | - (BOOL)isFlipped 46 | { 47 | return YES; 48 | } 49 | 50 | - (void)drawRect:(NSRect)dirtyRect { 51 | [[NSColor whiteColor] set]; 52 | NSRectFill(dirtyRect); 53 | [super drawRect:dirtyRect]; 54 | } 55 | 56 | 57 | #pragma mark - Private methods 58 | 59 | - (void)updateBounds 60 | { 61 | CGFloat height = 0.0; 62 | for(JUInspectorView *view in self.inspectorViews) 63 | { 64 | height += [view frame].size.height; 65 | } 66 | 67 | NSRect frame; 68 | frame.origin = [self frame].origin; 69 | frame.size.width = [self bounds].size.width; 70 | frame.size.height = height; 71 | 72 | NSClipView *clipView = [[self enclosingScrollView] contentView]; 73 | if(clipView) 74 | { 75 | frame.size.width = [clipView documentRect].size.width; 76 | } 77 | 78 | [super setFrame:frame]; 79 | } 80 | 81 | - (void)arrangeViews 82 | { 83 | NSSortDescriptor *sortDescriptor = [NSSortDescriptor sortDescriptorWithKey:@"index" ascending:YES]; 84 | [self.inspectorViews sortUsingDescriptors:@[sortDescriptor]]; 85 | [self updateBounds]; 86 | 87 | NSRect frame = NSMakeRect(0.0, 0.0, [self bounds].size.width, 0.0); 88 | 89 | for(JUInspectorView *view in self.inspectorViews) 90 | { 91 | frame.size.height = [view frame].size.height; 92 | 93 | [view setFrame:frame]; 94 | 95 | frame.origin.y += frame.size.height; 96 | } 97 | } 98 | 99 | 100 | #pragma mark - Add/Remove Inspectors 101 | 102 | - (void)addInspectorView:(JUInspectorView *)view expanded:(BOOL)expanded 103 | { 104 | if(![self.inspectorViews containsObject:view]) 105 | { 106 | [view setContainer:self]; 107 | 108 | [self.inspectorViews addObject:view]; 109 | [self addSubview:view]; 110 | [self arrangeViews]; 111 | 112 | view.expanded=expanded; 113 | } 114 | } 115 | 116 | - (void)addInspectorView:(JUInspectorView *)view atIndex:(NSInteger)index expanded:(BOOL)expanded 117 | { 118 | [view setIndex:index]; 119 | [self addInspectorView:view expanded:expanded]; 120 | } 121 | 122 | - (void)removeInspectorView:(JUInspectorView *)view 123 | { 124 | if([self.inspectorViews containsObject:view]) 125 | { 126 | [view setContainer:self]; 127 | 128 | [self.inspectorViews removeObject:view]; 129 | [view removeFromSuperview]; 130 | [self arrangeViews]; 131 | } 132 | } 133 | 134 | 135 | 136 | @end 137 | -------------------------------------------------------------------------------- /Source/JUInspectorViewHeader.h: -------------------------------------------------------------------------------- 1 | // 2 | // JUInspectorView.h 3 | // JUInspectorView 4 | // 5 | // Copyright (c) 2011 by Sidney Just 6 | // Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated 7 | // documentation files (the "Software"), to deal in the Software without restriction, including without limitation 8 | // the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, 9 | // and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 10 | // The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 11 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, 12 | // INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR 13 | // PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE 14 | // FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 15 | // ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 16 | // 17 | 18 | @import Cocoa; 19 | #import "JUInspectorBaseView.h" 20 | 21 | @class JUInspectorViewHeader; 22 | 23 | @protocol JUInspectorViewHeaderDelegate 24 | 25 | -(void)headerClicked:(JUInspectorViewHeader *)headerView; 26 | 27 | @end 28 | 29 | @interface JUInspectorViewHeader : JUInspectorBaseView 30 | 31 | @property (weak, nonatomic) id delegate; 32 | 33 | @property (strong, nonatomic, readonly) NSButton *disclosureTriangle; 34 | @property (strong, nonatomic) NSTextField *nameField; 35 | 36 | @property (assign, nonatomic) NSInteger state; 37 | @property (weak, nonatomic) NSString *title; 38 | 39 | @end 40 | -------------------------------------------------------------------------------- /Source/JUInspectorViewHeader.m: -------------------------------------------------------------------------------- 1 | // 2 | // JUInspectorView.m 3 | // JUInspectorView 4 | // 5 | // Copyright (c) 2011 by Sidney Just 6 | // Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated 7 | // documentation files (the "Software"), to deal in the Software without restriction, including without limitation 8 | // the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, 9 | // and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 10 | // The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 11 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, 12 | // INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR 13 | // PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE 14 | // FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 15 | // ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 16 | // 17 | 18 | #import "JUInspectorViewHeader.h" 19 | 20 | @interface JUInspectorViewHeader(Private) 21 | 22 | -(void)setupView; 23 | -(void)disclosureClicked:(id)sender; 24 | 25 | @end 26 | 27 | @implementation JUInspectorViewHeader 28 | 29 | #pragma mark - Init/Dealloc 30 | 31 | - (id)initWithCoder:(NSCoder *)decoder 32 | { 33 | return [self initWithFrame:NSZeroRect]; 34 | } 35 | 36 | - (id)initWithFrame:(NSRect)frame 37 | { 38 | return [super initWithFrame:NSMakeRect(0.0, 0.0, 222.0, 40.0)]; 39 | } 40 | 41 | 42 | - (void)setupView 43 | { 44 | _disclosureTriangle = [[NSButton alloc] initWithFrame:NSMakeRect(21.0, 14.0, 13.0, 13.0)]; 45 | [self.disclosureTriangle setBezelStyle:NSDisclosureBezelStyle]; 46 | [self.disclosureTriangle setButtonType: NSPushOnPushOffButton]; 47 | [self.disclosureTriangle setTitle:nil]; 48 | [self.disclosureTriangle highlight:NO]; 49 | [self.disclosureTriangle setTarget:self]; 50 | [self.disclosureTriangle setAction:@selector(disclosureClicked:)]; 51 | 52 | self.nameField = [[NSTextField alloc] initWithFrame:NSMakeRect(38.0, 11.0, [self bounds].size.width - 8.0, 15.0)]; 53 | [self.nameField setEditable:NO]; 54 | [self.nameField setBackgroundColor:[NSColor clearColor]]; 55 | [self.nameField setBezeled:NO]; 56 | [self.nameField setFont:[NSFont boldSystemFontOfSize:11.0]]; 57 | [self.nameField setTextColor:[NSColor colorWithCalibratedRed:0.220 green:0.224 blue:0.231 alpha:1.0]]; 58 | 59 | [self addSubview:self.disclosureTriangle]; 60 | [self addSubview:self.nameField]; 61 | } 62 | 63 | 64 | #pragma mark - Properties 65 | 66 | -(NSInteger)state 67 | { 68 | return [self.disclosureTriangle state]; 69 | } 70 | 71 | - (void)setState:(NSInteger)value 72 | { 73 | [self.disclosureTriangle setState:value]; 74 | } 75 | 76 | -(NSString *)title 77 | { 78 | return [self.nameField stringValue]; 79 | } 80 | 81 | - (void)setTitle:(NSString *)value 82 | { 83 | [self.nameField setStringValue:value]; 84 | } 85 | 86 | #pragma mark - Event handling 87 | 88 | - (void)mouseUp:(NSEvent *)theEvent 89 | { 90 | [self.delegate headerClicked:self]; 91 | } 92 | 93 | 94 | -(void)disclosureClicked:(id)sender 95 | { 96 | [self.delegate headerClicked:self]; 97 | } 98 | 99 | @end 100 | -------------------------------------------------------------------------------- /screenshot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JustSid/JUInspectorView/411c1985a50769d13df48b6195caff854f1a3c0d/screenshot.png --------------------------------------------------------------------------------