XMouse Button Control (XMBC) allows you to create application and window specific profiles. This in turn, allows you to re-configure your mouse behaviour for individual applications or windows. For each profile you can also configure up to 5 'layers' of different button configurations which you can switch between using hot-keys or mouse buttons.

By default, profiles are automatically activated as the mouse moves over the defined window or application.
This has many uses, for example: Learn more.