miuler-blacknote / src / main / scala / com / miuler / blacknote / BlackNote.scala

package com.miuler.blacknote

import org.gnome.gdk.Event
import org.gnome.gtk.Window.DeleteEvent
import org.gnome.gtk.Button
import org.gnome.gtk.ComboBox
import org.gnome.gtk.Entry
import org.gnome.gtk.Gtk
import org.gnome.gtk.HBox
import org.gnome.gtk.Label
import org.gnome.gtk.ListStore
import org.gnome.gtk.VBox
import org.gnome.gtk.Widget
import org.gnome.gtk.Window
import Events.newMethodEventsToWindow
import org.gnome.gtk.DataColumnString
import org.gnome.gtk.DataColumn
import org.gnome.gtk.CellRendererText

class WindowConnect(window: Window) {

  def connect2 (eventType: AnyRef, function: (Widget, Event)=>Boolean) {
    val deleteEvent = classOf[Window.DeleteEvent]
    eventType match {
      case deleteEvent => {
        window.connect(new Window.DeleteEvent() {
          def onDeleteEvent(source: Widget, event: Event) = function(source, event)


object Events {
  implicit def newMethodEventsToWindow(window: Window) : WindowConnect = new WindowConnect(window)

class BlackNote() extends Window {
  val nombre = "Miuler"
  def initWindow() {
    // ------------------------------------------------------------------------
    this.setDefaultSize(300, 200)
    val vBox = new VBox(false, 0)
    val hBox = new HBox(false, 20)
    // ------------------------------------------------------------------------
    hBox.add(new Label("Buscar :"))
    // ------------------------------------------------------------------------
    val firstColumnString = new DataColumnString()
    val columns = Array[DataColumn](firstColumnString)
    val model = new ListStore(columns)
    val entry = new Entry()
    val comboBox = new ComboBox(model, entry)
    val cellRendererText = new CellRendererText(comboBox)
    // ------------------------------------------------------------------------
    var row = model.appendRow()
    model.setValue(row, firstColumnString, "Miuler1")
    row = model.appendRow()
    model.setValue(row, firstColumnString, "Miuler2")
    // ------------------------------------------------------------------------
    val button = new Button("clickeame")
    vBox.add(new Button("clickeame1"))
    vBox.add(new Button("clickeame2"))
    this.connect2(classOf[Window.DeleteEvent], onDeleteEvent)

    showAll ()
  def onDeleteEvent (source: Widget, event: Event) = {
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.