Show
Ignore:
Timestamp:
01/26/09 18:54:12 (4 years ago)
Author:
isaisstillalive
Message:
  • Richエディットが一応リンクのクリックを処理するように変更。イベント名がダサすぎるので後で考える。
Files:
1 modified

Legend:

Unmodified
Added
Removed
  • lang/ruby/ruwin/lib/ruwin/edit_field/rich.rb

    r29072 r29077  
    3434        super 
    3535         
    36         sendMessage EM_SETEVENTMASK, 0, ENM_KEYEVENTS 
     36        sendMessage EM_SETEVENTMASK, 0, ENM_KEYEVENTS|ENM_LINK 
    3737         
    3838        self.background_color = @proparty[:background_color] if @proparty[:background_color] 
     
    5959      end 
    6060       
    61        
    62       def wm_notify msg, hwndFrom, idFrom, code 
    63         case code 
    64         when EN_MSGFILTER 
    65           en_msgfilter msg 
     61      notifies = { 
     62        :EN_MSGFILTER => :en_msgfilter, 
     63        :EN_LINK      => :en_link, 
     64      }.map{|command, event| "when #{command}; #{event} msg;" }.join 
     65      class_eval <<-"END" 
     66        def wm_notify msg, hwndFrom, idFrom, code 
     67          case code 
     68          #{notifies} 
     69          else 
     70            super 
     71          end 
    6672        end 
    67       end 
     73      END 
    6874       
    6975      def en_msgfilter msg 
     
    7581      end 
    7682       
     83      def en_link msg 
     84        nmhdr1, nmhdr2, nmhdr2, msg, wParam, lParam, first, last = *SWin::Application.cstruct2array(msg.lParam, "UUUUUUUU") 
     85        case msg 
     86        when WM_LBUTTONDOWN 
     87          [:link_lmousedown, first, last] 
     88        end 
     89      end 
     90       
    7791      class Multiline < Rich 
    7892        STYLE = EditField::Multiline::STYLE