hello, world!
This commit is contained in:
parent
bf9bce08a8
commit
59e838aabb
6
Makefile
6
Makefile
@ -1,7 +1,7 @@
|
||||
CC=g++
|
||||
CFLAGS= -c -g -Wall
|
||||
|
||||
LDLIBS = -lgtk
|
||||
CFLAGS= -c -g -Wall $(shell pkg-config --cflags gtkmm-4.0)
|
||||
LDLIBS = $(shell pkg-config --libs gtkmm-4.0)
|
||||
|
||||
TARGET := untap
|
||||
|
||||
@ -15,7 +15,7 @@ OBJS := $(SRCS:%=$(BUILD_DIR)/%.o)
|
||||
$(BUILD_DIR)/$(TARGET): $(OBJS)
|
||||
$(CC) $(OBJS) -o $@ $(LDLIBS)
|
||||
|
||||
$(BUILD_DIR)/%.c.o: %.cpp
|
||||
$(BUILD_DIR)/%.cpp.o: %.cpp
|
||||
mkdir -p $(dir $@)
|
||||
$(CC) $(CFLAGS) -c $< -o $@
|
||||
|
||||
|
BIN
build/src/helloworld.cpp.o
Normal file
BIN
build/src/helloworld.cpp.o
Normal file
Binary file not shown.
BIN
build/src/main.cpp.o
Normal file
BIN
build/src/main.cpp.o
Normal file
Binary file not shown.
BIN
build/untap
Executable file
BIN
build/untap
Executable file
Binary file not shown.
24
src/helloworld.cpp
Normal file
24
src/helloworld.cpp
Normal file
@ -0,0 +1,24 @@
|
||||
#include "include/helloworld.h"
|
||||
|
||||
#include <iostream>
|
||||
|
||||
HelloWorld::HelloWorld()
|
||||
: m_button("Hello world!")
|
||||
{
|
||||
m_button.set_margin(10);
|
||||
|
||||
m_button.signal_clicked().connect(sigc::mem_fun(*this,
|
||||
&HelloWorld::on_button_clicked));
|
||||
|
||||
set_child(m_button);
|
||||
}
|
||||
|
||||
HelloWorld::~HelloWorld()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void HelloWorld::on_button_clicked()
|
||||
{
|
||||
std::cout << "Hello, World!" << std::endl;
|
||||
}
|
19
src/include/helloworld.h
Normal file
19
src/include/helloworld.h
Normal file
@ -0,0 +1,19 @@
|
||||
#ifndef GTKMM_EXAMPLE_HELLOWORLD_H
|
||||
#define GTKMM_EXAMPLE_HELLOWORLD_H
|
||||
|
||||
#include <gtkmm/button.h>
|
||||
#include <gtkmm/window.h>
|
||||
|
||||
class HelloWorld : public Gtk::Window
|
||||
{
|
||||
public:
|
||||
HelloWorld();
|
||||
~HelloWorld() override;
|
||||
|
||||
protected:
|
||||
void on_button_clicked();
|
||||
|
||||
Gtk::Button m_button;
|
||||
};
|
||||
|
||||
#endif
|
10
src/main.cpp
10
src/main.cpp
@ -0,0 +1,10 @@
|
||||
#include "include/helloworld.h"
|
||||
|
||||
#include <gtkmm/application.h>
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
auto app = Gtk::Application::create("org.gtkmm.example");
|
||||
|
||||
return app->make_window_and_run<HelloWorld>(argc, argv);
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user