SkinnedControls Plug-in for NSIS

[Expand all]  [Collapse all]

Introduction

This NSIS plug-in allows to skin all buttons and scroll bars of your installer and allows to select text colors on buttons even those on custom pages.

It was developed with an aim of integrate it in UltraModernUI, an new user interface with a style like the most recent installers for NSIS. (http://ultramodernui.sourceforge.net)

[+] Screenshots

SkinnedControls Plug-in used with Modern UI or Modern UIEx interface SkinnedControls Plug-in used with Classic UI interface SkinnedControls Plug-in used with UltraModernUI interface

Usage

SkinnedControls::skinit Function

Skins the installer's buttons and scrollbars with selected bitmaps and sets colors for texts on buttons.

Parameters:

/SetReturn
Force the method to return "success" on the stack or an error string if there was an error.
This parameter must be set first.

/scrollbar=$PLUGINSDIR\scrollbar.bmp
Scrollbar image (se below).

/button=$PLUGINSDIR\button.bmp
Button image (se below).

/disabledtextcolor=808080
Color of text when button is disabled (Format is in hex: RRGGBB as CSS colors).

/selectedtextcolor=000080
Color of text when button is being clicked (Format is in hex: RRGGBB as CSS colors).

/textcolor=000000
Color for normal state of button (Format is in hex: RRGGBB as CSS colors).

One of /scrollbar and /button parameter is required, other is optionnal.

If /SetReturn is set, the method returns "success" on the stack or an error string if there was an error.
Else, error message boxes displayed automatically.

Parameter names are now ignore case.

SkinnedControls::setskin Function

Modifiy parameter. Use the same parameters as skinit

SkinnedControls::unskinit Function

Releases the plug-in resources (usually called in the (un).onGUIEnd function). This method is now optional thanks to the new NSIS plug-in API.

[+] Usage without Modern UI

  • First, in the .onInit function, extract the button bitmap:

    Function .onInit
      InitPluginsDir
      ; Extract bitmaps for buttons and scrollbars
      File "/oname=$PLUGINSDIR\button.bmp" \
           "${NSISDIR}\Contrib\SkinnedControls\skins\defaultbtn.bmp"
      File "/oname=$PLUGINSDIR\scrollbar.bmp" \
           "${NSISDIR}\Contrib\SkinnedControls\skins\defaultsb.bmp"
    FunctionEnd
  • Second, in the .onGUIInit function, it is time to let the plug-in do the work:

    Function .onGUIInit
      SkinnedControls::skinit /NOUNLOAD \
                              /disabledtextcolor=808080 \
                              /selectedtextcolor=000080 \
                              /textcolor=000000 \
                              "/scrollbar=$PLUGINSDIR\scrollbar.bmp" \
                              "/button=$PLUGINSDIR\button.bmp"
    FunctionEnd
  • It's the same thing for the uninstaller:

    Function un.onInit
      InitPluginsDir
      File "/oname=$PLUGINSDIR\button.bmp" \
           "${NSISDIR}\Contrib\SkinnedControls\skins\defaultbtn.bmp"
      File "/oname=$PLUGINSDIR\scrollbar.bmp" \
           "${NSISDIR}\Contrib\SkinnedControls\skins\defaultsb.bmp"
    FunctionEnd
    
    Function un.onGUIInit
      SkinnedControls::skinit /NOUNLOAD \
                              /disabledtextcolor=808080 \
                              /selectedtextcolor=000080 \
                              /textcolor=000000 \
                              "/scrollbar=$PLUGINSDIR\scrollbar.bmp" \
                              "/button=$PLUGINSDIR\button.bmp"
    FunctionEnd
  • That's all!

[+] Usage with Modern UI

  • First, in the .onInit function, extract the button bitmap:

    Function .onInit
      InitPluginsDir
      ; Extract bitmaps for buttons and scrollbars
      File "/oname=$PLUGINSDIR\button.bmp" \
           "${NSISDIR}\Contrib\SkinnedControls\skins\defaultbtn.bmp"
      File "/oname=$PLUGINSDIR\scrollbar.bmp" \
           "${NSISDIR}\Contrib\SkinnedControls\skins\defaultsb.bmp"
    FunctionEnd
  • Second, create a function, for example, named myGUIInit, it is time to let the plug-in do the work:

    Function myGUIInit
      SkinnedControls::skinit /NOUNLOAD \
                              /disabledtextcolor=808080 \
                              /selectedtextcolor=000080 \
                              /textcolor=000000 \
                              "/scrollbar=$PLUGINSDIR\scrollbar.bmp" \
                              "/button=$PLUGINSDIR\button.bmp"
    FunctionEnd

    And add this line before the insertion of macro page.

    !define MUI_CUSTOMFUNCTION_GUIINIT myGUIInit
  • It's the same thing for the uninstaller:

    Function un.onInit
      InitPluginsDir
      File "/oname=$PLUGINSDIR\button.bmp" \
           "${NSISDIR}\Contrib\SkinnedControls\skins\defaultbtn.bmp"
      File "/oname=$PLUGINSDIR\scrollbar.bmp" \
           "${NSISDIR}\Contrib\SkinnedControls\skins\defaultsb.bmp"
    FunctionEnd
    
    Function un.myGUIInit
      SkinnedControls::skinit /NOUNLOAD \
                              /disabledtextcolor=808080 \
                              /selectedtextcolor=000080 \
                              /textcolor=000000 \
                              "/scrollbar=$PLUGINSDIR\scrollbar.bmp" \
                              "/button=$PLUGINSDIR\button.bmp"
    FunctionEnd

    And add this line before the insertion of macro page.

    !define MUI_CUSTOMFUNCTION_UNGUIINIT un.myGUIInit
  • That's all!

[+] Usage with UltraModernUI and ModernUIEx

UltraModernUI and ModernUIEx natively integrate the SkinnedControls plug-in.

  • With MUIEx, all you need to do is to define some stuffs before the inclusion of macro pages.
    With UMUI which enable this plug-in through its skins system, you can define the same stuffs before the UMUI_SKIN define to override default skin values:

    !define UMUI_BUTTONIMAGE_BMP \
           "${NSISDIR}\Contrib\SkinnedControls\skins\defaultbtn.bmp"
    !define UMUI_SCROLLBARIMAGE_BMP \
           "${NSISDIR}\Contrib\SkinnedControls\skins\defaultsb.bmp"
    
    !define UMUI_DISABLED_BUTTON_TEXT_COLOR 808080
    !define UMUI_SELECTED_BUTTON_TEXT_COLOR 000080
    !define UMUI_BUTTON_TEXT_COLOR 000000
  • That's all!

BITMAPS

Problems and workarounds

Example Scripts

These examples are in the NSISDir\Examples\SkinnedControls folder:

TODO

Help wanted for improve this plug-in:

  • Find better ways to fix buttons which unskin to avoid crappy workaround.
  • Support transparency for buttons.
  • Ability to skin checkboxes and radio buttons (transparency background required).
  • Ability to skin dropdown scroll bars and arrow down button.
  • Ability to skin MessageBox buttons and text and background colors.

Version History

Credits

Made by SuperPat
Based on wansis, a Plug-in written by Saivert that skins NSIS like Winamp
and use the wa_dlg.h courtesy of Nullsoft, Inc.
as well as the Cool Scrollbar Library Copyright (c) J Brown 2001.

Help

Please post questions at the Official NSIS Forum.

License

The zlib/libpng license applies to the SkinnedControls plug-in.

[+] License Terms

Copyright © 2005-2019 SuperPat
Based on wansis, a Plug-in written by Saivert that skins NSIS like Winamp
and use the wa_dlg.h courtesy of Nullsoft, Inc.
as well as the Cool Scrollbar Library Copyright © J Brown 2001.
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute
it freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented;
   you must not claim that you wrote the original software.
   If you use this software in a product, an acknowledgment in the
   product documentation would be appreciated but is not required.
2. Altered versions must be plainly marked as such,
   and must not be misrepresented as being the original software.
3. This notice may not be removed or altered from any distribution.