preview-widgets.ss
#lang scheme/gui

;; ##################################################################################
;; # ============================================================================== #
;; # preview-widgets.ss                                                             #
;; # http://mred-designer.origo.ethz.ch                                             #
;; # Copyright (C) Laurent Orseau, 2010                                             #
;; # ============================================================================== #
;; #                                                                                #
;; # This program is free software; you can redistribute it and/or                  #
;; # modify it under the terms of the GNU General Public License                    #
;; # as published by the Free Software Foundation; either version 2                 #
;; # of the License, or (at your option) any later version.                         #
;; #                                                                                #
;; # This program is distributed in the hope that it will be useful,                #
;; # but WITHOUT ANY WARRANTY; without even the implied warranty of                 #
;; # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the                  #
;; # GNU General Public License for more details.                                   #
;; #                                                                                #
;; # You should have received a copy of the GNU General Public License              #
;; # along with this program; if not, write to the Free Software                    #
;; # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.    #
;; #                                                                                #
;; ##################################################################################

(require "mreddesigner-misc.ss"
         "properties.ss"
         )


(define current-mred-id #f)
(define/provide (get-current-mred-id) current-mred-id)
(define/provide (set-current-mred-id mid)
  ;(printf "current widget set:~a\n" (send mid get-id))
  (set! current-mred-id mid))


;; Returns a duplicata of the given widget with all its properties and id.
(define/provide-mock (duplicate-widget w parent)
  (make-widget (send w get-plugin) parent (send w get-properties)))

; should be in another file?
(define/provide (select-mred-id mid)
  (set-current-mred-id mid)
  ;(printf "(select-mred-id ~a)\n" (send mid get-id))
  )

(define/provide-mock (replace-widget mid)
  (send mid replace-widget))

;(define/provide (delete-mred-id mred-id)
;  (send mred-id delete))