Added file chooser

This commit is contained in:
Tristan B. Kildaire 2020-10-28 08:52:00 +02:00
parent d10c8f1c3c
commit 95f36698f7
1 changed files with 21 additions and 1 deletions

View File

@ -95,11 +95,24 @@ public final class Channel
ScrolledWindow scrollTextChats = new ScrolledWindow(textArea);
textBox.add(scrollTextChats);
/* The Box for the whole |attach button| text field| send button| */
Box textInputBox = new Box(GtkOrientation.HORIZONTAL, 1);
import gtk.Image;
/* The attachment button */
Button attachFileButton = new Button("Upload");
Image attachFileButtonIcon = new Image("user-available", GtkIconSize.BUTTON); /* TODO: Fix icon now showing */
attachFileButton.setImage(attachFileButtonIcon);
attachFileButton.addOnClicked(&uploadFileDialog);
textInputBox.add(attachFileButton);
/* The text input */
textInput = new Entry();
textInput.addOnActivate(&sendMessageEnter);
textInput.addOnChanged(&textChangd);
Box textInputBox = new Box(GtkOrientation.HORIZONTAL, 1);
textInputBox.packStart(textInput,1,1,0);
@ -117,6 +130,13 @@ public final class Channel
}
private void uploadFileDialog(Button e)
{
import gtk.FileChooserDialog; /* TODO: Set parent */
FileChooserDialog fileChooser = new FileChooserDialog("Send file to "~channelName, null, FileChooserAction.OPEN);
fileChooser.run();
}
import gtk.EditableIF;
private void textChangd(EditableIF)
{