internal static HandleRef getCPtrAndSetReference(scalebarObj obj, object parent) {
   if (obj != null)
   {
     obj.swigParentRef = parent;
     return obj.swigCPtr;
   }
   else
   {
     return new HandleRef(null, IntPtr.Zero);
   }
 }
 internal static HandleRef getCPtr(scalebarObj obj) {
   return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
 }
        /// <summary>
        /// Update the scalebar object according to the current Editor state.
        /// </summary>
        /// <param name="scalebar">The object to be updated.</param>
        private void Update(scalebarObj scalebar)
        {
            scalebar.intervals = int.Parse(textBoxIntervals.Text);
            scalebar.position = (int)comboBoxPosition.SelectedItem;
            scalebar.units = (int)comboBoxUnits.SelectedItem;

            if (comboBoxStatus.SelectedItem.ToString() == "MS_EMBED")
                scalebar.status = mapscript.MS_EMBED;
            else if (comboBoxStatus.SelectedItem.ToString() == "MS_ON")
                scalebar.status = mapscript.MS_ON;
            else if (comboBoxStatus.SelectedItem.ToString() == "MS_OFF")
                scalebar.status = mapscript.MS_OFF;

            scalebar.style = (int)comboBoxStyle.SelectedItem;

            this.colorPickerColor.ApplyTo(scalebar.color);
            this.colorPickerBackColor.ApplyTo(scalebar.backgroundcolor);
            this.colorPickerOutlineColor.ApplyTo(scalebar.outlinecolor);
            this.colorPickerImageColor.ApplyTo(scalebar.imagecolor);

            scalebar.width = int.Parse(textBoxWidth.Text);
            scalebar.height = int.Parse(textBoxHeight.Text);
        }