class LayLabel

this file is part of manqod manqod is distributed under the CDDL licence the author of manqod is Dobai-Pataky Balint(dpblnt@gmail.com)

Attributes

text[RW]
x[RW]
y[RW]

Public Class Methods

new(text) click to toggle source
Calls superclass method
# File lib/wysiwyg-print-label.rb, line 6
        def initialize(text)
                @x=0
                @y=0
          @text=text
          @dragging=false
          @myobject=Gtk::Label.new(@text)
          super()
          add(@myobject)

#       set_events(Gdk::Event::MOTION_NOTIFY | Gdk::Event::BUTTON_MOTION_MASK)
#       set_can_focus(true)
        signal_connect('event'){|me,event|
          case event.event_type
                when Gdk::Event::BUTTON_PRESS
                  @xshift=event.x
                  @yshift=event.y
                  @dragging=true
                  get_ancestor(WysiwygPrintEditor).set_focused_item(self)
#                 set_visible_window(true)
#                 @myobject.style.base_gc(Gtk::STATE_NORMAL).background.set_red(65535)
                when Gdk::Event::MOTION_NOTIFY
                  @x=@x+event.x-@xshift if (@x+event.x-@xshift).to_i.modulo(10)==0 
                  @y=@y+event.y-@yshift if (@y+event.y-@yshift).to_i.modulo(10)==0
                  move_me
                when Gdk::Event::BUTTON_RELEASE
                  @dragging=false
#                 set_state(Gtk::STATE_NORMAL)
                else 
#                 print "unhandled: ",event.inspect,"\n"
          end
        }
        end

Public Instance Methods

modify_font(new_font) click to toggle source
Calls superclass method
# File lib/wysiwyg-print-label.rb, line 46
def modify_font(new_font)
  super(new_font)
  @myobject.modify_font(new_font)
  self
end
move_me(newx=@x,newy=@y) click to toggle source
# File lib/wysiwyg-print-label.rb, line 41
def move_me(newx=@x,newy=@y)
  @x=newx
  @y=newy
  parent.move(self)
end
set_text(newtext=@text) click to toggle source
# File lib/wysiwyg-print-label.rb, line 51
def set_text(newtext=@text)
  @text=newtext
  @myobject.text=@text
  self
end