Commit 9c5b42f3 by Jessica Hawkwell

Starting Swing translation

1 parent dac5c130
...@@ -9,6 +9,8 @@ set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ./build/bin) ...@@ -9,6 +9,8 @@ set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ./build/bin)
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ./build/lib) set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ./build/lib)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ./build/lib) set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ./build/lib)
include_directories("/usr/local/include")
add_subdirectory(src/libnde) add_subdirectory(src/libnde)
add_subdirectory(src/libntk) add_subdirectory(src/libntk)
add_subdirectory(src/NitroWin) add_subdirectory(src/NitroWin)
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<configurationDescriptor version="100"> <configurationDescriptor version="100">
<logicalFolder name="root" displayName="root" projectFiles="true" kind="ROOT"> <logicalFolder name="root" displayName="root" projectFiles="true" kind="ROOT">
<df root="." name="0"> <df root="src/libnde" name="0">
<df name="CMakeFiles"> </df>
<df name="3.10.2"> <df root="src/libntk" name="1">
<df name="CompilerIdC"> </df>
<in>CMakeCCompilerId.c</in> <df root="src/NitroWin" name="2">
</df>
<df name="CompilerIdCXX">
<in>CMakeCXXCompilerId.cpp</in>
</df>
</df>
<in>feature_tests.c</in>
<in>feature_tests.cxx</in>
</df>
<df name="src">
<df name="libnde">
<in>NPosition.cpp</in>
<in>nde.h</in>
</df>
<df name="libntk">
<in>NObject.cpp</in>
<in>NObject.h</in>
<in>ntk.h</in>
</df>
<df name="NitroWin">
<df name="CMakeFiles">
<df name="3.10.2">
<df name="CompilerIdC">
<in>CMakeCCompilerId.c</in>
</df>
<df name="CompilerIdCXX">
<in>CMakeCXXCompilerId.cpp</in>
</df>
</df>
<in>feature_tests.c</in>
<in>feature_tests.cxx</in>
</df>
<in>NUtils.cpp</in>
<in>NUtils.h</in>
<in>NWMAction.cpp</in>
<in>NWMAction.h</in>
<in>NWManager.cpp</in>
<in>NWManager.h</in>
<in>NitroWin.h</in>
<in>main.cpp</in>
</df>
</df>
</df> </df>
<logicalFolder name="ExternalFiles" <logicalFolder name="ExternalFiles"
displayName="Important Files" displayName="Important Files"
...@@ -57,9 +16,11 @@ ...@@ -57,9 +16,11 @@
<itemPath>nbproject/private/launcher.properties</itemPath> <itemPath>nbproject/private/launcher.properties</itemPath>
</logicalFolder> </logicalFolder>
</logicalFolder> </logicalFolder>
<sourceFolderFilter>^(nbproject)$</sourceFolderFilter> <sourceFolderFilter>^(nbproject|CMakeFiles|build)$</sourceFolderFilter>
<sourceRootList> <sourceRootList>
<Elem>.</Elem> <Elem>src/libnde</Elem>
<Elem>src/libntk</Elem>
<Elem>src/NitroWin</Elem>
</sourceRootList> </sourceRootList>
<projectmakefile>Makefile</projectmakefile> <projectmakefile>Makefile</projectmakefile>
<confs> <confs>
...@@ -91,66 +52,6 @@ ...@@ -91,66 +52,6 @@
<preBuildFirst>true</preBuildFirst> <preBuildFirst>true</preBuildFirst>
</preBuild> </preBuild>
</makefileType> </makefileType>
<item path="CMakeFiles/3.10.2/CompilerIdC/CMakeCCompilerId.c"
ex="false"
tool="0"
flavor2="0">
</item>
<item path="CMakeFiles/3.10.2/CompilerIdCXX/CMakeCXXCompilerId.cpp"
ex="false"
tool="1"
flavor2="0">
</item>
<item path="CMakeFiles/feature_tests.c" ex="false" tool="0" flavor2="0">
</item>
<item path="CMakeFiles/feature_tests.cxx" ex="false" tool="1" flavor2="0">
</item>
<item path="src/NitroWin/CMakeFiles/3.10.2/CompilerIdC/CMakeCCompilerId.c"
ex="false"
tool="0"
flavor2="0">
</item>
<item path="src/NitroWin/CMakeFiles/3.10.2/CompilerIdCXX/CMakeCXXCompilerId.cpp"
ex="false"
tool="1"
flavor2="0">
</item>
<item path="src/NitroWin/CMakeFiles/feature_tests.c"
ex="false"
tool="0"
flavor2="0">
</item>
<item path="src/NitroWin/CMakeFiles/feature_tests.cxx"
ex="false"
tool="1"
flavor2="0">
</item>
<item path="src/NitroWin/NUtils.cpp" ex="false" tool="1" flavor2="0">
</item>
<item path="src/NitroWin/NUtils.h" ex="false" tool="3" flavor2="0">
</item>
<item path="src/NitroWin/NWMAction.cpp" ex="false" tool="1" flavor2="0">
</item>
<item path="src/NitroWin/NWMAction.h" ex="false" tool="3" flavor2="0">
</item>
<item path="src/NitroWin/NWManager.cpp" ex="false" tool="1" flavor2="0">
</item>
<item path="src/NitroWin/NWManager.h" ex="false" tool="3" flavor2="0">
</item>
<item path="src/NitroWin/NitroWin.h" ex="false" tool="3" flavor2="0">
</item>
<item path="src/NitroWin/main.cpp" ex="false" tool="1" flavor2="0">
</item>
<item path="src/libnde/NPosition.cpp" ex="false" tool="1" flavor2="0">
</item>
<item path="src/libnde/nde.h" ex="false" tool="3" flavor2="0">
</item>
<item path="src/libntk/NObject.cpp" ex="false" tool="1" flavor2="0">
</item>
<item path="src/libntk/NObject.h" ex="false" tool="3" flavor2="0">
</item>
<item path="src/libntk/ntk.h" ex="false" tool="3" flavor2="0">
</item>
</conf> </conf>
</confs> </confs>
</configurationDescriptor> </configurationDescriptor>
...@@ -4,13 +4,15 @@ ...@@ -4,13 +4,15 @@
<configuration> <configuration>
<data xmlns="http://www.netbeans.org/ns/make-project/1"> <data xmlns="http://www.netbeans.org/ns/make-project/1">
<name>Nitrogen</name> <name>Nitrogen</name>
<c-extensions>c</c-extensions> <c-extensions/>
<cpp-extensions>cpp,cxx</cpp-extensions> <cpp-extensions>cpp</cpp-extensions>
<header-extensions>h</header-extensions> <header-extensions>h</header-extensions>
<sourceEncoding>UTF-8</sourceEncoding> <sourceEncoding>UTF-8</sourceEncoding>
<make-dep-projects/> <make-dep-projects/>
<sourceRootList> <sourceRootList>
<sourceRootElem>.</sourceRootElem> <sourceRootElem>src/libnde</sourceRootElem>
<sourceRootElem>src/libntk</sourceRootElem>
<sourceRootElem>src/NitroWin</sourceRootElem>
</sourceRootList> </sourceRootList>
<confList> <confList>
<confElem> <confElem>
......
...@@ -3,7 +3,7 @@ project (NitroWin) ...@@ -3,7 +3,7 @@ project (NitroWin)
configure_file(${PROJECT_NAME}.h.in ${PROJECT_NAME}.h) configure_file(${PROJECT_NAME}.h.in ${PROJECT_NAME}.h)
find_package(X11) find_package(X11)
include_directories("/usr/local/include") #include_directories("/usr/local/include")
link_libraries(${X11_LIBRARIES}) link_libraries(${X11_LIBRARIES})
......
...@@ -92,6 +92,7 @@ void NWMAction::onButtonPress(XButtonPressedEvent e) { ...@@ -92,6 +92,7 @@ void NWMAction::onButtonPress(XButtonPressedEvent e) {
} }
XRaiseWindow(disp, frame); XRaiseWindow(disp, frame);
XSetInputFocus(disp, (*rclients)[frame], PointerRoot, CurrentTime);
} }
void NWMAction::onButtonRelease(XButtonReleasedEvent e) { void NWMAction::onButtonRelease(XButtonReleasedEvent e) {
......
#include "NitroWin.h" #include "NitroWin.h"
#include <iostream> #include <iostream>
#include "NWManager.h" #include "NWManager.h"
#include <Color.h>
#include <NPosition.h>
int main ( int argc, char** argv ) int main ( int argc, char** argv )
{ {
std::cout << NITROWIN_NAME << " v" << NITROWIN_VERSION << std::endl; std::cout << NITROWIN_NAME << " v" << NITROWIN_VERSION << std::endl;
nitrogen::Color no = nitrogen::Color(255, 255, 255);
std::cout << "Color: " << no << std::endl;
NWManager *nwm = new NWManager(); NWManager *nwm = new NWManager();
nwm->run(); nwm->run();
} }
...@@ -2,9 +2,9 @@ cmake_minimum_required (VERSION 3.10) ...@@ -2,9 +2,9 @@ cmake_minimum_required (VERSION 3.10)
project (nde) project (nde)
configure_file(${PROJECT_NAME}.h.in ${PROJECT_NAME}.h) configure_file(${PROJECT_NAME}.h.in ${PROJECT_NAME}.h)
include_directories("/usr/local/include") #include_directories("/usr/local/include")
add_library(${PROJECT_NAME} SHARED NPosition.cpp) add_library(${PROJECT_NAME} SHARED ndeMain.cpp NPosition.cpp)
install(TARGETS ${PROJECT_NAME} LIBRARY DESTINATION lib/${PROJECT_NAME}) install(TARGETS ${PROJECT_NAME} LIBRARY DESTINATION lib/${PROJECT_NAME})
......
...@@ -33,6 +33,7 @@ ...@@ -33,6 +33,7 @@
#ifndef NDE_H #ifndef NDE_H
#define NDE_H #define NDE_H
#include <typeinfo>
#define NDE_NAME "nde" #define NDE_NAME "nde"
#define NDE_VERSION_MAJOR 1 #define NDE_VERSION_MAJOR 1
...@@ -41,5 +42,11 @@ ...@@ -41,5 +42,11 @@
#define NDE_VERSION_TWEAK 0 #define NDE_VERSION_TWEAK 0
#define NDE_VERSION "1.0.0.0" #define NDE_VERSION "1.0.0.0"
namespace nitrogen {
template <typename T>
char * getTypeName(const T obj) {
return (char *)typeid(obj).name();
}
}
#endif /* NDE_H */ #endif /* NDE_H */
...@@ -33,6 +33,7 @@ ...@@ -33,6 +33,7 @@
#ifndef NDE_H #ifndef NDE_H
#define NDE_H #define NDE_H
#include <typeinfo>
#define NDE_NAME "@PROJECT_NAME@" #define NDE_NAME "@PROJECT_NAME@"
#define NDE_VERSION_MAJOR @Nitrogen_VERSION_MAJOR@ #define NDE_VERSION_MAJOR @Nitrogen_VERSION_MAJOR@
...@@ -41,5 +42,11 @@ ...@@ -41,5 +42,11 @@
#define NDE_VERSION_TWEAK @Nitrogen_VERSION_TWEAK@ #define NDE_VERSION_TWEAK @Nitrogen_VERSION_TWEAK@
#define NDE_VERSION "@Nitrogen_VERSION_MAJOR@.@Nitrogen_VERSION_MINOR@.@Nitrogen_VERSION_PATCH@.@Nitrogen_VERSION_TWEAK@" #define NDE_VERSION "@Nitrogen_VERSION_MAJOR@.@Nitrogen_VERSION_MINOR@.@Nitrogen_VERSION_PATCH@.@Nitrogen_VERSION_TWEAK@"
namespace nitrogen {
template <typename T>
char * getTypeName(const T obj) {
return (char *)typeid(obj).name();
}
}
#endif /* NDE_H */ #endif /* NDE_H */
/*
* 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.
*/
#include <nde.h>
#include <typeinfo>
...@@ -2,9 +2,9 @@ cmake_minimum_required (VERSION 3.10) ...@@ -2,9 +2,9 @@ cmake_minimum_required (VERSION 3.10)
project (ntk) project (ntk)
configure_file(${PROJECT_NAME}.h.in ${PROJECT_NAME}.h) configure_file(${PROJECT_NAME}.h.in ${PROJECT_NAME}.h)
include_directories("/usr/local/include") #include_directories("/usr/local/include")
add_library(${PROJECT_NAME} SHARED NObject.cpp) add_library(${PROJECT_NAME} SHARED ntkMain.cpp NObject.cpp Color.cpp)
install(TARGETS ${PROJECT_NAME} LIBRARY DESTINATION lib/${PROJECT_NAME}) install(TARGETS ${PROJECT_NAME} LIBRARY DESTINATION lib/${PROJECT_NAME})
......
/*
* 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: Color.cpp
* Author: jlhawkwell
*
* Created on March 16, 2018, 7:19 PM
*/
#include "Color.h"
#include <string>
namespace nitrogen {
Color::Color(unsigned int c) {
alpha = 255;
red = ((c & MASK_RED) >> 16);
green = ((c & MASK_GREEN) >> 8);
blue = (c & MASK_BLUE);
}
Color::Color(unsigned char r, unsigned char g, unsigned char b) {
alpha = 255;
red = r;
green = g;
blue = b;
}
Color::Color(unsigned char r, unsigned char g, unsigned char b, unsigned char a) {
alpha = a;
red = r;
green = g;
blue = b;
}
unsigned char Color::getAlpha() const {
return alpha;
}
unsigned char Color::getBlue() const {
return blue;
}
unsigned char Color::getGreen() const {
return green;
}
unsigned int Color::getRGB() const {
return (red << 16) + (green << 8) + blue;
}
unsigned int Color::getARGB() const {
return (alpha << 24) + getRGB();
}
unsigned char Color::getRed() const {
return red;
}
Color::~Color() {
}
Color& Color::operator()(unsigned int c) const {
Color *nc = new Color(c);
return *nc;
}
Color& Color::operator()(unsigned char r, unsigned char g, unsigned char b) const {
Color *nc = new Color(r, g, b);
return *nc;
}
Color& Color::operator()(unsigned char r, unsigned char g, unsigned char b, unsigned char a) const {
Color *nc = new Color(r, g, b, a);
return *nc;
}
Color& Color::operator=(const Color& right) {
Color *nc = new Color(right.getARGB());
return *nc;
}
bool Color::operator!=(const Color& right) const {
return (getARGB() != right.getARGB());
}
bool Color::operator==(const Color& right) const {
return (getARGB() == right.getARGB());
}
std::ostream& operator<<(std::ostream& os, const Color& obj) {
// Write obj to stream
std::string out;
out.append(getTypeName(obj));
out.append("(");
out.append(std::to_string(obj.alpha));
out.append(",");
out.append(std::to_string(obj.red));
out.append(",");
out.append(std::to_string(obj.green));
out.append(",");
out.append(std::to_string(obj.blue));
out.append(")");
os << out;
return os;
}
Color* BLACK = new Color(0, 0, 0);
Color* RED = new Color(128, 0, 0);
Color* GREEN = new Color(0, 128, 0);
Color* YELLOW = new Color(128, 128, 0);
Color* BLUE = new Color(0, 0, 128);
Color* MAGENTA = new Color(128, 0, 128);
Color* CYAN = new Color(0, 128, 128);
Color* WHITE = new Color(192, 192, 192);
Color* BRIGHT_BLACK = new Color(128, 128, 128);
Color* BRIGHT_RED = new Color(255, 0, 0);
Color* BRIGHT_GREEN = new Color(0, 255, 0);
Color* BRIGHT_YELLOW = new Color(255, 255, 0);
Color* BRIGHT_BLUE = new Color(0, 0, 255);
Color* BRIGHT_MAGENTA = new Color(255, 0, 255);
Color* BRIGHT_CYAN = new Color(0, 255, 255);
Color* BRIGHT_WHITE = new Color(255, 255, 255);
}
/*
* 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: Color.h
* Author: jlhawkwell
*
* Created on March 16, 2018, 7:19 PM
*/
#ifndef COLOR_H
#define COLOR_H
#include <ntk.h>
#include <NObject.h>
namespace nitrogen {
class Color : public NObject {
public:
static const unsigned int MASK_ALPHA = 0xff000000;
static const unsigned int MASK_RED = 0x00ff0000;
static const unsigned int MASK_GREEN = 0x0000ff00;
static const unsigned int MASK_BLUE = 0x000000ff;
static Color* BLACK;
static Color* RED;
static Color* GREEN;
static Color* YELLOW;
static Color* BLUE;
static Color* MAGENTA;
static Color* CYAN;
static Color* WHITE;
static Color* BRIGHT_BLACK;
static Color* BRIGHT_RED;
static Color* BRIGHT_GREEN;
static Color* BRIGHT_YELLOW;
static Color* BRIGHT_BLUE;
static Color* BRIGHT_MAGENTA;
static Color* BRIGHT_CYAN;
static Color* BRIGHT_WHITE;
Color(unsigned int c);
Color(unsigned char red, unsigned char green, unsigned char blue);
Color(unsigned char red, unsigned char green, unsigned char blue, unsigned char alpha);
unsigned char getAlpha() const;
unsigned char getRed() const;
unsigned char getGreen() const;
unsigned char getBlue() const;
unsigned int getRGB() const;
unsigned int getARGB() const;
virtual ~Color();
virtual Color& operator()(unsigned int c) const;
virtual Color& operator()(unsigned char red, unsigned char green, unsigned char blue) const;
virtual Color& operator()(unsigned char red, unsigned char green, unsigned char blue, unsigned char alpha) const;
virtual Color& operator=(const Color& right);
virtual bool operator!=(const Color& right) const;
virtual bool operator==(const Color& right) const;
friend std::ostream& operator<<(std::ostream& os, const Color& obj);
private:
unsigned char red;
unsigned char green;
unsigned char blue;
unsigned char alpha;
};
}
#endif /* COLOR_H */
/*
* 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: Component.cpp
* Author: jlhawkwell
*
* Created on March 16, 2018, 6:04 PM
*/
#include "Component.h"
namespace nitrogen {
Component::Component() {
background = Color::BRIGHT_BLACK;
//border
//font
foreground = Color::BLACK;
//graphics
location = new NPosition<int>(0, 0);
//me_list = new std::list<MouseEvent>();
parent = nullptr;
preferredSize = new NSize<unsigned int>(0, 0);
size = new NSize<unsigned int>(0, 0);
}
void Component::addMouseListener(MouseListener* m) {
}
void Component::dispatchEvent(Event* e) {
}
Color* Component::getBackground() {
return background;
}
Border* Component::getBorder() {
return border;
}
nitrogen::Font* Component::getFont() {
return font;
}
FontMetrics* Component::getFontMetrics(nitrogen::Font* f) {
}
Color* Component::getForeground() {
return foreground;
}
Graphics* Component::getGraphics() {
return graphics;
}
Component* Component::getParent() {
return parent;
}
NPosition<int>* Component::getLocation() {
return location;
}
NSize<unsigned int>* Component::getPreferredSize() {
return preferredSize;
}
NSize<unsigned int>* Component::getSize() {
return size;
}
void Component::paint(Graphics* g) {
}
void Component::paintAll(Graphics* g) {
}
void Component::processEvent(Event* e) {
}
void Component::processMouseEvent(MouseEvent* e) {
}
void Component::removeNotify() {
}
void Component::repaint() {
}
void Component::setBackground(Color* c) {
background = c;
}
void Component::setBorder(Border* b) {
delete border;
border = b;
}
void Component::setFont(nitrogen::Font* f) {
delete font;
font = f;
}
void Component::setForeground(Color* c) {
foreground = c;
}
void Component::setLocation(NPosition<int>* p) {
location = p;
}
void Component::setSize(NSize<unsigned int>* s) {
size = s;
}
void Component::update(Graphics* g) {
}
void Component::validate() {
}
Component::~Component() {
}
}
/*
* 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: Component.h
* Author: jlhawkwell
*
* Created on March 16, 2018, 6:04 PM
*/
#ifndef COMPONENT_H
#define COMPONENT_H
#include <list>
#include <ntk.h>
#include <NObject.h>
#include <Color.h>
#include <NSize.h>
#include <NPosition.h>
namespace nitrogen {
class Component : public NObject {
public:
virtual ~Component();
virtual Border* getBorder();
virtual NSize<unsigned int>* getSize();
virtual NPosition<int>* getLocation();
virtual Component* getParent();
virtual Graphics* getGraphics();
virtual nitrogen::Font* getFont();
virtual FontMetrics* getFontMetrics(nitrogen::Font *f);
virtual Color* getForeground();
virtual Color* getBackground();
virtual NSize<unsigned int>* getPreferredSize();
virtual void setBorder(Border* b);
virtual void setFont(nitrogen::Font *f);
virtual void setForeground(Color* c);
virtual void setBackground(Color* c);
virtual void setSize(NSize<unsigned int> *s);
virtual void setLocation(NPosition<int> *p);
virtual void paint(Graphics *g);
virtual void repaint();
virtual void paintAll(Graphics *g);
virtual void update(Graphics *g);
virtual void validate();
virtual void removeNotify();
virtual void addMouseListener(MouseListener *m);
virtual void dispatchEvent(Event *e);
protected:
Component *parent;
Graphics *graphics;
NPosition<int> *location;
Border *border;
nitrogen::Font *font;
Color *foreground;
Color *background;
NSize<unsigned int> *size;
std::list<MouseEvent> *me_list;
NSize<unsigned int> *preferredSize;
Component();
virtual void processEvent(Event *e);
virtual void processMouseEvent(MouseEvent *e);
private:
};
}
#endif /* COMPONENT_H */
/*
* 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: NComponent.cpp
* Author: jlhawkwell
*
* Created on March 16, 2018, 5:36 PM
*/
#include "NComponent.h"
NComponent::NComponent() {
}
NComponent::NComponent(const NComponent& orig) {
}
NComponent::~NComponent() {
}
/*
* 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: NComponent.h
* Author: jlhawkwell
*
* Created on March 16, 2018, 5:36 PM
*/
#ifndef NCOMPONENT_H
#define NCOMPONENT_H
#include <ntk.h>
#include <string>
namespace nitrogen {
class NComponent {
public:
NComponent();
NComponent(const NComponent& orig);
virtual ~NComponent();
private:
};
}
#endif /* NCOMPONENT_H */
...@@ -33,42 +33,42 @@ ...@@ -33,42 +33,42 @@
#include <NObject.h> #include <NObject.h>
#include <typeinfo> #include <typeinfo>
using namespace nitrogen; namespace nitrogen {
NObject::NObject() { NObject::NObject() {
} }
NObject::NObject(const NObject& orig) { /*NObject::NObject(const NObject& orig) {
} } // */
NObject::~NObject() { NObject::~NObject() {
} }
NObject& NObject::operator()() const { NObject& NObject::operator()() const {
NObject *tmp = new NObject(); NObject *tmp = new NObject();
return *tmp; return *tmp;
} }
NObject& NObject::operator=(const NObject& right) { NObject& NObject::operator=(const NObject& right) {
if (this == &right) { if (this == &right) {
return *this; // Yes, so skip assignment, and just return *this. return *this; // Yes, so skip assignment, and just return *this.
}
return *this;
} }
return *this;
}
bool NObject::operator!=(const NObject& right) const { bool NObject::operator!=(const NObject& right) const {
bool result = !(*this == right); bool result = !(*this == right);
return result; return result;
} }
bool NObject::operator==(const NObject& right) const { bool NObject::operator==(const NObject& right) const {
bool result = false; bool result = false;
return result; return result;
} }
std::ostream& operator<<(std::ostream& os, const NObject& obj) { std::ostream& operator<<(std::ostream& os, const NObject& obj) {
// Write obj to stream // Write obj to stream
os << typeid(obj).name(); os << getTypeName(obj);
return os; return os;
}
} }
...@@ -36,20 +36,19 @@ ...@@ -36,20 +36,19 @@
#include <ostream> #include <ostream>
namespace nitrogen { namespace nitrogen {
class NObject { class NObject {
public: public:
NObject(); NObject();
NObject(const NObject& orig); //NObject(const NObject& orig);
virtual ~NObject(); virtual ~NObject();
virtual NObject& operator()() const; virtual NObject& operator()() const;
virtual NObject& operator=(const NObject& right); virtual NObject& operator=(const NObject& right);
virtual bool operator!=(const NObject& right) const; virtual bool operator!=(const NObject& right) const;
virtual bool operator==(const NObject& right) const; virtual bool operator==(const NObject& right) const;
friend std::ostream& operator<<(std::ostream& os, const NObject& obj); friend std::ostream& operator<<(std::ostream& os, const NObject& obj);
private: private:
};
};
} }
#endif /* NOBJECT_H */ #endif /* NOBJECT_H */
...@@ -33,6 +33,7 @@ ...@@ -33,6 +33,7 @@
#ifndef NTK_H #ifndef NTK_H
#define NTK_H #define NTK_H
#include <nde.h>
#define NTK_NAME "ntk" #define NTK_NAME "ntk"
#define NTK_VERSION_MAJOR 1 #define NTK_VERSION_MAJOR 1
......
...@@ -33,6 +33,7 @@ ...@@ -33,6 +33,7 @@
#ifndef NTK_H #ifndef NTK_H
#define NTK_H #define NTK_H
#include <nde.h>
#define NTK_NAME "@PROJECT_NAME@" #define NTK_NAME "@PROJECT_NAME@"
#define NTK_VERSION_MAJOR @Nitrogen_VERSION_MAJOR@ #define NTK_VERSION_MAJOR @Nitrogen_VERSION_MAJOR@
......
/*
* 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.
*/
#include <ntk.h>
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!