# This file should be processed using FvwmM4 like:
#   ModuleSynchronous FvwmM4 -lock -m4-squote {{ -m4-equote }} \
#     -DBcN=1 -DBmN=2 -DBoN=3 -DBiN=4 -DBlN=5 -DBrN=6 buttons

# Button roles used: Options, Close, Maximize, Iconify, Stick,
# ShadeUp, ShadeDown; and pseudo buttons: TitleLeft, TitleRight

FuncFvwmDecorBackground

# override the colors titlestyle
# warning $. expand to FVWM_USERDIR with FvwmM4, so you a path to the
# decor images which should work ...
TitleStyle \
	ActiveUp   (TiledPixmap ../themes/nanogui/images/decor/title-activeup.xpm) \
	ActiveDown (TiledPixmap ../themes/nanogui/images/decor/title-activedown.xpm) \
	Inactive   (TiledPixmap ../themes/nanogui/images/decor/title-inactive.xpm)

# m4 misinterpreters '#', so use 'Nop'
define({{BcC}}, ifdef({{BcN}}, {{}}, {{Nop}}))
define({{BmC}}, ifdef({{BmN}}, {{}}, {{Nop}}))
define({{BoC}}, ifdef({{BoN}}, {{}}, {{Nop}}))
define({{BiC}}, ifdef({{BiN}}, {{}}, {{Nop}}))
define({{BsC}}, ifdef({{BsN}}, {{}}, {{Nop}}))
define({{BuC}}, ifdef({{BuN}}, {{}}, {{Nop}}))
define({{BdC}}, ifdef({{BdN}}, {{}}, {{Nop}}))
define({{BlC}}, ifdef({{BlN}}, {{}}, {{Nop}}))
define({{BrC}}, ifdef({{BrN}}, {{}}, {{Nop}}))

BcC Style "*" Button BcN
BmC Style "*" Button BmN
BoC Style "*" Button BoN
BiC Style "*" Button BiN
BsC Style "*" Button BsN
BuC Style "*" Button BuN
BdC Style "*" Button BdN
BlC Style "*" Button BlN
BrC Style "*" Button BrN
Style "*" FvwmButtons  # button relief does not follow the state

BoC ButtonStyle BoN \
BoC	ActiveUp   (Pixmap button/options-activeup.xpm) \
BoC	ActiveDown (Pixmap button/options-activedown.xpm) \
BoC	Inactive   (Pixmap button/options-inactive.xpm)
BcC ButtonStyle BcN \
BcC	ActiveUp   (Pixmap button/close-activeup.xpm) \
BcC	ActiveDown (Pixmap button/close-activedown.xpm) \
BcC	Inactive   (Pixmap button/close-inactive.xpm)
BmC ButtonStyle BmN \
BmC	ActiveUp   (Pixmap button/maximize-activeup.xpm) \
BmC	ActiveDown (Pixmap button/maximize-activedown.xpm) \
BmC	Inactive   (Pixmap button/maximize-inactive.xpm)
BiC ButtonStyle BiN \
BiC	ActiveUp   (Pixmap button/iconify-activeup.xpm) \
BiC	ActiveDown (Pixmap button/iconify-activedown.xpm) \
BiC	Inactive   (Pixmap button/iconify-inactive.xpm)
BsC ButtonStyle BsN \
BsC	ActiveUp   (Pixmap button/stick-activeup.xpm) \
BsC	ActiveDown (Pixmap button/stick-activedown.xpm) \
BsC	Inactive   (Pixmap button/stick-inactive.xpm)
BuC ButtonStyle BuN \
BuC	ActiveUp   (Pixmap button/shadeup-activeup.xpm) \
BuC	ActiveDown (Pixmap button/shadeup-activedown.xpm) \
BuC	Inactive   (Pixmap button/shadeup-inactive.xpm)
BdC ButtonStyle BdN \
BdC	ActiveUp   (Pixmap button/shadedown-activeup.xpm) \
BdC	ActiveDown (Pixmap button/shadedown-activedown.xpm) \
BdC	Inactive   (Pixmap button/shadedown-inactive.xpm)
BlC ButtonStyle BlN \
BlC	ActiveUp   (Pixmap button/titleleft-activeup.xpm) \
BlC	ActiveDown (Pixmap button/titleleft-activedown.xpm) \
BlC	Inactive   (Pixmap button/titleleft-inactive.xpm)
BrC ButtonStyle BrN \
BrC	ActiveUp   (Pixmap button/titleright-activeup.xpm) \
BrC	ActiveDown (Pixmap button/titleright-activedown.xpm) \
BrC	Inactive   (Pixmap button/titleright-inactive.xpm)

ButtonStyle All - Clear
BmC ButtonStyle BmN - MWMDecorMax
BoC ButtonStyle BoN - MWMDecorMenu
BiC ButtonStyle BiN - MWMDecorMin
BuC ButtonStyle BuN - MWMDecorShade
BdC ButtonStyle BdN - MWMDecorShade
BsC ButtonStyle BsN - MWMDecorStick

TitleStyle	Height 16

#     button	context	modifie	function
BcC Mouse 0 	BcN	A	FuncFvwmDeleteOrDestroy
BmC Mouse 1 	BmN	A	FuncFvwmMaximize
BmC Mouse 2 	BmN	A	FuncFvwmMaximizeVertically
BmC Mouse 3 	BmN	A	FuncFvwmMaximizeHorizontally
BmC Mouse 1 	BmN	S	Maximize grow grow
BmC Mouse 2 	BmN	S	Maximize    0 grow
BmC Mouse 3 	BmN	S	Maximize grow    0
BoC Mouse 1 	BoN	A	FuncFvwmWindowOpsOrAction Nop
BoC MouseXX 2 3	BoN	A	Menu MenuFvwmWindowMove
BoC MouseXX 3 2	BoN	A	Menu MenuFvwmWindowGroupOps
BiC Mouse 0 	BiN	A	FuncFvwmIconify
BuC Mouse 1 	BuN	A	WindowShade true
BuC Mouse 2 	BuN	A	WindowShade false
BuC Mouse 3 	BuN	A	WindowShade toggle
BdC Mouse 1 	BdN	A	WindowShade false
BdC Mouse 2 	BdN	A	WindowShade true
BdC Mouse 3 	BdN	A	WindowShade toggle
BsC Mouse 0 	BsN	A	Stick
BcC Mouse 0 	BcN	CM	FuncFvwmShowButtonInfo "Delete on click^nDestroy on double click"
BmC Mouse 0 	BmN	CM	FuncFvwmShowButtonInfo "Mouse 1 - Maximize:^n^tfully on click^n^tmenu on double click^nMouse 2 - Maximize vertically^nMouse 3 - Maximize horizontally^nAll with Shift - Maximize grow"
BoC Mouse 0 	BoN	CM	FuncFvwmShowButtonInfo "Mouse 1 - WindowOps menu^nMouse 2/3 - Move menu^nMouse 3/2 - Resource Group menu"
BiC Mouse 0 	BiN	CM	FuncFvwmShowButtonInfo "Iconify"
BuC Mouse 0 	BuN	CM	FuncFvwmShowButtonInfo "WindowShade:^n^tMouse 1 - true^n^tMouse 2 - false^n^tMouse 3 - toggle"
BdC Mouse 0 	BdN	CM	FuncFvwmShowButtonInfo "WindowShade:^n^tMouse 1 - false^n^tMouse 2 - true^n^tMouse 3 - toggle"
BsC Mouse 0 	BsN	CM	FuncFvwmShowButtonInfo "Stick"
# simulate title bindings on two edge buttons:
BlC FuncFvwmSetTitleBindings BlN
BrC FuncFvwmSetTitleBindings BrN

DestroyFunc FuncFvwmUnReloadDecor
AddToFunc   FuncFvwmUnReloadDecor

DestroyFunc FuncFvwmReloadDecor
AddToFunc   FuncFvwmReloadDecor
+ I FuncFvwmDecorBackground
# override the colors titlestyle
+ I TitleStyle \
	ActiveUp   (TiledPixmap ../themes/nanogui/images/decor/title-activeup.xpm) \
	ActiveDown (TiledPixmap ../themes/nanogui/images/decor/title-activedown.xpm) \
	Inactive   (TiledPixmap ../themes/nanogui/images/decor/title-inactive.xpm)
