Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
base fork: erkyrath/iosglk
base: 5f4192b8a6
...
head fork: erkyrath/iosglk
compare: 321dc79f88
  • 3 commits
  • 9 files changed
  • 0 commit comments
  • 1 contributor
View
9 AppSrc/CmdTextField.h
@@ -10,13 +10,17 @@
@class StyleSet;
@interface CmdTextField : UITextField {
+ UIView *rightsideview;
+ UIButton *clearbutton;
UIButton *menubutton;
BOOL singlechar;
NSNumber *wintag;
}
-@property (nonatomic, retain) UIButton *menubutton;
+@property (nonatomic, retain) IBOutlet UIView *rightsideview;
+@property (nonatomic, retain) IBOutlet UIButton *clearbutton;
+@property (nonatomic, retain) IBOutlet UIButton *menubutton;
@property (nonatomic, retain) NSNumber *wintag;
- (void) setUpForWindow:(GlkWindowView *)winv singleChar:(BOOL)singleChar;
@@ -24,4 +28,7 @@
- (BOOL) singleChar;
- (void) applyInputString:(NSString *)cmd replace:(BOOL)replace;
+- (IBAction) handleMenuButton:(id)sender;
+- (IBAction) handleClearButton:(id)sender;
+
@end
View
35 AppSrc/CmdTextField.m
@@ -16,19 +16,21 @@
@implementation CmdTextField
+@synthesize rightsideview;
+@synthesize clearbutton;
@synthesize menubutton;
@synthesize wintag;
- (id) initWithFrame:(CGRect)frame {
self = [super initWithFrame:frame];
if (self) {
- self.menubutton = [UIButton buttonWithType:UIButtonTypeRoundedRect];
- [menubutton addTarget:self action:@selector(handleMenuButton:) forControlEvents:UIControlEventTouchUpInside];
}
return self;
}
- (void) dealloc {
+ self.rightsideview = nil;
+ self.clearbutton = nil;
self.menubutton = nil;
self.wintag = nil;
[super dealloc];
@@ -39,19 +41,19 @@ - (BOOL) becomeFirstResponder {
if (!res)
return NO;
+ rightsideview.hidden = NO;
[[IosGlkViewController singleton] preferInputWindow:wintag];
return YES;
}
-/*
- (BOOL) resignFirstResponder {
BOOL res = [super resignFirstResponder];
if (!res)
return NO;
+ rightsideview.hidden = YES;
return YES;
}
- */
- (void) setUpForWindow:(GlkWindowView *)winv singleChar:(BOOL)singleval {
GlkWindowState *win = winv.winstate;
@@ -65,14 +67,25 @@ - (void) setUpForWindow:(GlkWindowView *)winv singleChar:(BOOL)singleval {
self.autocapitalizationType = UITextAutocapitalizationTypeNone;
self.keyboardType = UIKeyboardTypeASCIICapable;
- //self.clearButtonMode = UITextFieldViewModeWhileEditing;
if (singlechar) {
+ //self.clearButtonMode = UITextFieldViewModeNever;
self.rightViewMode = UITextFieldViewModeNever;
self.rightView = nil;
}
else {
- self.rightViewMode = UITextFieldViewModeWhileEditing;
- self.rightView = self.menubutton;
+ [[NSBundle mainBundle] loadNibNamed:@"TextFieldRightView" owner:self options:nil];
+ UIImage *img;
+ img = [menubutton backgroundImageForState:UIControlStateNormal];
+ img = [img stretchableImageWithLeftCapWidth:img.size.width/2 topCapHeight:img.size.height/2];
+ [menubutton setBackgroundImage:img forState:UIControlStateNormal];
+ img = [clearbutton backgroundImageForState:UIControlStateNormal];
+ img = [img stretchableImageWithLeftCapWidth:img.size.width/2 topCapHeight:img.size.height/2];
+ [clearbutton setBackgroundImage:img forState:UIControlStateNormal];
+ rightsideview.hidden = ![self isFirstResponder];
+
+ //self.clearButtonMode = UITextFieldViewModeWhileEditing;
+ self.rightViewMode = UITextFieldViewModeAlways;
+ self.rightView = self.rightsideview;
}
if (win.line_request && win.line_request_initial)
@@ -103,7 +116,13 @@ - (BOOL) singleChar {
}
- (CGRect) rightViewRectForBounds:(CGRect)bounds {
- return CGRectMake(bounds.size.width-48, 0, 48, bounds.size.height);
+ return CGRectMake(bounds.size.width-96, 0, 96, bounds.size.height);
+}
+
+- (void) handleClearButton:(id)sender {
+ if (singlechar)
+ return;
+ self.text = @"";
}
- (void) handleMenuButton:(id)sender {
View
BIN  Media/button-input-back.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  Media/button-input-back@2x.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  Media/button-input-clear.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  Media/button-input-clear@2x.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  Media/button-input-menu.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  Media/button-input-menu@2x.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
286 Resources/TextFieldRightView.xib
@@ -0,0 +1,286 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<archive type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="8.00">
+ <data>
+ <int key="IBDocument.SystemTarget">1296</int>
+ <string key="IBDocument.SystemVersion">11D50</string>
+ <string key="IBDocument.InterfaceBuilderVersion">2182</string>
+ <string key="IBDocument.AppKitVersion">1138.32</string>
+ <string key="IBDocument.HIToolboxVersion">568.00</string>
+ <object class="NSMutableDictionary" key="IBDocument.PluginVersions">
+ <string key="NS.key.0">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
+ <string key="NS.object.0">1181</string>
+ </object>
+ <array key="IBDocument.IntegratedClassDependencies">
+ <string>IBProxyObject</string>
+ <string>IBUIView</string>
+ <string>IBUIButton</string>
+ </array>
+ <array key="IBDocument.PluginDependencies">
+ <string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
+ </array>
+ <object class="NSMutableDictionary" key="IBDocument.Metadata">
+ <string key="NS.key.0">PluginDependencyRecalculationVersion</string>
+ <integer value="1" key="NS.object.0"/>
+ </object>
+ <array class="NSMutableArray" key="IBDocument.RootObjects" id="1000">
+ <object class="IBProxyObject" id="372490531">
+ <string key="IBProxiedObjectIdentifier">IBFilesOwner</string>
+ <string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
+ </object>
+ <object class="IBProxyObject" id="975951072">
+ <string key="IBProxiedObjectIdentifier">IBFirstResponder</string>
+ <string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
+ </object>
+ <object class="IBUIView" id="191373211">
+ <reference key="NSNextResponder"/>
+ <int key="NSvFlags">274</int>
+ <array class="NSMutableArray" key="NSSubviews">
+ <object class="IBUIButton" id="1020233147">
+ <reference key="NSNextResponder" ref="191373211"/>
+ <int key="NSvFlags">276</int>
+ <string key="NSFrameSize">{48, 25}</string>
+ <reference key="NSSuperview" ref="191373211"/>
+ <reference key="NSWindow"/>
+ <reference key="NSNextKeyView" ref="814533386"/>
+ <string key="NSReuseIdentifierKey">_NS:9</string>
+ <bool key="IBUIOpaque">NO</bool>
+ <string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
+ <int key="IBUIContentHorizontalAlignment">0</int>
+ <int key="IBUIContentVerticalAlignment">0</int>
+ <object class="NSColor" key="IBUIHighlightedTitleColor" id="623065345">
+ <int key="NSColorSpace">3</int>
+ <bytes key="NSWhite">MQA</bytes>
+ </object>
+ <object class="NSColor" key="IBUINormalTitleColor">
+ <int key="NSColorSpace">1</int>
+ <bytes key="NSRGB">MC4xOTYwNzg0MzE0IDAuMzA5ODAzOTIxNiAwLjUyMTU2ODYyNzUAA</bytes>
+ </object>
+ <object class="NSColor" key="IBUINormalTitleShadowColor" id="896087377">
+ <int key="NSColorSpace">3</int>
+ <bytes key="NSWhite">MC41AA</bytes>
+ </object>
+ <object class="NSCustomResource" key="IBUINormalImage">
+ <string key="NSClassName">NSImage</string>
+ <string key="NSResourceName">button-input-clear.png</string>
+ </object>
+ <object class="NSCustomResource" key="IBUISelectedBackgroundImage" id="728774252">
+ <string key="NSClassName">NSImage</string>
+ <string key="NSResourceName">button-tab-sel.png</string>
+ </object>
+ <object class="NSCustomResource" key="IBUINormalBackgroundImage" id="175814288">
+ <string key="NSClassName">NSImage</string>
+ <string key="NSResourceName">button-input-back.png</string>
+ </object>
+ <object class="IBUIFontDescription" key="IBUIFontDescription" id="888546427">
+ <int key="type">2</int>
+ <double key="pointSize">14</double>
+ </object>
+ <object class="NSFont" key="IBUIFont" id="100659403">
+ <string key="NSName">Helvetica-Bold</string>
+ <double key="NSSize">14</double>
+ <int key="NSfFlags">16</int>
+ </object>
+ </object>
+ <object class="IBUIButton" id="814533386">
+ <reference key="NSNextResponder" ref="191373211"/>
+ <int key="NSvFlags">275</int>
+ <string key="NSFrame">{{48, 0}, {48, 25}}</string>
+ <reference key="NSSuperview" ref="191373211"/>
+ <reference key="NSWindow"/>
+ <string key="NSReuseIdentifierKey">_NS:9</string>
+ <bool key="IBUIOpaque">NO</bool>
+ <string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
+ <int key="IBUIContentHorizontalAlignment">0</int>
+ <int key="IBUIContentVerticalAlignment">0</int>
+ <reference key="IBUIHighlightedTitleColor" ref="623065345"/>
+ <object class="NSColor" key="IBUINormalTitleColor">
+ <int key="NSColorSpace">1</int>
+ <bytes key="NSRGB">MC4xOTYwNzg0MzE0IDAuMzA5ODAzOTIxNiAwLjUyMTU2ODYyNzUAA</bytes>
+ </object>
+ <reference key="IBUINormalTitleShadowColor" ref="896087377"/>
+ <object class="NSCustomResource" key="IBUINormalImage">
+ <string key="NSClassName">NSImage</string>
+ <string key="NSResourceName">button-input-menu.png</string>
+ </object>
+ <reference key="IBUISelectedBackgroundImage" ref="728774252"/>
+ <reference key="IBUINormalBackgroundImage" ref="175814288"/>
+ <reference key="IBUIFontDescription" ref="888546427"/>
+ <reference key="IBUIFont" ref="100659403"/>
+ </object>
+ </array>
+ <string key="NSFrameSize">{96, 25}</string>
+ <reference key="NSSuperview"/>
+ <reference key="NSWindow"/>
+ <reference key="NSNextKeyView" ref="1020233147"/>
+ <object class="NSColor" key="IBUIBackgroundColor">
+ <int key="NSColorSpace">3</int>
+ <bytes key="NSWhite">MCAwAA</bytes>
+ </object>
+ <bool key="IBUIOpaque">NO</bool>
+ <string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
+ </object>
+ </array>
+ <object class="IBObjectContainer" key="IBDocument.Objects">
+ <array class="NSMutableArray" key="connectionRecords">
+ <object class="IBConnectionRecord">
+ <object class="IBCocoaTouchOutletConnection" key="connection">
+ <string key="label">rightsideview</string>
+ <reference key="source" ref="372490531"/>
+ <reference key="destination" ref="191373211"/>
+ </object>
+ <int key="connectionID">17</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBCocoaTouchOutletConnection" key="connection">
+ <string key="label">clearbutton</string>
+ <reference key="source" ref="372490531"/>
+ <reference key="destination" ref="1020233147"/>
+ </object>
+ <int key="connectionID">18</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBCocoaTouchOutletConnection" key="connection">
+ <string key="label">menubutton</string>
+ <reference key="source" ref="372490531"/>
+ <reference key="destination" ref="814533386"/>
+ </object>
+ <int key="connectionID">19</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBCocoaTouchEventConnection" key="connection">
+ <string key="label">handleMenuButton:</string>
+ <reference key="source" ref="814533386"/>
+ <reference key="destination" ref="372490531"/>
+ <int key="IBEventType">7</int>
+ </object>
+ <int key="connectionID">21</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBCocoaTouchEventConnection" key="connection">
+ <string key="label">handleClearButton:</string>
+ <reference key="source" ref="1020233147"/>
+ <reference key="destination" ref="372490531"/>
+ <int key="IBEventType">7</int>
+ </object>
+ <int key="connectionID">20</int>
+ </object>
+ </array>
+ <object class="IBMutableOrderedSet" key="objectRecords">
+ <array key="orderedObjects">
+ <object class="IBObjectRecord">
+ <int key="objectID">0</int>
+ <array key="object" id="0"/>
+ <reference key="children" ref="1000"/>
+ <nil key="parent"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">1</int>
+ <reference key="object" ref="191373211"/>
+ <array class="NSMutableArray" key="children">
+ <reference ref="814533386"/>
+ <reference ref="1020233147"/>
+ </array>
+ <reference key="parent" ref="0"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">-1</int>
+ <reference key="object" ref="372490531"/>
+ <reference key="parent" ref="0"/>
+ <string key="objectName">File's Owner</string>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">-2</int>
+ <reference key="object" ref="975951072"/>
+ <reference key="parent" ref="0"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">11</int>
+ <reference key="object" ref="1020233147"/>
+ <reference key="parent" ref="191373211"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">10</int>
+ <reference key="object" ref="814533386"/>
+ <reference key="parent" ref="191373211"/>
+ </object>
+ </array>
+ </object>
+ <dictionary class="NSMutableDictionary" key="flattenedProperties">
+ <string key="-1.CustomClassName">CmdTextField</string>
+ <string key="-1.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
+ <string key="-2.CustomClassName">UIResponder</string>
+ <string key="-2.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
+ <string key="1.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
+ <string key="10.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
+ <real value="0.0" key="10.IBUIButtonInspectorSelectedStateConfigurationMetadataKey"/>
+ <string key="11.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
+ <real value="0.0" key="11.IBUIButtonInspectorSelectedStateConfigurationMetadataKey"/>
+ </dictionary>
+ <dictionary class="NSMutableDictionary" key="unlocalizedProperties"/>
+ <nil key="activeLocalization"/>
+ <dictionary class="NSMutableDictionary" key="localizations"/>
+ <nil key="sourceID"/>
+ <int key="maxID">21</int>
+ </object>
+ <object class="IBClassDescriber" key="IBDocument.Classes">
+ <array class="NSMutableArray" key="referencedPartialClassDescriptions">
+ <object class="IBPartialClassDescription">
+ <string key="className">CmdTextField</string>
+ <string key="superclassName">UITextField</string>
+ <dictionary class="NSMutableDictionary" key="actions">
+ <string key="handleClearButton:">id</string>
+ <string key="handleMenuButton:">id</string>
+ </dictionary>
+ <dictionary class="NSMutableDictionary" key="actionInfosByName">
+ <object class="IBActionInfo" key="handleClearButton:">
+ <string key="name">handleClearButton:</string>
+ <string key="candidateClassName">id</string>
+ </object>
+ <object class="IBActionInfo" key="handleMenuButton:">
+ <string key="name">handleMenuButton:</string>
+ <string key="candidateClassName">id</string>
+ </object>
+ </dictionary>
+ <dictionary class="NSMutableDictionary" key="outlets">
+ <string key="clearbutton">UIButton</string>
+ <string key="menubutton">UIButton</string>
+ <string key="rightsideview">UIView</string>
+ </dictionary>
+ <dictionary class="NSMutableDictionary" key="toOneOutletInfosByName">
+ <object class="IBToOneOutletInfo" key="clearbutton">
+ <string key="name">clearbutton</string>
+ <string key="candidateClassName">UIButton</string>
+ </object>
+ <object class="IBToOneOutletInfo" key="menubutton">
+ <string key="name">menubutton</string>
+ <string key="candidateClassName">UIButton</string>
+ </object>
+ <object class="IBToOneOutletInfo" key="rightsideview">
+ <string key="name">rightsideview</string>
+ <string key="candidateClassName">UIView</string>
+ </object>
+ </dictionary>
+ <object class="IBClassDescriptionSource" key="sourceIdentifier">
+ <string key="majorKey">IBProjectSource</string>
+ <string key="minorKey">./Classes/CmdTextField.h</string>
+ </object>
+ </object>
+ </array>
+ </object>
+ <int key="IBDocument.localizationMode">0</int>
+ <string key="IBDocument.TargetRuntimeIdentifier">IBCocoaTouchFramework</string>
+ <object class="NSMutableDictionary" key="IBDocument.PluginDeclaredDependencyDefaults">
+ <string key="NS.key.0">com.apple.InterfaceBuilder.CocoaTouchPlugin.iPhoneOS</string>
+ <real value="1296" key="NS.object.0"/>
+ </object>
+ <bool key="IBDocument.PluginDeclaredDependenciesTrackSystemTargetVersion">YES</bool>
+ <int key="IBDocument.defaultPropertyAccessControl">3</int>
+ <dictionary class="NSMutableDictionary" key="IBDocument.LastKnownImageSizes">
+ <string key="button-input-back.png">{14, 14}</string>
+ <string key="button-input-clear.png">{14, 14}</string>
+ <string key="button-input-menu.png">{14, 14}</string>
+ <string key="button-tab-sel.png">{50, 25}</string>
+ </dictionary>
+ <string key="IBCocoaTouchPluginVersion">1181</string>
+ </data>
+</archive>

No commit comments for this range

Something went wrong with that request. Please try again.