OSDN Git Service

AtIdSupplementをハッシュタグでも使えるように修正
[opentween/open-tween.git] / Tween / AtIdSupplement.vb
index b403d91..38d9dbd 100644 (file)
@@ -1,15 +1,16 @@
 Public Class AtIdSupplement
 
-    Public inputId As String = ""
+    Public inputText As String = ""
     Public isBack As Boolean = False
+    Private startChar As String = ""
 
-    Public Sub AddId(ByVal id As String)
+    Public Sub AddItem(ByVal id As String)
         If Not Me.TextId.AutoCompleteCustomSource.Contains(id) Then
             Me.TextId.AutoCompleteCustomSource.Add(id)
         End If
     End Sub
 
-    Public Function GetIdList() As List(Of String)
+    Public Function GetItemList() As List(Of String)
         Dim ids As New List(Of String)
         For i As Integer = 0 To Me.TextId.AutoCompleteCustomSource.Count - 1
             ids.Add(Me.TextId.AutoCompleteCustomSource(i))
@@ -17,19 +18,19 @@ Public Class AtIdSupplement
         Return ids
     End Function
 
-    Public ReadOnly Property IdCount() As Integer
+    Public ReadOnly Property ItemCount() As Integer
         Get
             Return Me.TextId.AutoCompleteCustomSource.Count
         End Get
     End Property
 
     Private Sub ButtonOK_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonOK.Click
-        inputId = Me.TextId.Text
+        inputText = Me.TextId.Text
         isBack = False
     End Sub
 
     Private Sub ButtonCancel_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonCancel.Click
-        inputId = ""
+        inputText = ""
         isBack = False
     End Sub
 
@@ -39,12 +40,12 @@ Public Class AtIdSupplement
         '    Me.Close()
         'End If
         If e.KeyCode = Keys.Back AndAlso Me.TextId.Text = "" Then
-            inputId = ""
+            inputText = ""
             isBack = True
             Me.Close()
         End If
         If e.KeyCode = Keys.Space OrElse e.KeyCode = Keys.Tab Then
-            inputId = Me.TextId.Text + " "
+            inputText = Me.TextId.Text + " "
             isBack = False
             Me.Close()
         End If
@@ -60,11 +61,11 @@ Public Class AtIdSupplement
     End Sub
 
     Private Sub AtIdSupplement_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
-        Me.Height = Me.TextId.Height + SystemInformation.ToolWindowCaptionHeight + Me.TextId.Margin.Top
+        Me.Height = Me.TextId.Height + SystemInformation.ToolWindowCaptionHeight + Me.TextId.Margin.Top + Me.Label1.Height
     End Sub
 
     Private Sub AtIdSupplement_Shown(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Shown
-        TextId.Text = "@"
+        TextId.Text = startChar
         TextId.SelectionStart = 1
     End Sub
 
@@ -77,21 +78,23 @@ Public Class AtIdSupplement
 
     End Sub
 
-    Public Sub New(ByVal IdList As List(Of String))
+    Public Sub New(ByVal ItemList As List(Of String), ByVal startCharacter As String)
 
         ' \82±\82Ì\8cÄ\82Ñ\8fo\82µ\82Í\81AWindows \83t\83H\81[\83\80 \83f\83U\83C\83i\82Å\95K\97v\82Å\82·\81B
         InitializeComponent()
 
         ' InitializeComponent() \8cÄ\82Ñ\8fo\82µ\82Ì\8cã\82Å\8f\89\8aú\89»\82ð\92Ç\89Á\82µ\82Ü\82·\81B
 
-        For i As Integer = 0 To IdList.Count - 1
-            Me.TextId.AutoCompleteCustomSource.Add(IdList(i))
+        For i As Integer = 0 To ItemList.Count - 1
+            Me.TextId.AutoCompleteCustomSource.Add(ItemList(i))
         Next
+        startChar = startCharacter
+
     End Sub
 
     Private Sub TextId_PreviewKeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.PreviewKeyDownEventArgs) Handles TextId.PreviewKeyDown
         If e.KeyCode = Keys.Tab Then
-            inputId = Me.TextId.Text + " "
+            inputText = Me.TextId.Text + " "
             isBack = False
             Me.Close()
         End If