Skip to content

Instantly share code, notes, and snippets.

View vadz's full-sized avatar

VZ vadz

View GitHub Profile
@vadz
vadz / transparent_textctrl.cpp
Created April 6, 2024 23:22
Example of a "transparent" wxTextCtrl under Windows
#include <wx/app.h>
#include <wx/artprov.h>
#include <wx/custombgwin.h>
#include <wx/dcclient.h>
#include <wx/frame.h>
#include <wx/sizer.h>
#include <wx/textctrl.h>
#include <wx/msw/private.h>
@vadz
vadz / build-glibc.yml
Created March 20, 2024 00:08
Workflow to build glibc-2.28 under Ubuntu 18.04
# Build glibc 2.28 under Ubuntu 18.04 to be able to use it with node 20.
name: Build glibc 2.28 under Ubuntu 18.04
on:
push:
jobs:
test:
runs-on: ubuntu-latest
container: ubuntu:18.04
@vadz
vadz / splitter.cpp
Created March 19, 2024 16:46
Example of using `wxSplitterWindow`
#include <wx/app.h>
#include <wx/frame.h>
#include <wx/splitter.h>
#include <wx/textctrl.h>
class TextCtrlShowingSize : public wxTextCtrl {
public:
explicit TextCtrlShowingSize(wxWindow* parent) : wxTextCtrl(parent, wxID_ANY, {}) {
Bind(wxEVT_SIZE, [this](wxSizeEvent& event) {
auto size = event.GetSize();
@vadz
vadz / aui-tabart.cpp
Created March 16, 2024 17:24
Example of using custom tab art with wxAUI
#include <wx/app.h>
#include <wx/dc.h>
#include <wx/frame.h>
#include <wx/panel.h>
#include <wx/sizer.h>
#include <wx/textctrl.h>
#include <wx/aui/aui.h>
class TestDockArt : public wxAuiDefaultDockArt {
@vadz
vadz / aui-dockart.cpp
Created March 16, 2024 17:18
Example of defining a custom dock art provider
#include <wx/app.h>
#include <wx/dc.h>
#include <wx/frame.h>
#include <wx/panel.h>
#include <wx/sizer.h>
#include <wx/textctrl.h>
#include <wx/aui/aui.h>
class TestDockArt : public wxAuiDefaultDockArt {
@vadz
vadz / aui-panel.cpp
Created March 16, 2024 17:10
Example of using AUI with a panel (and not a frame)
#include <wx/app.h>
#include <wx/frame.h>
#include <wx/panel.h>
#include <wx/sizer.h>
#include <wx/textctrl.h>
#include <wx/aui/aui.h>
class TestPanel : public wxPanel {
public:
@vadz
vadz / tst.cpp
Created March 16, 2024 16:54
Example of using layered window with wxWidgets
// This is a simple example of a wxWidgets application using window without the
// standard "chrome", i.e. title bar and borders.
//
// With MSVS you can use the provided solution file to build it. With other
// compilers, remmeber to link against dwmapi.lib in addition to all the rest.
#include "wx/app.h"
#include "wx/button.h"
#include "wx/dcclient.h"
#include "wx/frame.h"
#include "wx/graphics.h"
@vadz
vadz / fix_wl_display_flush.c
Created October 3, 2023 22:50
LD-preloadable library preventing GTK from killing applications using it under Wayland
/*
Build with
$ cc -Wall -O2 -fPIC -shared -o libfix_wl_display_flush.so fix_wl_display_flush.c
Use as
$ LD_PRELOAD=libfix_wl_display_flush.so ./app
*/
#define _GNU_SOURCE
@vadz
vadz / thrloc.cpp
Created March 31, 2014 12:05
Dirty test for std::ostringstream::imbue() thread safety
#include <assert.h>
#include <locale.h>
#include <pthread.h>
#include <stdio.h>
#include <string.h>
#include <locale>
#include <sstream>
#include <string>
@vadz
vadz / optional.i
Created March 4, 2019 13:39
Main optional.i file
%{
#include "optionalvalue.h"
%}
// Provide simplified declarations of various template classes we use for SWIG.
template <typename T>
class OptionalValue
{
public:
OptionalValue();