diff options
Diffstat (limited to 'lib/lib/innerwindow.tcl')
-rw-r--r--[-rwxr-xr-x] | lib/lib/innerwindow.tcl | 54 |
1 files changed, 33 insertions, 21 deletions
diff --git a/lib/lib/innerwindow.tcl b/lib/lib/innerwindow.tcl index f1d2505..4195e2d 100755..100644 --- a/lib/lib/innerwindow.tcl +++ b/lib/lib/innerwindow.tcl @@ -2,7 +2,7 @@ # Part of MCU 8051 IDE ( http://mcu8051ide.sf.net ) ############################################################################ -# Copyright (C) 2007-2009 by Martin Ošmera # +# Copyright (C) 2007, 2008, 2009, 2010, 2011, 2012 by Martin Ošmera # # martin.osmera@gmail.com # # # # This program is free software; you can redistribute it and#or modify # @@ -21,6 +21,11 @@ # 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # ############################################################################ +# >>> File inclusion guard +if { ! [ info exists _INNERWINDOW_TCL ] } { +set _INNERWINDOW_TCL _ +# <<< File inclusion guard + # -------------------------------------------------------------------------- # DESCRIPTION @@ -87,7 +92,7 @@ class InnerWindow { ttk::style map InnerWindow_Active.TButton \ -background [list active $active_titclr] \ -relief [list active raised] - + ttk::style configure InnerWindow_Inactive.TButton \ -background $inactive_titclr \ -padding 0 \ @@ -96,7 +101,7 @@ class InnerWindow { ttk::style map InnerWindow_Inactive.TButton \ -background [list active $inactive_titclr] \ -relief [list active raised] - + # Set object variables set max_X 1000 set max_Y 1000 @@ -201,27 +206,27 @@ class InnerWindow { } ## Get and/or set window geometry including frame and title bar - # @parm Int = {} - Width - # @parm Int = {} - Height - # @parm Int = {} - Relative position -- X - # @parm Int = {} - Relative position -- Y + # @parm Int w={} - Width + # @parm Int h={} - Height + # @parm Int x={} - Relative position -- X + # @parm Int y={} - Relative position -- Y # Note: If you want to set only certain attributes then set others as {} # @return Current window geometry {W H X Y} - public method geometry args { + public method geometry {{w {}} {h {}} {x {}} {y {}}} { # Set geometry - if {[llength $args]} { - if {[string length [lindex $args 0]]} { - place $win -width [lindex $args 0] + if {$w != {} || $h != {} || $x != {} || $y != {}} { + if {[string length $w]} { + place $win -width $w } - if {[string length [lindex $args 1]]} { - place $win -height [lindex $args 1] - set win_height [lindex $args 1] + if {[string length $h]} { + place $win -height $h + set win_height $h } - if {[string length [lindex $args 2]]} { - place $win -x [lindex $args 2] + if {[string length $x]} { + place $win -x $x } - if {[string length [lindex $args 3]]} { - place $win -y [lindex $args 3] + if {[string length $y]} { + place $win -y $y } update } @@ -252,6 +257,10 @@ class InnerWindow { ## Event handler: window frame <FocusOut> # @return void public method focusout {} { + if {![winfo exists $win]} { + return + } + update foreach widget [list $title_bar $title_label $win] { $widget configure -bg $inactive_titclr @@ -259,7 +268,6 @@ class InnerWindow { foreach widget [list $close_button $coll_exp_but] { $widget configure -style InnerWindow_Inactive.TButton } - update } @@ -275,7 +283,7 @@ class InnerWindow { pack forget $main_frame place $win -height [expr {[winfo height $win.title_bar] + 4}] # Unshade - } { + } else { set image _1uparrow pack $main_frame -fill both -expand 1 place $win -height $win_height @@ -335,7 +343,7 @@ class InnerWindow { focus $win if {!$menu_created} { - menuFactory $MENU $menu 0 "$this " 0 {} + menuFactory $MENU $menu 0 "$this " 0 {} [namespace current] set menu_created 1 } @@ -358,3 +366,7 @@ class InnerWindow { } } } + +# >>> File inclusion guard +} +# <<< File inclusion guard |