Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Jessica Hawkwell
/
nitrogen
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
2
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit d8fe66d4
authored
Mar 20, 2020
by
Jessica Hawkwell
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
moar functionaliteh
1 parent
46910efe
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
60 additions
and
11 deletions
src/ntk/nitrogen/Object.cpp
src/ntk/nitrogen/nwt/Graphics.h
src/ntk/nitrogen/nwt/NativeGraphics.cpp
src/ntk/nitrogen/nwt/NativeGraphics.h
src/ntk/nitrogen/Object.cpp
View file @
d8fe66d
...
...
@@ -41,9 +41,12 @@ namespace nitrogen {
}
std
::
string
*
Object
::
toString
()
{
std
::
string
*
str
;
str
->
append
(
getTypeName
(
this
));
return
str
;
std
::
string
*
out
out
->
append
(
getTypeName
(
*
this
));
out
->
append
(
"("
);
out
->
append
(
std
::
to_string
((
uintptr_t
)
*
this
));
out
->
append
(
")"
);
return
out
;
}
Object
&
Object
::
operator
()()
{
...
...
src/ntk/nitrogen/nwt/Graphics.h
View file @
d8fe66d
...
...
@@ -67,7 +67,7 @@ namespace nitrogen {
virtual
void
translate
(
int
x
,
int
y
)
=
0
;
virtual
void
dispose
()
=
0
;
virtual
std
::
string
*
toString
()
=
0
;
//
virtual std::string* toString() = 0;
virtual
Graphics
&
operator
()()
=
0
;
virtual
Graphics
&
operator
=
(
Graphics
&
right
)
=
0
;
//virtual bool operator!=(Graphics& right) = 0;
...
...
src/ntk/nitrogen/nwt/NativeGraphics.cpp
View file @
d8fe66d
...
...
@@ -37,10 +37,6 @@
namespace
nitrogen
{
namespace
nwt
{
// Xorg stuffies
Display
*
NativeGraphics
::
xdisp
;
Drawable
*
NativeGraphics
::
xdraw
;
GC
*
NativeGraphics
::
xgc
;
NativeGraphics
::
NativeGraphics
()
{
mask
=
0L
;
...
...
@@ -109,9 +105,7 @@ namespace nitrogen {
}
void
NativeGraphics
::
drawString
(
std
::
string
*
str
,
int
x
,
int
y
)
{
char
*
cstr
=
new
char
[
str
->
length
()
+
1
];
//char * basic = str->c_str();
XDrawString
(
xdisp
,
xdraw
,
xgc
,
x
,
y
,
str
->
c_str
(),
font
->
getSize
());
XDrawString
(
xdisp
,
xdraw
,
xgc
,
x
,
y
,
str
->
c_str
(),
str
->
length
());
}
void
NativeGraphics
::
drawString
(
std
::
string
&
str
,
int
x
,
int
y
)
{
...
...
@@ -165,5 +159,51 @@ namespace nitrogen {
void
NativeGraphics
::
createClip
()
{
}
// overrides
NativeGraphics
&
NativeGraphics
::
operator
()()
{
NativeGraphics
*
ng
=
new
NativeGraphics
();
return
ng
;
}
NativeGraphics
&
NativeGraphics
::
operator
=
(
NativeGraphics
&
right
)
{
if
(
*
this
!=
right
)
{
*
mask
=
*
right
.
mask
;
cx
=
right
.
cx
;
cy
=
right
.
cy
;
tx
=
right
.
tx
;
ty
=
right
.
ty
;
width
=
right
.
width
;
height
=
right
.
height
;
*
font
=
*
right
.
font
;
*
color
=
*
right
.
color
;
*
xdisp
=
*
right
.
xdisp
;
*
xdraw
=
*
right
.
xdraw
;
*
xgc
=
*
right
.
xgc
;
}
return
*
this
;
}
//bool operator!=(Graphics& right)
bool
NativeGraphics
::
operator
==
(
NativeGraphics
&
right
)
{
if
(
*
mask
!=
*
right
.
mask
)
{
return
false
;
}
if
(
cx
!=
right
.
cx
)
{
return
false
;
}
if
(
cy
!=
right
.
cy
)
{
return
false
;
}
if
(
tx
!=
right
.
tx
)
{
return
false
;
}
if
(
ty
!=
right
.
ty
)
{
return
false
;
}
if
(
width
!=
right
.
width
)
{
return
false
;
}
if
(
height
!=
right
.
height
)
{
return
false
;
}
if
(
*
font
!=
*
right
.
font
)
{
return
false
;
}
if
(
*
color
!=
*
right
.
color
)
{
return
false
;
}
if
(
*
xdisp
!=
*
right
.
xdisp
)
{
return
false
;
}
if
(
*
xdraw
!=
*
right
.
xdraw
)
{
return
false
;
}
if
(
*
xgc
!=
*
right
.
xgc
)
{
return
false
;
}
return
true
;
}
}
}
src/ntk/nitrogen/nwt/NativeGraphics.h
View file @
d8fe66d
...
...
@@ -70,6 +70,12 @@ namespace nitrogen {
void
translate
(
int
x
,
int
y
)
override
;
void
dispose
()
override
;
//std::string* toString();
NativeGraphics
&
operator
()()
override
;
NativeGraphics
&
operator
=
(
NativeGraphics
&
right
)
override
;
//bool operator!=(NativeGraphics& right);
bool
operator
==
(
NativeGraphics
&
right
)
override
;
protected
:
unsigned
long
mask
;
int
cx
;
...
...
Write
Preview
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment