mirror of https://github.com/weisJ/darklaf.git
weisj
5 years ago
14 changed files with 322 additions and 77 deletions
@ -0,0 +1,49 @@ |
|||||||
|
/* |
||||||
|
* MIT License |
||||||
|
* |
||||||
|
* Copyright (c) 2020 Jannis Weis |
||||||
|
* |
||||||
|
* Permission is hereby granted, free of charge, to any person obtaining a copy |
||||||
|
* of this software and associated documentation files (the "Software"), to deal |
||||||
|
* in the Software without restriction, including without limitation the rights |
||||||
|
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
||||||
|
* copies of the Software, and to permit persons to whom the Software is |
||||||
|
* furnished to do so, subject to the following conditions: |
||||||
|
* |
||||||
|
* The above copyright notice and this permission notice shall be included in all |
||||||
|
* copies or substantial portions of the Software. |
||||||
|
* |
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
||||||
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
||||||
|
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
||||||
|
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
||||||
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE |
||||||
|
* SOFTWARE. |
||||||
|
*/ |
||||||
|
package com.github.weisj.darklaf.decorations; |
||||||
|
|
||||||
|
import com.github.weisj.darklaf.ui.rootpane.CustomTitlePane; |
||||||
|
|
||||||
|
import javax.swing.*; |
||||||
|
|
||||||
|
public class DefaultDecorationsProvider implements JNIDecorationsProvider { |
||||||
|
@Override |
||||||
|
public CustomTitlePane createTitlePane(final JRootPane rootPane) { |
||||||
|
return new CustomTitlePane() { |
||||||
|
@Override |
||||||
|
public void uninstall() { |
||||||
|
} |
||||||
|
}; |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public boolean isCustomDecorationSupported() { |
||||||
|
return false; |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public boolean updateLibrary() { |
||||||
|
return false; |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,57 @@ |
|||||||
|
/* |
||||||
|
* MIT License |
||||||
|
* |
||||||
|
* Copyright (c) 2020 Jannis Weis |
||||||
|
* |
||||||
|
* Permission is hereby granted, free of charge, to any person obtaining a copy |
||||||
|
* of this software and associated documentation files (the "Software"), to deal |
||||||
|
* in the Software without restriction, including without limitation the rights |
||||||
|
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
||||||
|
* copies of the Software, and to permit persons to whom the Software is |
||||||
|
* furnished to do so, subject to the following conditions: |
||||||
|
* |
||||||
|
* The above copyright notice and this permission notice shall be included in all |
||||||
|
* copies or substantial portions of the Software. |
||||||
|
* |
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
||||||
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
||||||
|
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
||||||
|
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
||||||
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE |
||||||
|
* SOFTWARE. |
||||||
|
*/ |
||||||
|
package com.github.weisj.darklaf.decorations; |
||||||
|
|
||||||
|
import com.github.weisj.darklaf.decorations.windows.WindowsDecorationsProvider; |
||||||
|
import com.github.weisj.darklaf.platform.SystemInfo; |
||||||
|
import com.github.weisj.darklaf.ui.rootpane.CustomTitlePane; |
||||||
|
|
||||||
|
import javax.swing.*; |
||||||
|
|
||||||
|
public final class JNIDecorations { |
||||||
|
|
||||||
|
private static JNIDecorationsProvider decorationsProvider; |
||||||
|
|
||||||
|
static { |
||||||
|
//Extend for different platforms.
|
||||||
|
if (SystemInfo.isWindows) { |
||||||
|
decorationsProvider = new WindowsDecorationsProvider(); |
||||||
|
} else { |
||||||
|
decorationsProvider = new DefaultDecorationsProvider(); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
public static CustomTitlePane createTitlePane(final JRootPane rootPane) { |
||||||
|
return decorationsProvider.createTitlePane(rootPane); |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
public static boolean isCustomDecorationSupported() { |
||||||
|
return decorationsProvider.isCustomDecorationSupported(); |
||||||
|
} |
||||||
|
|
||||||
|
public static boolean updateLibrary() { |
||||||
|
return decorationsProvider.updateLibrary(); |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,53 @@ |
|||||||
|
/* |
||||||
|
* MIT License |
||||||
|
* |
||||||
|
* Copyright (c) 2020 Jannis Weis |
||||||
|
* |
||||||
|
* Permission is hereby granted, free of charge, to any person obtaining a copy |
||||||
|
* of this software and associated documentation files (the "Software"), to deal |
||||||
|
* in the Software without restriction, including without limitation the rights |
||||||
|
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
||||||
|
* copies of the Software, and to permit persons to whom the Software is |
||||||
|
* furnished to do so, subject to the following conditions: |
||||||
|
* |
||||||
|
* The above copyright notice and this permission notice shall be included in all |
||||||
|
* copies or substantial portions of the Software. |
||||||
|
* |
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
||||||
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
||||||
|
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
||||||
|
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
||||||
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE |
||||||
|
* SOFTWARE. |
||||||
|
*/ |
||||||
|
package com.github.weisj.darklaf.decorations; |
||||||
|
|
||||||
|
import com.github.weisj.darklaf.ui.rootpane.CustomTitlePane; |
||||||
|
|
||||||
|
import javax.swing.*; |
||||||
|
|
||||||
|
public interface JNIDecorationsProvider { |
||||||
|
|
||||||
|
/** |
||||||
|
* Create the custom title pane. |
||||||
|
* |
||||||
|
* @param rootPane The root pane to create the title pane for. |
||||||
|
* @return the custom title pane. |
||||||
|
*/ |
||||||
|
CustomTitlePane createTitlePane(final JRootPane rootPane); |
||||||
|
|
||||||
|
/** |
||||||
|
* Returns whether custom decorations are supported. |
||||||
|
* |
||||||
|
* @return true if decorations are supported. |
||||||
|
*/ |
||||||
|
boolean isCustomDecorationSupported(); |
||||||
|
|
||||||
|
/** |
||||||
|
* Load the decorations library if necessary. |
||||||
|
* |
||||||
|
* @return true if successful and library wasn't already loaded. |
||||||
|
*/ |
||||||
|
boolean updateLibrary(); |
||||||
|
} |
@ -0,0 +1,48 @@ |
|||||||
|
/* |
||||||
|
* MIT License |
||||||
|
* |
||||||
|
* Copyright (c) 2020 Jannis Weis |
||||||
|
* |
||||||
|
* Permission is hereby granted, free of charge, to any person obtaining a copy |
||||||
|
* of this software and associated documentation files (the "Software"), to deal |
||||||
|
* in the Software without restriction, including without limitation the rights |
||||||
|
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
||||||
|
* copies of the Software, and to permit persons to whom the Software is |
||||||
|
* furnished to do so, subject to the following conditions: |
||||||
|
* |
||||||
|
* The above copyright notice and this permission notice shall be included in all |
||||||
|
* copies or substantial portions of the Software. |
||||||
|
* |
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
||||||
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
||||||
|
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
||||||
|
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
||||||
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE |
||||||
|
* SOFTWARE. |
||||||
|
*/ |
||||||
|
package com.github.weisj.darklaf.decorations.windows; |
||||||
|
|
||||||
|
import com.github.weisj.darklaf.decorations.JNIDecorationsProvider; |
||||||
|
import com.github.weisj.darklaf.platform.windows.JNIDecorationsWindows; |
||||||
|
import com.github.weisj.darklaf.ui.rootpane.CustomTitlePane; |
||||||
|
|
||||||
|
import javax.swing.*; |
||||||
|
|
||||||
|
public class WindowsDecorationsProvider implements JNIDecorationsProvider { |
||||||
|
|
||||||
|
@Override |
||||||
|
public CustomTitlePane createTitlePane(final JRootPane rootPane) { |
||||||
|
return new DarkTitlePaneWindows(rootPane); |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public boolean isCustomDecorationSupported() { |
||||||
|
return JNIDecorationsWindows.isCustomDecorationSupported(); |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public boolean updateLibrary() { |
||||||
|
return JNIDecorationsWindows.updateLibrary(); |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,32 @@ |
|||||||
|
/* |
||||||
|
* MIT License |
||||||
|
* |
||||||
|
* Copyright (c) 2020 Jannis Weis |
||||||
|
* |
||||||
|
* Permission is hereby granted, free of charge, to any person obtaining a copy |
||||||
|
* of this software and associated documentation files (the "Software"), to deal |
||||||
|
* in the Software without restriction, including without limitation the rights |
||||||
|
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
||||||
|
* copies of the Software, and to permit persons to whom the Software is |
||||||
|
* furnished to do so, subject to the following conditions: |
||||||
|
* |
||||||
|
* The above copyright notice and this permission notice shall be included in all |
||||||
|
* copies or substantial portions of the Software. |
||||||
|
* |
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
||||||
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
||||||
|
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
||||||
|
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
||||||
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE |
||||||
|
* SOFTWARE. |
||||||
|
*/ |
||||||
|
package com.github.weisj.darklaf.ui.rootpane; |
||||||
|
|
||||||
|
import javax.swing.*; |
||||||
|
|
||||||
|
public abstract class CustomTitlePane extends JComponent { |
||||||
|
|
||||||
|
|
||||||
|
public abstract void uninstall(); |
||||||
|
} |
Loading…
Reference in new issue