Commit 2bf0da5f by Jessica Hawkwell

Adding EmptyBorder for #1

1 parent 35ce0d4c
...@@ -15,6 +15,7 @@ nitrogen/nwt/Component.cpp ...@@ -15,6 +15,7 @@ nitrogen/nwt/Component.cpp
nitrogen/nwt/ComponentEvent.cpp nitrogen/nwt/ComponentEvent.cpp
nitrogen/nwt/Container.cpp nitrogen/nwt/Container.cpp
nitrogen/nwt/Dimension.cpp nitrogen/nwt/Dimension.cpp
nitrogen/nwt/EmptyBorder.cpp
nitrogen/nwt/EventListener.cpp nitrogen/nwt/EventListener.cpp
nitrogen/nwt/EventObject.cpp nitrogen/nwt/EventObject.cpp
nitrogen/nwt/FlowLayout.cpp nitrogen/nwt/FlowLayout.cpp
......
/*
* Copyright (c) 2018, jlhawkwell
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* * Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
/*
* File: EmptyBorder.cpp
* Author: jlhawkwell
*
* Created on March 24, 2018, 9:49 PM
*/
#include "EmptyBorder.h"
namespace nitrogen {
namespace nwt {
EmptyBorder::EmptyBorder(Insets* insets) {
bt = insets->getTop();
bl = insets->getLeft();
bb = insets->getBottom();
br = insets->getRight();
}
EmptyBorder::EmptyBorder(unsigned int top, unsigned int left, unsigned int bottom, unsigned int right) {
bt = top;
bl = left;
bb = bottom;
br = right;
}
Insets* EmptyBorder::getBorderInsets(Component* comp) {
return new Insets(bt, bl, bb, br);
}
bool EmptyBorder::isBorderOpaque() {
return true;
}
void EmptyBorder::paintBorder(Component* comp, Graphics* graph, int, int, unsigned int, unsigned int) {
}
}
}
/*
* Copyright (c) 2018, jlhawkwell
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* * Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
/*
* File: EmptyBorder.h
* Author: jlhawkwell
*
* Created on March 24, 2018, 9:49 PM
*/
#ifndef EMPTYBORDER_H
#define EMPTYBORDER_H
#include <ntk.h>
#include <nitrogen/nwt/Border.h>
#include <nitrogen/nwt/Component.h>
#include <nitrogen/nwt/Insets.h>
#include <nitrogen/nwt/Graphics.h>
namespace nitrogen {
namespace nwt {
class EmptyBorder : public Border {
public:
EmptyBorder(Insets* insets);
EmptyBorder(unsigned int top, unsigned int left, unsigned int bottom, unsigned int right);
virtual Insets* getBorderInsets(Component* comp) override;
virtual bool isBorderOpaque() override;
virtual void paintBorder(Component* comp, Graphics* graph, int, int, unsigned int, unsigned int) override;
protected:
unsigned int bt;
unsigned int bl;
unsigned int bb;
unsigned int br;
private:
};
}
}
#endif /* EMPTYBORDER_H */
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!