Class Ui::WxWidgets::Dialogs::NoteDialog
In: ui/wx/dialogs/note.rb
Parent: Wx::Dialog

Methods

author   categories=   category_id   edit_note   new   text  

Included Modules

NoteDialogInterface

Public Class methods

=============================================== public methods

[Source]

# File ui/wx/dialogs/note.rb, line 28
        def initialize(parent=nil)
          super()
          
          # TODO: think about a way of sharing this XmlResource between 
          # different wx components
          xml = Wx::XmlResource.get();
          xml.init_all_handlers();
          xml.load("ui/wx/dialogs/note.xrc")
          
          #
          # Load the dialog from XRC. We define $xml in on_init.
          # We could use XmlResource.get() over and over again, but
          # honestly, thats just too much work.
          #
          xml.load_dialog_subclass(self,parent,'ID_NOTEDIALOG')
                
          #
          # Get the buttons. Note we use 'xrcid' much like the XRCID macro
          # in C++. Make sure the id's actually exist, or your program will crash!
          #
          @author = Wx::Window.find_window_by_id(Wx::xrcid('ID_AUTHOR'),self)
          @category = Wx::Window.find_window_by_id(Wx::xrcid('ID_CATEGORY'),self)
          @text = Wx::Window.find_window_by_id(Wx::xrcid('ID_TEXT'),self)
          
          #
          # Bind the buttons to event handlers
          #
          evt_button(Wx::xrcid('wxID_OK')) do
            end_modal(Wx::ID_OK)
          end
                
          evt_button(Wx::xrcid('wxID_CANCEL')) do
            end_modal(Wx::ID_CANCEL)
          end      
        end

Public Instance methods

[Source]

# File ui/wx/dialogs/note.rb, line 64
        def author() 
          @author.get_value
        end

[Source]

# File ui/wx/dialogs/note.rb, line 74
        def categories=(category_list)
          @category.clear
          category_list.each do |c|
            id = @category.append(c.name)
            @category.set_item_data(id, c.id)
          end
          @category.set_selection(0)
        end

[Source]

# File ui/wx/dialogs/note.rb, line 67
        def category_id() 
          @category.get_item_data(@category.get_selection)
        end

[Source]

# File ui/wx/dialogs/note.rb, line 83
        def edit_note(note)
          @author.set_value(note.author)
          @text.set_value(note.text)
          @category.set_selection(note.category_id)
        end

[Source]

# File ui/wx/dialogs/note.rb, line 70
        def text() 
          @text.get_value
        end

[Validate]