+ I BoC ButtonStyle BoN \
BoC	ActiveUp (Pixmap button/options-activeup.xpm) \
BoC	ActiveDown (Pixmap button/options-activedown.xpm) \
BoC	Inactive   (Pixmap button/options-inactive.xpm)
+ I BcC ButtonStyle BcN \
BcC	ActiveUp   (Pixmap button/close-activeup.xpm) \
BcC	ActiveDown (Pixmap button/close-activedown.xpm) \
BcC	Inactive   (Pixmap button/close-inactive.xpm)
+ I BmC ButtonStyle BmN \
BmC	ActiveUp   (Pixmap button/maximize-activeup.xpm) \
BmC	ActiveDown (Pixmap button/maximize-activedown.xpm) \
BmC	Inactive   (Pixmap button/maximize-inactive.xpm)
+ I BiC ButtonStyle BiN \
BiC	ActiveUp   (Pixmap button/iconify-activeup.xpm) \
BiC	ActiveDown (Pixmap button/iconify-activedown.xpm) \
BiC	Inactive   (Pixmap button/iconify-inactive.xpm)
+ I BsC ButtonStyle BsN \
BsC	ActiveUp   (Pixmap button/stick-activeup.xpm) \
BsC	ActiveDown (Pixmap button/stick-activedown.xpm) \
BsC	Inactive   (Pixmap button/stick-inactive.xpm)
+ I BuC ButtonStyle BuN \
BuC	ActiveUp   (Pixmap button/shadeup-activeup.xpm) \
BuC	ActiveDown (Pixmap button/shadeup-activedown.xpm) \
BuC	Inactive   (Pixmap button/shadeup-inactive.xpm)
+ I BdC ButtonStyle BdN \
BdC	ActiveUp   (Pixmap button/shadedown-activeup.xpm) \
BdC	ActiveDown (Pixmap button/shadedown-activedown.xpm) \
BdC	Inactive   (Pixmap button/shadedown-inactive.xpm)
+ I BlC ButtonStyle BlN \
BlC	ActiveUp   (Pixmap button/titleleft-activeup.xpm) \
BlC	ActiveDown (Pixmap button/titleleft-activedown.xpm) \
BlC	Inactive   (Pixmap button/titleleft-inactive.xpm)
+ I BrC ButtonStyle BrN \
BrC	ActiveUp   (Pixmap button/titleright-activeup.xpm) \
BrC	ActiveDown (Pixmap button/titleright-activedown.xpm) \
BrC	Inactive   (Pixmap button/titleright-inactive.xpm)

DestroyFunc FuncFvwmOverRideWindowLook
AddToFunc   FuncFvwmOverRideWindowLook
+ I TitleStyle -- flat
+ I ButtonStyle All -- flat

DestroyFunc FuncFvwmStartWindowButtons
AddToFunc   FuncFvwmStartWindowButtons
# This is usually not in this component, but these buttons can't be non-flat
+ I TitleStyle -- flat
+ I ButtonStyle All -- flat

DestroyFunc FuncFvwmStopWindowButtons
AddToFunc   FuncFvwmStopWindowButtons
+ I FuncFvwmRemoveAllButtons
BcC + I Mouse 0 	BcN	A	-
BmC + I Mouse 1 	BmN	A	-
BmC + I Mouse 2 	BmN	A	-
BmC + I Mouse 3 	BmN	A	-
BmC + I Mouse 1 	BmN	S	-
BmC + I Mouse 2 	BmN	S	-
BmC + I Mouse 3 	BmN	S	-
BoC + I Mouse 1 	BoN	A	-
BoC + I Mouse 2 	BoN	A	-
BoC + I Mouse 3 	BoN	A	-
BiC + I Mouse 0 	BiN	A	-
BuC + I Mouse 1 	BuN	A	-
BuC + I Mouse 2 	BuN	A	-
BuC + I Mouse 3 	BuN	A	-
BdC + I Mouse 1 	BdN	A	-
BdC + I Mouse 2 	BdN	A	-
BdC + I Mouse 3 	BdN	A	-
BsC + I Mouse 0 	BsN	A	-
BcC + I Mouse 0 	BcN	CM	-
BmC + I Mouse 0 	BmN	CM	-
BoC + I Mouse 0 	BoN	CM	-
BiC + I Mouse 0 	BiN	CM	-
BuC + I Mouse 0 	BuN	CM	-
BdC + I Mouse 0 	BdN	CM	-
BsC + I Mouse 0 	BsN	CM	-
#
BlC + I FuncFvwmUnsetTitleBindings BlN
BrC + I FuncFvwmUnsetTitleBindings BrN
